mirror of https://github.com/acanas/swad-core.git
Version 18.11.20
This commit is contained in:
parent
8ec272448b
commit
9225511dec
|
@ -1018,16 +1018,17 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Grp_RemUsrFromAllGrps (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's requests for inscription *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr_requests WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's requests for inscription");
|
||||
DB_QueryDELETE ("can not remove user's requests for inscription",
|
||||
"DELETE FROM crs_usr_requests WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from possible duplicate users *****/
|
||||
Dup_RemoveUsrFromDuplicated (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from the table of courses and users *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from all courses");
|
||||
DB_QueryDELETE ("can not remove a user from all courses",
|
||||
"DELETE FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
|
@ -1038,9 +1039,9 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/***** Remove user as administrator of any degree *****/
|
||||
DB_BuildQuery ("DELETE FROM admin WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user as administrator");
|
||||
DB_QueryDELETE ("can not remove a user as administrator",
|
||||
"DELETE FROM admin WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
|
@ -1094,12 +1095,14 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Ann_RemoveUsrFromSeenAnnouncements (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from table of connected users *****/
|
||||
DB_BuildQuery ("DELETE FROM connected WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from table of connected users");
|
||||
DB_QueryDELETE ("can not remove a user from table of connected users",
|
||||
"DELETE FROM connected WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove all sessions of this user *****/
|
||||
DB_BuildQuery ("DELETE FROM sessions WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove sessions of a user");
|
||||
DB_QueryDELETE ("can not remove sessions of a user",
|
||||
"DELETE FROM sessions WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove social content associated to the user *****/
|
||||
Soc_RemoveUsrSocialContent (UsrDat->UsrCod);
|
||||
|
@ -1160,31 +1163,38 @@ static void Acc_RemoveUsrBriefcase (struct UsrData *UsrDat)
|
|||
static void Acc_RemoveUsr (struct UsrData *UsrDat)
|
||||
{
|
||||
/***** Remove user's webs / social networks *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_webs WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's webs / social networks");
|
||||
DB_QueryDELETE ("can not remove user's webs / social networks",
|
||||
"DELETE FROM usr_webs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's nicknames *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_nicknames WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's nicknames");
|
||||
DB_QueryDELETE ("can not remove user's nicknames",
|
||||
"DELETE FROM usr_nicknames WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's emails *****/
|
||||
DB_BuildQuery ("DELETE FROM pending_emails WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove pending user's emails");
|
||||
DB_QueryDELETE ("can not remove pending user's emails",
|
||||
"DELETE FROM pending_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
DB_BuildQuery ("DELETE FROM usr_emails WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's emails");
|
||||
DB_QueryDELETE ("can not remove user's emails",
|
||||
"DELETE FROM usr_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's IDs *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_IDs WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's IDs");
|
||||
DB_QueryDELETE ("can not remove user's IDs",
|
||||
"DELETE FROM usr_IDs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's last data *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_last WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's last data");
|
||||
DB_QueryDELETE ("can not remove user's last data",
|
||||
"DELETE FROM usr_last WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's data *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_data WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's data");
|
||||
DB_QueryDELETE ("can not remove user's data",
|
||||
"DELETE FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1341,9 +1341,9 @@ void Agd_RemoveEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Remove event *****/
|
||||
DB_BuildQuery ("DELETE FROM agendas WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove event");
|
||||
DB_QueryDELETE ("can not remove event",
|
||||
"DELETE FROM agendas WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1750,8 +1750,9 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
void Agd_RemoveUsrEvents (long UsrCod)
|
||||
{
|
||||
/***** Remove events *****/
|
||||
DB_BuildQuery ("DELETE FROM agendas WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove all the events of a user");
|
||||
DB_QueryDELETE ("can not remove all the events of a user",
|
||||
"DELETE FROM agendas WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -569,12 +569,14 @@ void Ann_RemoveAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Remove announcement *****/
|
||||
DB_BuildQuery ("DELETE FROM announcements WHERE AnnCod=%ld",AnnCod);
|
||||
DB_QueryDELETE_new ("can not remove announcement");
|
||||
DB_QueryDELETE ("can not remove announcement",
|
||||
"DELETE FROM announcements WHERE AnnCod=%ld",
|
||||
AnnCod);
|
||||
|
||||
/***** Remove users who have seen the announcement *****/
|
||||
DB_BuildQuery ("DELETE FROM ann_seen WHERE AnnCod=%ld",AnnCod);
|
||||
DB_QueryDELETE_new ("can not remove announcement");
|
||||
DB_QueryDELETE ("can not remove announcement",
|
||||
"DELETE FROM ann_seen WHERE AnnCod=%ld",
|
||||
AnnCod);
|
||||
|
||||
/***** Write message of success *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Announcement_removed);
|
||||
|
@ -613,6 +615,7 @@ void Ann_MarkAnnouncementAsSeen (void)
|
|||
void Ann_RemoveUsrFromSeenAnnouncements (long UsrCod)
|
||||
{
|
||||
/***** Remove user from seen announcements *****/
|
||||
DB_BuildQuery ("DELETE FROM ann_seen WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from seen announcements");
|
||||
DB_QueryDELETE ("can not remove user from seen announcements",
|
||||
"DELETE FROM ann_seen WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
|
|
@ -1026,9 +1026,9 @@ void Asg_RemoveAssignment (void)
|
|||
Asg_RemoveAllTheGrpsAssociatedToAnAssignment (Asg.AsgCod);
|
||||
|
||||
/***** Remove assignment *****/
|
||||
DB_BuildQuery ("DELETE FROM assignments WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove assignment");
|
||||
DB_QueryDELETE ("can not remove assignment",
|
||||
"DELETE FROM assignments WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Asg.AsgCod);
|
||||
|
@ -1574,8 +1574,9 @@ bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod)
|
|||
static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod)
|
||||
{
|
||||
/***** Remove groups of the assignment *****/
|
||||
DB_BuildQuery ("DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod);
|
||||
DB_QueryDELETE_new ("can not remove the groups associated to an assignment");
|
||||
DB_QueryDELETE ("can not remove the groups associated to an assignment",
|
||||
"DELETE FROM asg_grp WHERE AsgCod=%ld",
|
||||
AsgCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1585,9 +1586,10 @@ static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod)
|
|||
void Asg_RemoveGroup (long GrpCod)
|
||||
{
|
||||
/***** Remove group from all the assignments *****/
|
||||
DB_BuildQuery ("DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove group from the associations"
|
||||
" between assignments and groups");
|
||||
DB_QueryDELETE ("can not remove group from the associations"
|
||||
" between assignments and groups",
|
||||
"DELETE FROM asg_grp WHERE GrpCod=%ld",
|
||||
GrpCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1597,12 +1599,12 @@ void Asg_RemoveGroup (long GrpCod)
|
|||
void Asg_RemoveGroupsOfType (long GrpTypCod)
|
||||
{
|
||||
/***** Remove group from all the assignments *****/
|
||||
DB_BuildQuery ("DELETE FROM asg_grp USING crs_grp,asg_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=asg_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type from the associations"
|
||||
" between assignments and groups");
|
||||
DB_QueryDELETE ("can not remove groups of a type from the associations"
|
||||
" between assignments and groups",
|
||||
"DELETE FROM asg_grp USING crs_grp,asg_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=asg_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1700,15 +1702,17 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg)
|
|||
void Asg_RemoveCrsAssignments (long CrsCod)
|
||||
{
|
||||
/***** Remove groups *****/
|
||||
DB_BuildQuery ("DELETE FROM asg_grp USING assignments,asg_grp"
|
||||
" WHERE assignments.CrsCod=%ld"
|
||||
" AND assignments.AsgCod=asg_grp.AsgCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the groups associated to assignments of a course");
|
||||
DB_QueryDELETE ("can not remove all the groups associated"
|
||||
" to assignments of a course",
|
||||
"DELETE FROM asg_grp USING assignments,asg_grp"
|
||||
" WHERE assignments.CrsCod=%ld"
|
||||
" AND assignments.AsgCod=asg_grp.AsgCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove assignments *****/
|
||||
DB_BuildQuery ("DELETE FROM assignments WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the assignments of a course");
|
||||
DB_QueryDELETE ("can not remove all the assignments of a course",
|
||||
"DELETE FROM assignments WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1442,8 +1442,10 @@ bool Att_CheckIfAttEventIsAssociatedToGrp (long AttCod,long GrpCod)
|
|||
static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
||||
{
|
||||
/***** Remove groups of the attendance event *****/
|
||||
DB_BuildQuery ("DELETE FROM att_grp WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE_new ("can not remove the groups associated to an attendance event");
|
||||
DB_QueryDELETE ("can not remove the groups"
|
||||
" associated to an attendance event",
|
||||
"DELETE FROM att_grp WHERE AttCod=%ld",
|
||||
AttCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1453,8 +1455,10 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
|||
void Att_RemoveGroup (long GrpCod)
|
||||
{
|
||||
/***** Remove group from all the attendance events *****/
|
||||
DB_BuildQuery ("DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove group from the associations between attendance events and groups");
|
||||
DB_QueryDELETE ("can not remove group from the associations"
|
||||
" between attendance events and groups",
|
||||
"DELETE FROM att_grp WHERE GrpCod=%ld",
|
||||
GrpCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1464,11 +1468,12 @@ void Att_RemoveGroup (long GrpCod)
|
|||
void Att_RemoveGroupsOfType (long GrpTypCod)
|
||||
{
|
||||
/***** Remove group from all the attendance events *****/
|
||||
DB_BuildQuery ("DELETE FROM att_grp USING crs_grp,att_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type from the associations between attendance events and groups");
|
||||
DB_QueryDELETE ("can not remove groups of a type from the associations"
|
||||
" between attendance events and groups",
|
||||
"DELETE FROM att_grp USING crs_grp,att_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1565,8 +1570,9 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve
|
|||
|
||||
static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
||||
{
|
||||
DB_BuildQuery ("DELETE FROM att_usr WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE_new ("can not remove attendance event");
|
||||
DB_QueryDELETE ("can not remove attendance event",
|
||||
"DELETE FROM att_usr WHERE AttCod=%ld",
|
||||
AttCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1576,8 +1582,9 @@ static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
|||
void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
||||
{
|
||||
/***** Remove group from all the attendance events *****/
|
||||
DB_BuildQuery ("DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from all attendance events");
|
||||
DB_QueryDELETE ("can not remove user from all attendance events",
|
||||
"DELETE FROM att_usr WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1587,12 +1594,12 @@ void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
|||
void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
||||
{
|
||||
/***** Remove group from all the attendance events *****/
|
||||
DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod"
|
||||
" AND att_usr.UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from attendance events of a course");
|
||||
DB_QueryDELETE ("can not remove user from attendance events of a course",
|
||||
"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod"
|
||||
" AND att_usr.UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1601,10 +1608,10 @@ void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
|||
|
||||
static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
||||
{
|
||||
DB_BuildQuery ("DELETE FROM att_events"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove attendance event");
|
||||
DB_QueryDELETE ("can not remove attendance event",
|
||||
"DELETE FROM att_events"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1614,22 +1621,25 @@ static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
|||
void Att_RemoveCrsAttEvents (long CrsCod)
|
||||
{
|
||||
/***** Remove students *****/
|
||||
DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the students registered in events of a course");
|
||||
DB_QueryDELETE ("can not remove all the students registered"
|
||||
" in events of a course",
|
||||
"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove groups *****/
|
||||
DB_BuildQuery ("DELETE FROM att_grp USING att_events,att_grp"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_grp.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the groups associated to attendance events of a course");
|
||||
DB_QueryDELETE ("can not remove all the groups associated"
|
||||
" to attendance events of a course",
|
||||
"DELETE FROM att_grp USING att_events,att_grp"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_grp.AttCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove attendance events *****/
|
||||
DB_BuildQuery ("DELETE FROM att_events WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the attendance events of a course");
|
||||
DB_QueryDELETE ("can not remove all the attendance events of a course",
|
||||
"DELETE FROM att_events WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2620,10 +2630,9 @@ static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool P
|
|||
static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod)
|
||||
{
|
||||
/***** Remove user if there is no comment in database *****/
|
||||
DB_BuildQuery ("DELETE FROM att_usr"
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove student from an event");
|
||||
DB_QueryDELETE ("can not remove student from an event",
|
||||
"DELETE FROM att_usr WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2633,12 +2642,12 @@ static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod)
|
|||
void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod)
|
||||
{
|
||||
/***** Clean table att_usr *****/
|
||||
DB_BuildQuery ("DELETE FROM att_usr"
|
||||
" WHERE AttCod=%ld AND Present='N'"
|
||||
" AND CommentStd='' AND CommentTch=''",
|
||||
AttCod);
|
||||
DB_QueryDELETE_new ("can not remove users absent"
|
||||
" without comments from an event");
|
||||
DB_QueryDELETE ("can not remove users absent"
|
||||
" without comments from an event",
|
||||
"DELETE FROM att_usr"
|
||||
" WHERE AttCod=%ld AND Present='N'"
|
||||
" AND CommentStd='' AND CommentTch=''",
|
||||
AttCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -519,8 +519,9 @@ void Ban_RemoveBanner (void)
|
|||
Ban_GetDataOfBannerByCod (&Ban);
|
||||
|
||||
/***** Remove banner *****/
|
||||
DB_BuildQuery ("DELETE FROM banners WHERE BanCod=%ld",Ban.BanCod);
|
||||
DB_QueryDELETE_new ("can not remove a banner");
|
||||
DB_QueryDELETE ("can not remove a banner",
|
||||
"DELETE FROM banners WHERE BanCod=%ld",
|
||||
Ban.BanCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -1782,8 +1782,9 @@ void Ctr_RemoveCentre (void)
|
|||
Fil_RemoveTree (PathCtr);
|
||||
|
||||
/***** Remove centre *****/
|
||||
DB_BuildQuery ("DELETE FROM centres WHERE CtrCod=%ld",Ctr.CtrCod);
|
||||
DB_QueryDELETE_new ("can not remove a centre");
|
||||
DB_QueryDELETE ("can not remove a centre",
|
||||
"DELETE FROM centres WHERE CtrCod=%ld",
|
||||
Ctr.CtrCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.11.19 (2018-11-02)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.11.20 (2018-11-02)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.11.20: Nov 02, 2018 Joining building and performing query into one function. (236585 lines)
|
||||
Version 18.11.19: Nov 02, 2018 Joining building and performing query into one function. (236465 lines)
|
||||
Version 18.11.18: Nov 02, 2018 Joining building and performing query into one function. (236499 lines)
|
||||
Version 18.11.17: Nov 02, 2018 Joining building and performing query into one function. (236504 lines)
|
||||
|
|
|
@ -659,9 +659,9 @@ void Con_UpdateMeInConnectedList (void)
|
|||
void Con_RemoveOldConnected (void)
|
||||
{
|
||||
/***** Remove old users from connected list *****/
|
||||
DB_BuildQuery ("DELETE FROM connected WHERE UsrCod NOT IN"
|
||||
" (SELECT DISTINCT(UsrCod) FROM sessions)");
|
||||
DB_QueryDELETE_new ("can not remove old users from list of connected users");
|
||||
DB_QueryDELETE ("can not remove old users from list of connected users",
|
||||
"DELETE FROM connected WHERE UsrCod NOT IN"
|
||||
" (SELECT DISTINCT(UsrCod) FROM sessions)");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1720,8 +1720,9 @@ void Cty_RemoveCountry (void)
|
|||
Svy_RemoveSurveys (Sco_SCOPE_CTY,Cty.CtyCod);
|
||||
|
||||
/***** Remove country *****/
|
||||
DB_BuildQuery ("DELETE FROM countries WHERE CtyCod='%03ld'",Cty.CtyCod);
|
||||
DB_QueryDELETE_new ("can not remove a country");
|
||||
DB_QueryDELETE ("can not remove a country",
|
||||
"DELETE FROM countries WHERE CtyCod='%03ld'",
|
||||
Cty.CtyCod);
|
||||
|
||||
/***** Flush cache *****/
|
||||
Cty_FlushCacheCountryName ();
|
||||
|
|
|
@ -2127,12 +2127,14 @@ void Crs_RemoveCourseCompletely (long CrsCod)
|
|||
Crs_EmptyCourseCompletely (CrsCod);
|
||||
|
||||
/***** Remove course from table of last accesses to courses in database *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_last WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove a course");
|
||||
DB_QueryDELETE ("can not remove a course",
|
||||
"DELETE FROM crs_last WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove course from table of courses in database *****/
|
||||
DB_BuildQuery ("DELETE FROM courses WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove a course");
|
||||
DB_QueryDELETE ("can not remove a course",
|
||||
"DELETE FROM courses WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2162,15 +2164,18 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove information of the course ****/
|
||||
/* Remove timetable of the course */
|
||||
DB_BuildQuery ("DELETE FROM timetable_crs WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove the timetable of a course");
|
||||
DB_QueryDELETE ("can not remove the timetable of a course",
|
||||
"DELETE FROM timetable_crs WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/* Remove other information of the course */
|
||||
DB_BuildQuery ("DELETE FROM crs_info_src WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove info sources of a course");
|
||||
DB_QueryDELETE ("can not remove info sources of a course",
|
||||
"DELETE FROM crs_info_src WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
DB_BuildQuery ("DELETE FROM crs_info_txt WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove info of a course");
|
||||
DB_QueryDELETE ("can not remove info of a course",
|
||||
"DELETE FROM crs_info_txt WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove exam announcements in the course *****/
|
||||
/* Mark all exam announcements in the course as deleted */
|
||||
|
@ -2181,15 +2186,17 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove course cards of the course *****/
|
||||
/* Remove content of course cards */
|
||||
DB_BuildQuery ("DELETE FROM crs_records USING crs_record_fields,crs_records"
|
||||
" WHERE crs_record_fields.CrsCod=%ld"
|
||||
" AND crs_record_fields.FieldCod=crs_records.FieldCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove content of cards in a course");
|
||||
DB_QueryDELETE ("can not remove content of cards in a course",
|
||||
"DELETE FROM crs_records"
|
||||
" USING crs_record_fields,crs_records"
|
||||
" WHERE crs_record_fields.CrsCod=%ld"
|
||||
" AND crs_record_fields.FieldCod=crs_records.FieldCod",
|
||||
CrsCod);
|
||||
|
||||
/* Remove definition of fields in course cards */
|
||||
DB_BuildQuery ("DELETE FROM crs_record_fields WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove fields of cards in a course");
|
||||
DB_QueryDELETE ("can not remove fields of cards in a course",
|
||||
"DELETE FROM crs_record_fields WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove information related to files in course,
|
||||
including groups and projects,
|
||||
|
@ -2217,8 +2224,9 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
CrsCod);
|
||||
|
||||
/* Remove all notices from the course */
|
||||
DB_BuildQuery ("DELETE FROM notices WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove notices in a course");
|
||||
DB_QueryDELETE ("can not remove notices in a course",
|
||||
"DELETE FROM notices WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove all the threads and posts in forums of the course *****/
|
||||
For_RemoveForums (Sco_SCOPE_CRS,CrsCod);
|
||||
|
@ -2234,33 +2242,36 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove groups in the course *****/
|
||||
/* Remove all the users in groups in the course */
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr"
|
||||
" USING crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove users from groups of a course");
|
||||
DB_QueryDELETE ("can not remove users from groups of a course",
|
||||
"DELETE FROM crs_grp_usr"
|
||||
" USING crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod",
|
||||
CrsCod);
|
||||
|
||||
/* Remove all the groups in the course */
|
||||
DB_BuildQuery ("DELETE FROM crs_grp"
|
||||
" USING crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a course");
|
||||
DB_QueryDELETE ("can not remove groups of a course",
|
||||
"DELETE FROM crs_grp"
|
||||
" USING crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod",
|
||||
CrsCod);
|
||||
|
||||
/* Remove all the group types in the course */
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_types WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove types of group of a course");
|
||||
DB_QueryDELETE ("can not remove types of group of a course",
|
||||
"DELETE FROM crs_grp_types WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove users' requests for inscription in the course *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr_requests WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove requests for inscription to a course");
|
||||
DB_QueryDELETE ("can not remove requests for inscription to a course",
|
||||
"DELETE FROM crs_usr_requests WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove possible users remaining in the course (teachers) *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove users from a course");
|
||||
DB_QueryDELETE ("can not remove users from a course",
|
||||
"DELETE FROM crs_usr WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove directories of the course *****/
|
||||
snprintf (PathRelCrs,sizeof (PathRelCrs),
|
||||
|
|
|
@ -3330,6 +3330,35 @@ void DB_QueryUPDATE_old (char **Query,const char *MsgError)
|
|||
/******************** Make a DELETE query from database **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void DB_QueryDELETE (const char *MsgError,const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
int NumBytesPrinted;
|
||||
char *Query = NULL;
|
||||
int Result;
|
||||
|
||||
va_start (ap,fmt);
|
||||
NumBytesPrinted = vasprintf (&Query,fmt,ap);
|
||||
va_end (ap);
|
||||
|
||||
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
|
||||
// or some other error occurs,
|
||||
// vasprintf will return -1
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Check that query string pointer
|
||||
does point to an allocated string *****/
|
||||
if (Query == NULL)
|
||||
Lay_ShowErrorAndExit ("Wrong query string.");
|
||||
|
||||
/***** Query database and free query string pointer *****/
|
||||
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
|
||||
free ((void *) Query);
|
||||
Query = NULL;
|
||||
if (Result)
|
||||
DB_ExitOnMySQLError (MsgError);
|
||||
}
|
||||
|
||||
void DB_QueryDELETE_new (const char *MsgError)
|
||||
{
|
||||
int Result;
|
||||
|
|
|
@ -58,6 +58,7 @@ void DB_QueryREPLACE (const char *MsgError,const char *fmt,...);
|
|||
void DB_QueryUPDATE_new (const char *MsgError);
|
||||
void DB_QueryUPDATE_old (char **Query,const char *MsgError);
|
||||
|
||||
void DB_QueryDELETE (const char *MsgError,const char *fmt,...);
|
||||
void DB_QueryDELETE_new (const char *MsgError);
|
||||
|
||||
void DB_Query_new (const char *MsgError);
|
||||
|
|
|
@ -1889,13 +1889,14 @@ void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
Fil_RemoveTree (PathDeg);
|
||||
|
||||
/***** Remove administrators of this degree *****/
|
||||
DB_BuildQuery ("DELETE FROM admin WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],DegCod);
|
||||
DB_QueryDELETE_new ("can not remove administrators of a degree");
|
||||
DB_QueryDELETE ("can not remove administrators of a degree",
|
||||
"DELETE FROM admin WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],DegCod);
|
||||
|
||||
/***** Remove the degree *****/
|
||||
DB_BuildQuery ("DELETE FROM degrees WHERE DegCod=%ld",DegCod);
|
||||
DB_QueryDELETE_new ("can not remove a degree");
|
||||
DB_QueryDELETE ("can not remove a degree",
|
||||
"DELETE FROM degrees WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
|
||||
/***** Delete all the degrees in sta_degrees table not present in degrees table *****/
|
||||
Pho_RemoveObsoleteStatDegrees ();
|
||||
|
|
|
@ -902,8 +902,9 @@ static void DT_RemoveDegreeTypeCompletely (long DegTypCod)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Remove the degree type *****/
|
||||
DB_BuildQuery ("DELETE FROM deg_types WHERE DegTypCod=%ld",DegTypCod);
|
||||
DB_QueryDELETE_new ("can not remove a type of degree");
|
||||
DB_QueryDELETE ("can not remove a type of degree",
|
||||
"DELETE FROM deg_types WHERE DegTypCod=%ld",
|
||||
DegTypCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -618,8 +618,9 @@ void Dpt_RemoveDepartment (void)
|
|||
else // Department has no teachers ==> remove it
|
||||
{
|
||||
/***** Remove department *****/
|
||||
DB_BuildQuery ("DELETE FROM departments WHERE DptCod=%ld",Dpt.DptCod);
|
||||
DB_QueryDELETE_new ("can not remove a department");
|
||||
DB_QueryDELETE ("can not remove a department",
|
||||
"DELETE FROM departments WHERE DptCod=%ld",
|
||||
Dpt.DptCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -467,6 +467,6 @@ void Dup_RemoveUsrFromListDupUsrs (void)
|
|||
void Dup_RemoveUsrFromDuplicated (long UsrCod)
|
||||
{
|
||||
/***** Remove user from list of duplicated users *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_duplicated WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from possible duplicates");
|
||||
DB_QueryDELETE ("can not remove a user from possible duplicates",
|
||||
"DELETE FROM usr_duplicated WHERE UsrCod=%ld",UsrCod);
|
||||
}
|
||||
|
|
|
@ -3048,10 +3048,10 @@ static void Enr_RemoveEnrolmentRequest (long CrsCod,long UsrCod)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Remove enrolment request *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr_requests"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a request for enrolment");
|
||||
DB_QueryDELETE ("can not remove a request for enrolment",
|
||||
"DELETE FROM crs_usr_requests"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3073,10 +3073,10 @@ static void Enr_RemoveExpiredEnrolmentRequests (void)
|
|||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
|
||||
/***** Remove expired requests for enrolment *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr_requests"
|
||||
" WHERE RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
|
||||
DB_QueryDELETE_new ("can not remove expired requests for enrolment");
|
||||
DB_QueryDELETE ("can not remove expired requests for enrolment",
|
||||
"DELETE FROM crs_usr_requests"
|
||||
" WHERE RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4234,10 +4234,10 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
Ntf_MarkNotifInCrsAsRemoved (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove user from the table of courses-users *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_usr"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Crs->CrsCod,UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from a course");
|
||||
DB_QueryDELETE ("can not remove a user from a course",
|
||||
"DELETE FROM crs_usr"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Crs->CrsCod,UsrDat->UsrCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Usr_FlushCachesUsr ();
|
||||
|
@ -4346,10 +4346,10 @@ static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
|
|||
if (Usr_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) // User is administrator of current institution/centre/degree
|
||||
{
|
||||
/***** Remove user from the table of admins *****/
|
||||
DB_BuildQuery ("DELETE FROM admin"
|
||||
" WHERE UsrCod=%ld AND Scope='%s' AND Cod=%ld",
|
||||
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove an administrator");
|
||||
DB_QueryDELETE ("can not remove an administrator",
|
||||
"DELETE FROM admin"
|
||||
" WHERE UsrCod=%ld AND Scope='%s' AND Cod=%ld",
|
||||
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
Txt_THE_USER_X_has_been_removed_as_administrator_of_Y,
|
||||
|
|
1298
swad_file_browser.c
1298
swad_file_browser.c
File diff suppressed because it is too large
Load Diff
|
@ -1220,8 +1220,8 @@ void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
||||
{
|
||||
DB_BuildQuery ("DELETE FROM usr_follow"
|
||||
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from followers and followed");
|
||||
DB_QueryDELETE ("can not remove user from followers and followed",
|
||||
"DELETE FROM usr_follow"
|
||||
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
}
|
||||
|
|
156
swad_forum.c
156
swad_forum.c
|
@ -470,8 +470,9 @@ static bool For_GetIfPstIsEnabled (long PstCod)
|
|||
static void For_DeletePstFromDisabledPstTable (long PstCod)
|
||||
{
|
||||
/***** Remove post from disabled posts table *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_disabled_post WHERE PstCod=%ld",PstCod);
|
||||
DB_QueryDELETE_new ("can not unban a post of a forum");
|
||||
DB_QueryDELETE ("can not unban a post of a forum",
|
||||
"DELETE FROM forum_disabled_post WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -543,8 +544,9 @@ static bool For_RemoveForumPst (long PstCod,struct Image *Image)
|
|||
}
|
||||
|
||||
/***** Delete post from forum post table *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_post WHERE PstCod=%ld",PstCod);
|
||||
DB_QueryDELETE_new ("can not remove a post from a forum");
|
||||
DB_QueryDELETE ("can not remove a post from a forum",
|
||||
"DELETE FROM forum_post WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
|
||||
/***** Delete the post from the table of disabled forum posts *****/
|
||||
For_DeletePstFromDisabledPstTable (PstCod);
|
||||
|
@ -616,8 +618,9 @@ static void For_RemoveThreadOnly (long ThrCod)
|
|||
For_RemoveThrCodFromThrClipboard (ThrCod);
|
||||
|
||||
/***** Delete thread from forum thread table *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thread WHERE ThrCod=%ld",ThrCod);
|
||||
DB_QueryDELETE_new ("can not remove a thread from a forum");
|
||||
DB_QueryDELETE ("can not remove a thread from a forum",
|
||||
"DELETE FROM forum_thread WHERE ThrCod=%ld",
|
||||
ThrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -627,16 +630,17 @@ static void For_RemoveThreadOnly (long ThrCod)
|
|||
static void For_RemoveThreadAndItsPsts (long ThrCod)
|
||||
{
|
||||
/***** Delete banned posts in thread *****/
|
||||
DB_BuildQuery ("DELETE forum_disabled_post"
|
||||
" FROM forum_post,forum_disabled_post"
|
||||
" WHERE forum_post.ThrCod=%ld"
|
||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||
ThrCod);
|
||||
DB_QueryDELETE_new ("can not unban the posts of a thread of a forum");
|
||||
DB_QueryDELETE ("can not unban the posts of a thread of a forum",
|
||||
"DELETE forum_disabled_post"
|
||||
" FROM forum_post,forum_disabled_post"
|
||||
" WHERE forum_post.ThrCod=%ld"
|
||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||
ThrCod);
|
||||
|
||||
/***** Delete thread posts *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_post WHERE ThrCod=%ld",ThrCod);
|
||||
DB_QueryDELETE_new ("can not remove the posts of a thread of a forum");
|
||||
DB_QueryDELETE ("can not remove the posts of a thread of a forum",
|
||||
"DELETE FROM forum_post WHERE ThrCod=%ld",
|
||||
ThrCod);
|
||||
|
||||
/***** Delete thread from forum thread table *****/
|
||||
For_RemoveThreadOnly (ThrCod);
|
||||
|
@ -900,8 +904,10 @@ static time_t For_GetThrReadTime (long ThrCod)
|
|||
static void For_DeleteThrFromReadThrs (long ThrCod)
|
||||
{
|
||||
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a thread *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thr_read WHERE ThrCod=%ld",ThrCod);
|
||||
DB_QueryDELETE_new ("can not remove the status of reading of a thread of a forum");
|
||||
DB_QueryDELETE ("can not remove the status of reading"
|
||||
" of a thread of a forum",
|
||||
"DELETE FROM forum_thr_read WHERE ThrCod=%ld",
|
||||
ThrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -911,8 +917,10 @@ static void For_DeleteThrFromReadThrs (long ThrCod)
|
|||
void For_RemoveUsrFromReadThrs (long UsrCod)
|
||||
{
|
||||
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a user *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thr_read WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove the status of reading by a user of all the threads of a forum");
|
||||
DB_QueryDELETE ("can not remove the status of reading by a user"
|
||||
" of all the threads of a forum",
|
||||
"DELETE FROM forum_thr_read WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4482,10 +4490,10 @@ static void For_InsertThrInClipboard (long ThrCod)
|
|||
static void For_RemoveExpiredThrsClipboards (void)
|
||||
{
|
||||
/***** Remove all expired clipboards *****/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM forum_thr_clip"
|
||||
" WHERE TimeInsert<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_THREAD_CLIPBOARD);
|
||||
DB_QueryDELETE_new ("can not remove old threads from clipboards");
|
||||
DB_QueryDELETE ("can not remove old threads from clipboards",
|
||||
"DELETE LOW_PRIORITY FROM forum_thr_clip"
|
||||
" WHERE TimeInsert<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_THREAD_CLIPBOARD);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4495,8 +4503,9 @@ static void For_RemoveExpiredThrsClipboards (void)
|
|||
static void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
||||
{
|
||||
/***** Remove thread from thread clipboard *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thr_clip WHERE ThrCod=%ld",ThrCod);
|
||||
DB_QueryDELETE_new ("can not remove a thread from clipboard");
|
||||
DB_QueryDELETE ("can not remove a thread from clipboard",
|
||||
"DELETE FROM forum_thr_clip WHERE ThrCod=%ld",
|
||||
ThrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4506,8 +4515,9 @@ static void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
|||
void For_RemoveUsrFromThrClipboard (long UsrCod)
|
||||
{
|
||||
/***** Remove clipboard of specified user *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thr_clip WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a thread from the clipboard of a user");
|
||||
DB_QueryDELETE ("can not remove a thread from the clipboard of a user",
|
||||
"DELETE FROM forum_thr_clip WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4532,57 +4542,57 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
|||
};
|
||||
|
||||
/***** Remove disabled posts *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_disabled_post"
|
||||
" USING forum_thread,forum_post,forum_disabled_post"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod"
|
||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
DB_QueryDELETE_new ("can not remove the disabled posts in forums");
|
||||
DB_QueryDELETE ("can not remove the disabled posts in forums",
|
||||
"DELETE FROM forum_disabled_post"
|
||||
" USING forum_thread,forum_post,forum_disabled_post"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod"
|
||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
|
||||
/***** Remove posts *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_post"
|
||||
" USING forum_thread,forum_post"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
DB_QueryDELETE_new ("can not remove posts in forums");
|
||||
DB_QueryDELETE ("can not remove posts in forums",
|
||||
"DELETE FROM forum_post"
|
||||
" USING forum_thread,forum_post"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
|
||||
/***** Remove threads read *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thr_read"
|
||||
" USING forum_thread,forum_thr_read"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
DB_QueryDELETE_new ("can not remove read threads in forums");
|
||||
DB_QueryDELETE ("can not remove read threads in forums",
|
||||
"DELETE FROM forum_thr_read"
|
||||
" USING forum_thread,forum_thr_read"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND forum_thread.Location=%ld"
|
||||
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
|
||||
/***** Remove threads *****/
|
||||
DB_BuildQuery ("DELETE FROM forum_thread"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND Location=%ld",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
DB_QueryDELETE_new ("can not remove threads in forums");
|
||||
DB_QueryDELETE ("can not remove threads in forums",
|
||||
"DELETE FROM forum_thread"
|
||||
" WHERE"
|
||||
" (forum_thread.ForumType=%u"
|
||||
" OR"
|
||||
" forum_thread.ForumType=%u)"
|
||||
" AND Location=%ld",
|
||||
ForumType[Scope].Usrs,
|
||||
ForumType[Scope].Tchs,
|
||||
ForumLocation);
|
||||
}
|
||||
|
|
117
swad_game.c
117
swad_game.c
|
@ -1521,19 +1521,22 @@ void Gam_RemoveGame (void)
|
|||
Lay_ShowErrorAndExit ("You can not remove this game.");
|
||||
|
||||
/***** Remove all the users in this game *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_users WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryDELETE_new ("can not remove users who are answered a game");
|
||||
DB_QueryDELETE ("can not remove users who are answered a game",
|
||||
"DELETE FROM gam_users WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Remove all the questions in this game *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_questions WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryDELETE_new ("can not remove questions of a game");
|
||||
DB_QueryDELETE ("can not remove questions of a game",
|
||||
"DELETE FROM gam_questions WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Remove all the groups of this game *****/
|
||||
Gam_RemoveAllTheGrpsAssociatedToAndGame (Game.GamCod);
|
||||
|
||||
/***** Remove game *****/
|
||||
DB_BuildQuery ("DELETE FROM games WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryDELETE_new ("can not remove game");
|
||||
DB_QueryDELETE ("can not remove game",
|
||||
"DELETE FROM games WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1615,8 +1618,9 @@ void Gam_ResetGame (void)
|
|||
Lay_ShowErrorAndExit ("You can not reset this game.");
|
||||
|
||||
/***** Remove all the users in this game *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_users WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryDELETE_new ("can not remove users who are answered a game");
|
||||
DB_QueryDELETE ("can not remove users who are answered a game",
|
||||
"DELETE FROM gam_users WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Reset all the answers in this game *****/
|
||||
DB_BuildQuery ("UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
||||
|
@ -2270,8 +2274,9 @@ bool Gam_CheckIfGamIsAssociatedToGrp (long GamCod,long GrpCod)
|
|||
static void Gam_RemoveAllTheGrpsAssociatedToAndGame (long GamCod)
|
||||
{
|
||||
/***** Remove groups of the game *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_grp WHERE GamCod=%ld",GamCod);
|
||||
DB_QueryDELETE_new ("can not remove the groups associated to a game");
|
||||
DB_QueryDELETE ("can not remove the groups associated to a game",
|
||||
"DELETE FROM gam_grp WHERE GamCod=%ld",
|
||||
GamCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2281,9 +2286,10 @@ static void Gam_RemoveAllTheGrpsAssociatedToAndGame (long GamCod)
|
|||
void Gam_RemoveGroup (long GrpCod)
|
||||
{
|
||||
/***** Remove group from all the games *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove group"
|
||||
" from the associations between games and groups");
|
||||
DB_QueryDELETE ("can not remove group"
|
||||
" from the associations between games and groups",
|
||||
"DELETE FROM gam_grp WHERE GrpCod=%ld",
|
||||
GrpCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2293,12 +2299,12 @@ void Gam_RemoveGroup (long GrpCod)
|
|||
void Gam_RemoveGroupsOfType (long GrpTypCod)
|
||||
{
|
||||
/***** Remove group from all the games *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_grp USING crs_grp,gam_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=gam_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type"
|
||||
" from the associations between games and groups");
|
||||
DB_QueryDELETE ("can not remove groups of a type"
|
||||
" from the associations between games and groups",
|
||||
"DELETE FROM gam_grp USING crs_grp,gam_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=gam_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2398,45 +2404,46 @@ void Gam_RemoveGames (Sco_Scope_t Scope,long Cod)
|
|||
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
||||
|
||||
/***** Remove all the users in course games *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_users"
|
||||
" USING games,gam_users"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_users.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove users"
|
||||
" who had answered games in a place on the hierarchy");
|
||||
DB_QueryDELETE ("can not remove users who had answered games"
|
||||
" in a place on the hierarchy",
|
||||
"DELETE FROM gam_users"
|
||||
" USING games,gam_users"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_users.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
|
||||
/***** Remove all the answers in course games *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_answers"
|
||||
" USING games,gam_questions,gam_answers"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_questions.GamCod"
|
||||
" AND gam_questions.QstCod=gam_answers.QstCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove answers of games in a place on the hierarchy");
|
||||
DB_QueryDELETE ("can not remove answers of games"
|
||||
" in a place on the hierarchy"
|
||||
"DELETE FROM gam_answers"
|
||||
" USING games,gam_questions,gam_answers"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_questions.GamCod"
|
||||
" AND gam_questions.QstCod=gam_answers.QstCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
|
||||
/***** Remove all the questions in course games *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_questions"
|
||||
" USING games,gam_questions"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_questions.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove questions of games in a place on the hierarchy");
|
||||
DB_QueryDELETE ("can not remove questions of games"
|
||||
" in a place on the hierarchy",
|
||||
"DELETE FROM gam_questions"
|
||||
" USING games,gam_questions"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_questions.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
|
||||
/***** Remove groups *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_grp"
|
||||
" USING games,gam_grp"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_grp.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove all the groups"
|
||||
" associated to games of a course");
|
||||
DB_QueryDELETE ("can not remove all the groups"
|
||||
" associated to games of a course",
|
||||
"DELETE FROM gam_grp"
|
||||
" USING games,gam_grp"
|
||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||
" AND games.GamCod=gam_grp.GamCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
|
||||
/***** Remove course games *****/
|
||||
DB_BuildQuery ("DELETE FROM games"
|
||||
" WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE_new ("can not remove all the games in a place on the hierarchy");
|
||||
DB_QueryDELETE ("can not remove all the games in a place on the hierarchy",
|
||||
"DELETE FROM games WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2543,8 +2550,9 @@ static unsigned Gam_GetParamQstInd (void)
|
|||
static void Gam_RemAnswersOfAQuestion (long QstCod)
|
||||
{
|
||||
/***** Remove answers *****/
|
||||
DB_BuildQuery ("DELETE FROM gam_answers WHERE QstCod=%ld",QstCod);
|
||||
DB_QueryDELETE_new ("can not remove the answers of a question");
|
||||
DB_QueryDELETE ("can not remove the answers of a question",
|
||||
"DELETE FROM gam_answers WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3271,8 +3279,9 @@ void Gam_RemoveQst (void)
|
|||
Gam_RemAnswersOfAQuestion (QstCod);
|
||||
|
||||
/* Remove the question itself */
|
||||
DB_BuildQuery ("DELETE FROM gam_questions WHERE QstCod=%ld",QstCod);
|
||||
DB_QueryDELETE_new ("can not remove a question");
|
||||
DB_QueryDELETE ("can not remove a question",
|
||||
"DELETE FROM gam_questions WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
if (!mysql_affected_rows (&Gbl.mysql))
|
||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
||||
|
||||
|
|
59
swad_group.c
59
swad_group.c
|
@ -1207,13 +1207,13 @@ void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
|||
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||
|
||||
/***** Remove user from all the groups of the course *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr"
|
||||
" WHERE UsrCod=%ld AND GrpCod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
UsrCod,CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from all groups of a course");
|
||||
DB_QueryDELETE ("can not remove a user from all groups of a course",
|
||||
"DELETE FROM crs_grp_usr"
|
||||
" WHERE UsrCod=%ld AND GrpCod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
UsrCod,CrsCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||
|
@ -1230,8 +1230,9 @@ void Grp_RemUsrFromAllGrps (long UsrCod)
|
|||
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||
|
||||
/***** Remove user from all groups *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from the groups he/she belongs to");
|
||||
DB_QueryDELETE ("can not remove a user from the groups he/she belongs to",
|
||||
"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||
|
@ -1248,10 +1249,10 @@ static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
|||
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||
|
||||
/***** Remove user from group *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr"
|
||||
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
||||
GrpCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from a group");
|
||||
DB_QueryDELETE ("can not remove a user from a group",
|
||||
"DELETE FROM crs_grp_usr"
|
||||
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
||||
GrpCod,UsrCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||
|
@ -4047,20 +4048,20 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
|||
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable");
|
||||
|
||||
/***** Remove all the students in groups of this type *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove users from all groups of a type");
|
||||
DB_QueryDELETE ("can not remove users from all groups of a type",
|
||||
"DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** Remove all the groups of this type *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type");
|
||||
DB_QueryDELETE ("can not remove groups of a type",
|
||||
"DELETE FROM crs_grp WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** Remove the group type *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_types WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove a type of group");
|
||||
DB_QueryDELETE ("can not remove a type of group",
|
||||
"DELETE FROM crs_grp_types WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -4103,14 +4104,14 @@ static void Grp_RemoveGroupCompletely (void)
|
|||
DB_QueryUPDATE_new ("can not update a group in course timetable");
|
||||
|
||||
/***** Remove all the students in this group *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove users from a group");
|
||||
DB_QueryDELETE ("can not remove users from a group",
|
||||
"DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** Remove the group *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_grp WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove a group");
|
||||
DB_QueryDELETE ("can not remove a group",
|
||||
"DELETE FROM crs_grp WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -665,8 +665,9 @@ void Hld_RemoveHoliday1 (void)
|
|||
Hld_GetDataOfHolidayByCod (&Hld);
|
||||
|
||||
/***** Remove holiday *****/
|
||||
DB_BuildQuery ("DELETE FROM holidays WHERE HldCod=%ld",Hld.HldCod);
|
||||
DB_QueryDELETE_new ("can not remove a holiday");
|
||||
DB_QueryDELETE ("can not remove a holiday",
|
||||
"DELETE FROM holidays WHERE HldCod=%ld",
|
||||
Hld.HldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
|
|
22
swad_info.c
22
swad_info.c
|
@ -727,15 +727,13 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
|||
DB_QueryUPDATE_new ("can not set that I have read course info");
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Remove I have read course information *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
DB_QueryDELETE_new ("can not set that I have not read course info");
|
||||
}
|
||||
DB_QueryDELETE ("can not set that I have not read course info",
|
||||
"DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -745,10 +743,10 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
|||
void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod)
|
||||
{
|
||||
/***** Remove user's status about reading of course information *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld",
|
||||
UsrCod,CrsCod);
|
||||
DB_QueryDELETE_new ("can not set that I have not read course info");
|
||||
DB_QueryDELETE ("can not set that I have not read course info",
|
||||
"DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld",
|
||||
UsrCod,CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1731,8 +1731,9 @@ void Ins_RemoveInstitution (void)
|
|||
Fil_RemoveTree (PathIns);
|
||||
|
||||
/***** Remove institution *****/
|
||||
DB_BuildQuery ("DELETE FROM institutions WHERE InsCod=%ld",Ins.InsCod);
|
||||
DB_QueryDELETE_new ("can not remove an institution");
|
||||
DB_QueryDELETE ("can not remove an institution",
|
||||
"DELETE FROM institutions WHERE InsCod=%ld",
|
||||
Ins.InsCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Ins_FlushCacheShortNameOfInstitution ();
|
||||
|
|
|
@ -498,8 +498,9 @@ void Lnk_RemoveLink (void)
|
|||
Lnk_GetDataOfLinkByCod (&Lnk);
|
||||
|
||||
/***** Remove link *****/
|
||||
DB_BuildQuery ("DELETE FROM links WHERE LnkCod=%ld",Lnk.LnkCod);
|
||||
DB_QueryDELETE_new ("can not remove an institutional link");
|
||||
DB_QueryDELETE ("can not remove an institutional link",
|
||||
"DELETE FROM links WHERE LnkCod=%ld",
|
||||
Lnk.LnkCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
36
swad_mail.c
36
swad_mail.c
|
@ -558,8 +558,9 @@ void Mai_RemoveMailDomain (void)
|
|||
Mai_GetDataOfMailDomainByCod (&Mai);
|
||||
|
||||
/***** Remove mail *****/
|
||||
DB_BuildQuery ("DELETE FROM mail_domains WHERE MaiCod=%ld",Mai.MaiCod);
|
||||
DB_QueryDELETE_new ("can not remove a mail domain");
|
||||
DB_QueryDELETE ("can not remove a mail domain",
|
||||
"DELETE FROM mail_domains WHERE MaiCod=%ld",
|
||||
Mai.MaiCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1638,16 +1639,16 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
|
|||
return false; // Don't update
|
||||
|
||||
/***** Delete email (not confirmed) for other users *****/
|
||||
DB_BuildQuery ("DELETE FROM pending_emails"
|
||||
" WHERE E_mail='%s' AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove pending email for other users");
|
||||
DB_QueryDELETE ("can not remove pending email for other users",
|
||||
"DELETE FROM pending_emails"
|
||||
" WHERE E_mail='%s' AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
|
||||
DB_BuildQuery ("DELETE FROM usr_emails"
|
||||
" WHERE E_mail='%s' AND Confirmed='N'"
|
||||
" AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove not confirmed email for other users");
|
||||
DB_QueryDELETE ("can not remove not confirmed email for other users",
|
||||
"DELETE FROM usr_emails"
|
||||
" WHERE E_mail='%s' AND Confirmed='N'"
|
||||
" AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
|
||||
/***** Update email in database *****/
|
||||
DB_QueryREPLACE ("can not update email",
|
||||
|
@ -1775,10 +1776,10 @@ static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]
|
|||
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
|
||||
{
|
||||
/***** Remove expired pending emails from database *****/
|
||||
DB_BuildQuery ("DELETE FROM pending_emails"
|
||||
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_PENDING_EMAILS);
|
||||
DB_QueryDELETE_new ("can not remove old pending mail keys");
|
||||
DB_QueryDELETE ("can not remove old pending mail keys",
|
||||
"DELETE FROM pending_emails"
|
||||
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_PENDING_EMAILS);
|
||||
|
||||
/***** Insert mail key in database *****/
|
||||
DB_QueryREPLACE ("can not create pending password",
|
||||
|
@ -1836,8 +1837,9 @@ void Mai_ConfirmEmail (void)
|
|||
if (KeyIsCorrect)
|
||||
{
|
||||
/***** Delete this key *****/
|
||||
DB_BuildQuery ("DELETE FROM pending_emails WHERE MailKey='%s'",MailKey);
|
||||
DB_QueryDELETE_new ("can not remove an email key");
|
||||
DB_QueryDELETE ("can not remove an email key",
|
||||
"DELETE FROM pending_emails WHERE MailKey='%s'",
|
||||
MailKey);
|
||||
|
||||
/***** Check user's code and email
|
||||
and get if email is already confirmed *****/
|
||||
|
|
|
@ -1401,8 +1401,9 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
|||
UsrCod);
|
||||
|
||||
/* Delete messages from msg_rcv *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_rcv WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove received messages");
|
||||
DB_QueryDELETE ("can not remove received messages",
|
||||
"DELETE FROM msg_rcv WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/***** Move message from msg_snt to msg_snt_deleted *****/
|
||||
/* Insert message into msg_snt_deleted */
|
||||
|
@ -1414,8 +1415,9 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
|||
UsrCod);
|
||||
|
||||
/* Delete message from msg_snt *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_snt WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove sent messages");
|
||||
DB_QueryDELETE ("can not remove sent messages",
|
||||
"DELETE FROM msg_snt WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1464,9 +1466,9 @@ static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod)
|
|||
MsgCod,UsrCod);
|
||||
|
||||
/* Delete message from msg_rcv *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a received message");
|
||||
DB_QueryDELETE ("can not remove a received message",
|
||||
"DELETE FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
|
||||
/***** If message content is not longer necessary, move it to msg_content_deleted *****/
|
||||
if (Msg_CheckIfSentMsgIsDeleted (MsgCod))
|
||||
|
@ -1493,8 +1495,9 @@ static void Msg_MoveSentMsgToDeleted (long MsgCod)
|
|||
MsgCod);
|
||||
|
||||
/* Delete message from msg_snt *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_snt WHERE MsgCod=%ld",MsgCod);
|
||||
DB_QueryDELETE_new ("can not remove a sent message");
|
||||
DB_QueryDELETE ("can not remove a sent message",
|
||||
"DELETE FROM msg_snt WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
|
||||
/***** If message content is not longer necessary, move it to msg_content_deleted *****/
|
||||
if (Msg_CheckIfReceivedMsgIsDeletedForAllItsRecipients (MsgCod))
|
||||
|
@ -3706,10 +3709,10 @@ static void Msg_UnbanSender (void)
|
|||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||
|
||||
/***** Remove pair (sender's code - my code) from table of banned senders *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod=%ld AND ToUsrCod=%ld",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE_new ("can not ban sender");
|
||||
DB_QueryDELETE ("can not ban sender",
|
||||
"DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod=%ld AND ToUsrCod=%ld",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Show alert with the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -3739,10 +3742,10 @@ void Msg_RemoveUsrFromBanned (long UsrCod)
|
|||
{
|
||||
/***** Remove pair (sender's code - my code)
|
||||
from table of banned senders *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod=%ld OR ToUsrCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from table of banned users");
|
||||
DB_QueryDELETE ("can not remove user from table of banned users",
|
||||
"DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod=%ld OR ToUsrCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -409,13 +409,11 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
|||
Net_WebsAndSocialNetworksDB[Web],
|
||||
URL);
|
||||
else
|
||||
{
|
||||
/***** Remove web / social network *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_webs WHERE UsrCod=%ld AND Web='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Net_WebsAndSocialNetworksDB[Web]);
|
||||
DB_QueryDELETE_new ("can not remove user's web / social network");
|
||||
}
|
||||
DB_QueryDELETE ("can not remove user's web / social network",
|
||||
"DELETE FROM usr_webs WHERE UsrCod=%ld AND Web='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Net_WebsAndSocialNetworksDB[Web]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -308,10 +308,10 @@ void Not_RemoveNotice (void)
|
|||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/* Remove notice */
|
||||
DB_BuildQuery ("DELETE FROM notices"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove notice");
|
||||
DB_QueryDELETE ("can not remove notice",
|
||||
"DELETE FROM notices"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod);
|
||||
|
|
|
@ -1582,10 +1582,10 @@ void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Delete old notifications ******/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM notif"
|
||||
" WHERE TimeNotif<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_NOTIF);
|
||||
DB_QueryDELETE_new ("can not remove old notifications");
|
||||
DB_QueryDELETE ("can not remove old notifications",
|
||||
"DELETE LOW_PRIORITY FROM notif"
|
||||
" WHERE TimeNotif<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_NOTIF);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2135,7 +2135,7 @@ static unsigned Ntf_GetNumberOfMyNewUnseenNtfs (void)
|
|||
void Ntf_RemoveUsrNtfs (long ToUsrCod)
|
||||
{
|
||||
/***** Delete notifications of a user ******/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM notif WHERE ToUsrCod=%ld",
|
||||
ToUsrCod);
|
||||
DB_QueryDELETE_new ("can not remove notifications of a user");
|
||||
DB_QueryDELETE ("can not remove notifications of a user",
|
||||
"DELETE LOW_PRIORITY FROM notif WHERE ToUsrCod=%ld",
|
||||
ToUsrCod);
|
||||
}
|
||||
|
|
|
@ -513,10 +513,10 @@ void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD +
|
|||
Cry_EncryptSHA512Base64 (PlainPassword,Gbl.Usrs.Me.PendingPassword);
|
||||
|
||||
/***** Remove expired pending passwords from database *****/
|
||||
DB_BuildQuery ("DELETE FROM pending_passwd"
|
||||
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS);
|
||||
DB_QueryDELETE_new ("can not remove expired pending passwords");
|
||||
DB_QueryDELETE ("can not remove expired pending passwords",
|
||||
"DELETE FROM pending_passwd"
|
||||
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS);
|
||||
|
||||
/***** Update my current password in database *****/
|
||||
DB_QueryREPLACE ("can not create pending password",
|
||||
|
|
11
swad_photo.c
11
swad_photo.c
|
@ -1031,8 +1031,9 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
|||
|
||||
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
||||
{
|
||||
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");
|
||||
DB_QueryDELETE ("can not remove a user from the list of users without photo",
|
||||
"DELETE FROM clicks_without_photo WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1501,9 +1502,9 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
|
|||
|
||||
void Pho_RemoveObsoleteStatDegrees (void)
|
||||
{
|
||||
DB_BuildQuery ("DELETE FROM sta_degrees"
|
||||
" WHERE DegCod NOT IN (SELECT DegCod FROM degrees)");
|
||||
DB_QueryDELETE_new ("can not remove old degrees from stats");
|
||||
DB_QueryDELETE ("can not remove old degrees from stats",
|
||||
"DELETE FROM sta_degrees"
|
||||
" WHERE DegCod NOT IN (SELECT DegCod FROM degrees)");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -582,8 +582,9 @@ void Plc_RemovePlace (void)
|
|||
else // Place has no centres ==> remove it
|
||||
{
|
||||
/***** Remove place *****/
|
||||
DB_BuildQuery ("DELETE FROM places WHERE PlcCod=%ld",Plc.PlcCod);
|
||||
DB_QueryDELETE_new ("can not remove a place");
|
||||
DB_QueryDELETE ("can not remove a place",
|
||||
"DELETE FROM places WHERE PlcCod=%ld",
|
||||
Plc.PlcCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -496,8 +496,9 @@ void Plg_RemovePlugin (void)
|
|||
Plg_GetDataOfPluginByCod (&Plg);
|
||||
|
||||
/***** Remove plugin *****/
|
||||
DB_BuildQuery ("DELETE FROM plugins WHERE PlgCod=%ld",Plg.PlgCod);
|
||||
DB_QueryDELETE_new ("can not remove a plugin");
|
||||
DB_QueryDELETE ("can not remove a plugin",
|
||||
"DELETE FROM plugins WHERE PlgCod=%ld",
|
||||
Plg.PlgCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -218,10 +218,10 @@ void Pre_SetPrefsFromIP (void)
|
|||
void Pre_RemoveOldPrefsFromIP (void)
|
||||
{
|
||||
/***** Remove old preferences *****/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM IP_prefs"
|
||||
" WHERE LastChange<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_IP_PREFS);
|
||||
DB_QueryDELETE_new ("can not remove old preferences");
|
||||
DB_QueryDELETE ("can not remove old preferences",
|
||||
"DELETE LOW_PRIORITY FROM IP_prefs"
|
||||
" WHERE LastChange<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Cfg_TIME_TO_DELETE_IP_PREFS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1060,8 +1060,9 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
|
|||
void Prf_RemoveUsrFigures (long UsrCod)
|
||||
{
|
||||
/***** Remove user's figures *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_figures WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not delete user's figures");
|
||||
DB_QueryDELETE ("can not delete user's figures",
|
||||
"DELETE FROM usr_figures WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -2134,12 +2134,13 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
|||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||
{
|
||||
/***** Remove user from the table of project-users *****/
|
||||
DB_BuildQuery ("DELETE FROM prj_usr"
|
||||
" WHERE PrjCod=%ld AND RoleInProject=%u AND UsrCod=%ld",
|
||||
Prj.PrjCod,
|
||||
(unsigned) RoleInProject,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from a project");
|
||||
DB_QueryDELETE ("can not remove a user from a project",
|
||||
"DELETE FROM prj_usr"
|
||||
" WHERE PrjCod=%ld AND RoleInProject=%u"
|
||||
" AND UsrCod=%ld",
|
||||
Prj.PrjCod,
|
||||
(unsigned) RoleInProject,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Flush cache *****/
|
||||
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
@ -2740,20 +2741,20 @@ void Prj_RemoveProject (void)
|
|||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||
{
|
||||
/***** Remove users in project *****/
|
||||
DB_BuildQuery ("DELETE FROM prj_usr USING projects,prj_usr"
|
||||
" WHERE projects.PrjCod=%ld AND projects.CrsCod=%ld"
|
||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove project");
|
||||
DB_QueryDELETE ("can not remove project",
|
||||
"DELETE FROM prj_usr USING projects,prj_usr"
|
||||
" WHERE projects.PrjCod=%ld AND projects.CrsCod=%ld"
|
||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Flush cache *****/
|
||||
Prj_FlushCacheMyRoleInProject ();
|
||||
|
||||
/***** Remove project *****/
|
||||
DB_BuildQuery ("DELETE FROM projects"
|
||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove project");
|
||||
DB_QueryDELETE ("can not remove project",
|
||||
"DELETE FROM projects"
|
||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Remove information related to files in project *****/
|
||||
Brw_RemovePrjFilesFromDB (Prj.PrjCod);
|
||||
|
@ -3392,18 +3393,19 @@ static void Prj_UpdateProject (struct Project *Prj)
|
|||
void Prj_RemoveCrsProjects (long CrsCod)
|
||||
{
|
||||
/***** Remove users in projects of the course *****/
|
||||
DB_BuildQuery ("DELETE FROM prj_usr USING projects,prj_usr"
|
||||
" WHERE projects.CrsCod=%ld"
|
||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the projects of a course");
|
||||
DB_QueryDELETE ("can not remove all the projects of a course",
|
||||
"DELETE FROM prj_usr USING projects,prj_usr"
|
||||
" WHERE projects.CrsCod=%ld"
|
||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Flush cache *****/
|
||||
Prj_FlushCacheMyRoleInProject ();
|
||||
|
||||
/***** Remove projects *****/
|
||||
DB_BuildQuery ("DELETE FROM projects WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the projects of a course");
|
||||
DB_QueryDELETE ("can not remove all the projects of a course",
|
||||
"DELETE FROM projects WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3415,8 +3417,9 @@ void Prj_RemoveUsrFromProjects (long UsrCod)
|
|||
bool ItsMe;
|
||||
|
||||
/***** Remove user from projects *****/
|
||||
DB_BuildQuery ("DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from projects");
|
||||
DB_QueryDELETE ("can not remove user from projects",
|
||||
"DELETE FROM prj_usr WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/***** Flush cache *****/
|
||||
ItsMe = Usr_ItsMe (UsrCod);
|
||||
|
|
|
@ -693,14 +693,14 @@ void Rec_RemoveFieldFromDB (void)
|
|||
&Gbl.CurrentCrs.Records.Field.Visibility);
|
||||
|
||||
/***** Remove field from all records *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_records WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryDELETE_new ("can not remove field from all students' records");
|
||||
DB_QueryDELETE ("can not remove field from all students' records",
|
||||
"DELETE FROM crs_records WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
|
||||
/***** Remove the field *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryDELETE_new ("can not remove field of record");
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -2005,13 +2005,12 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
DB_QueryUPDATE_new ("can not update field of record");
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Remove text of the field of record course *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_records"
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
DB_QueryDELETE_new ("can not remove field of record");
|
||||
}
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_records"
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
UsrCod,
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
}
|
||||
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
||||
/***** Insert text field of record course *****/
|
||||
|
@ -2033,11 +2032,11 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
|
||||
{
|
||||
/***** Remove text of the field of record course *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_records"
|
||||
" WHERE UsrCod=%ld AND FieldCod IN"
|
||||
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
|
||||
UsrCod,Crs->CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove user's record in a course");
|
||||
DB_QueryDELETE ("can not remove user's record in a course",
|
||||
"DELETE FROM crs_records"
|
||||
" WHERE UsrCod=%ld AND FieldCod IN"
|
||||
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
|
||||
UsrCod,Crs->CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2047,8 +2046,9 @@ void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
|
|||
void Rec_RemoveFieldsCrsRecordAll (long UsrCod)
|
||||
{
|
||||
/***** Remove text of the field of record course *****/
|
||||
DB_BuildQuery ("DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's records in all courses");
|
||||
DB_QueryDELETE ("can not remove user's records in all courses",
|
||||
"DELETE FROM crs_records WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1436,6 +1436,7 @@ static void Rep_RemoveUsrReportsFiles (long UsrCod)
|
|||
static void Rep_RemoveUsrReportsFromDB (long UsrCod)
|
||||
{
|
||||
/***** Insert a new user's usage report into database *****/
|
||||
DB_BuildQuery ("DELETE FROM usr_report WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's usage reports");
|
||||
DB_QueryDELETE ("can not remove user's usage reports",
|
||||
"DELETE FROM usr_report WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
|
|
@ -216,8 +216,9 @@ void Ses_UpdateSessionLastRefreshInDB (void)
|
|||
static void Ses_RemoveSessionFromDB (void)
|
||||
{
|
||||
/***** Remove current session *****/
|
||||
DB_BuildQuery ("DELETE FROM sessions WHERE SessionId='%s'",Gbl.Session.Id);
|
||||
DB_QueryDELETE_new ("can not remove a session");
|
||||
DB_QueryDELETE ("can not remove a session",
|
||||
"DELETE FROM sessions WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
|
||||
/***** Clear old unused social timelines in database *****/
|
||||
// This is necessary to prevent the table growing and growing
|
||||
|
@ -235,15 +236,15 @@ void Ses_RemoveExpiredSessions (void)
|
|||
when last click (LastTime) is too old,
|
||||
or (when there was at least one refresh (navigator supports AJAX)
|
||||
and last refresh is too old (browser probably was closed)) */
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM sessions WHERE"
|
||||
" LastTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')"
|
||||
" OR "
|
||||
"(LastRefresh>LastTime+INTERVAL 1 SECOND"
|
||||
" AND"
|
||||
" LastRefresh<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu'))",
|
||||
Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_CLICK,
|
||||
Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_REFRESH);
|
||||
DB_QueryDELETE_new ("can not remove expired sessions");
|
||||
DB_QueryDELETE ("can not remove expired sessions",
|
||||
"DELETE LOW_PRIORITY FROM sessions WHERE"
|
||||
" LastTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')"
|
||||
" OR "
|
||||
"(LastRefresh>LastTime+INTERVAL 1 SECOND"
|
||||
" AND"
|
||||
" LastRefresh<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu'))",
|
||||
Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_CLICK,
|
||||
Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_REFRESH);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -365,12 +366,10 @@ void Ses_RemoveHiddenParFromThisSession (void)
|
|||
{
|
||||
if (Gbl.Session.IsOpen && // There is an open session
|
||||
!Gbl.HiddenParamsInsertedIntoDB) // No params just inserted
|
||||
{
|
||||
/***** Remove hidden parameters of this session *****/
|
||||
DB_BuildQuery ("DELETE FROM hidden_params WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
DB_QueryDELETE_new ("can not remove hidden parameters of current session");
|
||||
}
|
||||
DB_QueryDELETE ("can not remove hidden parameters of current session",
|
||||
"DELETE FROM hidden_params WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -380,9 +379,10 @@ void Ses_RemoveHiddenParFromThisSession (void)
|
|||
void Ses_RemoveHiddenParFromExpiredSessions (void)
|
||||
{
|
||||
/***** Remove hidden parameters from expired sessions *****/
|
||||
DB_BuildQuery ("DELETE FROM hidden_params"
|
||||
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
||||
DB_QueryDELETE_new ("can not remove hidden parameters of expired sessions");
|
||||
DB_QueryDELETE ("can not remove hidden parameters of expired sessions",
|
||||
"DELETE FROM hidden_params"
|
||||
" WHERE SessionId NOT IN"
|
||||
" (SELECT SessionId FROM sessions)");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
268
swad_social.c
268
swad_social.c
|
@ -3382,14 +3382,14 @@ static long Soc_UnshareSocialNote (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
||||
{
|
||||
/***** Delete social publishing from database *****/
|
||||
DB_BuildQuery ("DELETE FROM social_pubs"
|
||||
" WHERE NotCod=%ld"
|
||||
" AND PublisherCod=%ld"
|
||||
" AND PubType=%u",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Soc_PUB_SHARED_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove a social publishing");
|
||||
DB_QueryDELETE ("can not remove a social publishing",
|
||||
"DELETE FROM social_pubs"
|
||||
" WHERE NotCod=%ld"
|
||||
" AND PublisherCod=%ld"
|
||||
" AND PubType=%u",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Soc_PUB_SHARED_NOTE);
|
||||
|
||||
/***** Update number of times this social note is shared *****/
|
||||
SocNot.NumShared = Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
|
||||
|
@ -3470,11 +3470,11 @@ static long Soc_UnfavSocialNote (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note
|
||||
{
|
||||
/***** Delete the mark as favourite from database *****/
|
||||
DB_BuildQuery ("DELETE FROM social_notes_fav"
|
||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE_new ("can not unfavourite social note");
|
||||
DB_QueryDELETE ("can not unfavourite social note",
|
||||
"DELETE FROM social_notes_fav"
|
||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Update number of times this social note is favourited *****/
|
||||
SocNot.NumFavs = Soc_GetNumTimesANoteHasBeenFav (&SocNot);
|
||||
|
@ -3556,11 +3556,11 @@ static long Soc_UnfavSocialComment (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the comment
|
||||
{
|
||||
/***** Delete the mark as favourite from database *****/
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav"
|
||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||
SocCom.PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE_new ("can not unfavourite social comment");
|
||||
DB_QueryDELETE ("can not unfavourite social comment",
|
||||
"DELETE FROM social_comments_fav"
|
||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||
SocCom.PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Update number of times this social comment is favourited *****/
|
||||
SocCom.NumFavs = Soc_GetNumTimesACommHasBeenFav (&SocCom);
|
||||
|
@ -3816,47 +3816,46 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
|||
|
||||
/***** Remove favs *****/
|
||||
/* Remove favs for all comments in this note */
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav"
|
||||
" USING social_pubs,social_comments_fav"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove favs for social note");
|
||||
DB_QueryDELETE ("can not remove favs for social note",
|
||||
"DELETE FROM social_comments_fav"
|
||||
" USING social_pubs,social_comments_fav"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/* Remove favs for this note */
|
||||
DB_BuildQuery ("DELETE FROM social_notes_fav WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
DB_QueryDELETE_new ("can not remove favs for social note");
|
||||
DB_QueryDELETE ("can not remove favs for social note",
|
||||
"DELETE FROM social_notes_fav WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
|
||||
/***** Remove content of the comments of this social note *****/
|
||||
DB_BuildQuery ("DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove social comments");
|
||||
DB_QueryDELETE ("can not remove social comments",
|
||||
"DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/***** Remove all the social publishings of this note *****/
|
||||
DB_BuildQuery ("DELETE FROM social_pubs WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
DB_QueryDELETE_new ("can not remove a social publishing");
|
||||
DB_QueryDELETE ("can not remove a social publishing",
|
||||
"DELETE FROM social_pubs WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
|
||||
/***** Remove social note *****/
|
||||
DB_BuildQuery ("DELETE FROM social_notes"
|
||||
" WHERE NotCod=%ld"
|
||||
" AND UsrCod=%ld", // Extra check: I am the author
|
||||
SocNot->NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a social note");
|
||||
DB_QueryDELETE ("can not remove a social note",
|
||||
"DELETE FROM social_notes"
|
||||
" WHERE NotCod=%ld"
|
||||
" AND UsrCod=%ld", // Extra check: I am the author
|
||||
SocNot->NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (SocNot->NoteType == Soc_NOTE_SOCIAL_POST)
|
||||
{
|
||||
/***** Remove social post *****/
|
||||
DB_BuildQuery ("DELETE FROM social_posts WHERE PstCod=%ld",SocNot->Cod);
|
||||
DB_QueryDELETE_new ("can not remove a social post");
|
||||
}
|
||||
DB_QueryDELETE ("can not remove a social post",
|
||||
"DELETE FROM social_posts WHERE PstCod=%ld",
|
||||
SocNot->Cod);
|
||||
|
||||
/***** Reset social note *****/
|
||||
Soc_ResetSocialNote (SocNot);
|
||||
|
@ -4118,24 +4117,24 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom)
|
|||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_MENTION,SocCom->PubCod);
|
||||
|
||||
/***** Remove favs for this comment *****/
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
DB_QueryDELETE_new ("can not remove favs for social comment");
|
||||
DB_QueryDELETE ("can not remove favs for social comment",
|
||||
"DELETE FROM social_comments_fav WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
|
||||
/***** Remove content of this social comment *****/
|
||||
DB_BuildQuery ("DELETE FROM social_comments WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
DB_QueryDELETE_new ("can not remove a social comment");
|
||||
DB_QueryDELETE ("can not remove a social comment",
|
||||
"DELETE FROM social_comments WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
|
||||
/***** Remove this social comment *****/
|
||||
DB_BuildQuery ("DELETE FROM social_pubs"
|
||||
" WHERE PubCod=%ld"
|
||||
" AND PublisherCod=%ld" // Extra check: I am the author
|
||||
" AND PubType=%u", // Extra check: it's a comment
|
||||
SocCom->PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove a social comment");
|
||||
DB_QueryDELETE ("can not remove a social comment",
|
||||
"DELETE FROM social_pubs"
|
||||
" WHERE PubCod=%ld"
|
||||
" AND PublisherCod=%ld" // Extra check: I am the author
|
||||
" AND PubType=%u", // Extra check: it's a comment
|
||||
SocCom->PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/***** Reset social comment *****/
|
||||
Soc_ResetSocialComment (SocCom);
|
||||
|
@ -4149,96 +4148,97 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
{
|
||||
/***** Remove favs for comments *****/
|
||||
/* Remove all favs made by this user in any social comment */
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove favs");
|
||||
DB_QueryDELETE ("can not remove favs",
|
||||
"DELETE FROM social_comments_fav WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/* Remove all favs for all comments of this user */
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav"
|
||||
" USING social_pubs,social_comments_fav"
|
||||
" WHERE social_pubs.PublisherCod=%ld" // Author of the comment
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove favs");
|
||||
DB_QueryDELETE ("can not remove favs",
|
||||
"DELETE FROM social_comments_fav"
|
||||
" USING social_pubs,social_comments_fav"
|
||||
" WHERE social_pubs.PublisherCod=%ld" // Author of the comment
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/* Remove all favs for all comments in all the social notes of the user */
|
||||
DB_BuildQuery ("DELETE FROM social_comments_fav"
|
||||
" USING social_notes,social_pubs,social_comments_fav"
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove social comments");
|
||||
DB_QueryDELETE ("can not remove social comments",
|
||||
"DELETE FROM social_comments_fav"
|
||||
" USING social_notes,social_pubs,social_comments_fav"
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/***** Remove favs for notes *****/
|
||||
/* Remove all favs made by this user in any social note */
|
||||
DB_BuildQuery ("DELETE FROM social_notes_fav WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove favs");
|
||||
DB_QueryDELETE ("can not remove favs",
|
||||
"DELETE FROM social_notes_fav WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/* Remove all favs for all notes of this user */
|
||||
DB_BuildQuery ("DELETE FROM social_notes_fav"
|
||||
" USING social_notes,social_notes_fav"
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_notes_fav.NotCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove favs");
|
||||
DB_QueryDELETE ("can not remove favs",
|
||||
"DELETE FROM social_notes_fav"
|
||||
" USING social_notes,social_notes_fav"
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_notes_fav.NotCod",
|
||||
UsrCod);
|
||||
|
||||
/***** Remove social comments *****/
|
||||
/* Remove content of all the comments in all the social notes of the user */
|
||||
DB_BuildQuery ("DELETE FROM social_comments"
|
||||
" USING social_notes,social_pubs,social_comments"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove social comments");
|
||||
DB_QueryDELETE ("can not remove social comments",
|
||||
"DELETE FROM social_comments"
|
||||
" USING social_notes,social_pubs,social_comments"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/* Remove all the comments from any user in any social note of the user */
|
||||
DB_BuildQuery ("DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove social comments");
|
||||
DB_QueryDELETE ("can not remove social comments",
|
||||
"DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType=%u",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/* Remove content of all the comments of the user in any social note */
|
||||
DB_BuildQuery ("DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.PublisherCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE_new ("can not remove social comments");
|
||||
DB_QueryDELETE ("can not remove social comments",
|
||||
"DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.PublisherCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/***** Remove all the social posts of the user *****/
|
||||
DB_BuildQuery ("DELETE FROM social_posts"
|
||||
" WHERE PstCod IN"
|
||||
" (SELECT Cod FROM social_notes"
|
||||
" WHERE UsrCod=%ld AND NoteType=%u)",
|
||||
UsrCod,(unsigned) Soc_NOTE_SOCIAL_POST);
|
||||
DB_QueryDELETE_new ("can not remove social posts");
|
||||
DB_QueryDELETE ("can not remove social posts",
|
||||
"DELETE FROM social_posts"
|
||||
" WHERE PstCod IN"
|
||||
" (SELECT Cod FROM social_notes"
|
||||
" WHERE UsrCod=%ld AND NoteType=%u)",
|
||||
UsrCod,(unsigned) Soc_NOTE_SOCIAL_POST);
|
||||
|
||||
/***** Remove all the social publishings of any user authored by the user *****/
|
||||
DB_BuildQuery ("DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove social publishings");
|
||||
DB_QueryDELETE ("can not remove social publishings",
|
||||
"DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod",
|
||||
UsrCod);
|
||||
|
||||
/***** Remove all the social publishings of the user *****/
|
||||
DB_BuildQuery ("DELETE FROM social_pubs WHERE PublisherCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove social publishings");
|
||||
DB_QueryDELETE ("can not remove social publishings",
|
||||
"DELETE FROM social_pubs WHERE PublisherCod=%ld",
|
||||
UsrCod);
|
||||
|
||||
/***** Remove all the social notes of the user *****/
|
||||
DB_BuildQuery ("DELETE FROM social_notes WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove social notes");
|
||||
DB_QueryDELETE ("can not remove social notes",
|
||||
"DELETE FROM social_notes WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4736,9 +4736,9 @@ static void Soc_ResetSocialComment (struct SocialComment *SocCom)
|
|||
void Soc_ClearOldTimelinesDB (void)
|
||||
{
|
||||
/***** Remove social timelines for expired sessions *****/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM social_timelines"
|
||||
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
||||
DB_QueryDELETE_new ("can not remove old social timelines");
|
||||
DB_QueryDELETE ("can not remove old social timelines",
|
||||
"DELETE LOW_PRIORITY FROM social_timelines"
|
||||
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4748,9 +4748,9 @@ void Soc_ClearOldTimelinesDB (void)
|
|||
static void Soc_ClearTimelineThisSession (void)
|
||||
{
|
||||
/***** Remove social timeline for this session *****/
|
||||
DB_BuildQuery ("DELETE FROM social_timelines WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
DB_QueryDELETE_new ("can not remove social timeline");
|
||||
DB_QueryDELETE ("can not remove social timeline",
|
||||
"DELETE FROM social_timelines WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -404,10 +404,10 @@ void Sta_LogAccess (const char *Comments)
|
|||
void Sta_RemoveOldEntriesRecentLog (void)
|
||||
{
|
||||
/***** Remove all expired clipboards *****/
|
||||
DB_BuildQuery ("DELETE LOW_PRIORITY FROM log_recent"
|
||||
" WHERE ClickTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Sta_SECONDS_IN_RECENT_LOG);
|
||||
DB_QueryDELETE_new ("can not remove old entries from recent log");
|
||||
DB_QueryDELETE ("can not remove old entries from recent log",
|
||||
"DELETE LOW_PRIORITY FROM log_recent"
|
||||
" WHERE ClickTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
Sta_SECONDS_IN_RECENT_LOG);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue