mirror of https://github.com/acanas/swad-core.git
Version 16.163
This commit is contained in:
parent
eddc7e7849
commit
4cb29c68e7
10
swad_ID.c
10
swad_ID.c
|
@ -102,7 +102,7 @@ void ID_GetListIDsFromUsrCod (struct UsrData *UsrDat)
|
|||
// First the confirmed (Confirmed == 'Y')
|
||||
// Then the unconfirmed (Confirmed == 'N')
|
||||
sprintf (Query,"SELECT UsrID,Confirmed FROM usr_IDs"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY Confirmed DESC,UsrID",
|
||||
UsrDat->UsrCod);
|
||||
if ((NumIDs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get user's IDs")))
|
||||
|
@ -766,7 +766,7 @@ static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID)
|
|||
|
||||
/***** Get if ID is confirmed from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_IDs"
|
||||
" WHERE UsrCod='%ld' AND UsrID='%s' AND Confirmed='Y'",
|
||||
" WHERE UsrCod=%ld AND UsrID='%s' AND Confirmed='Y'",
|
||||
UsrCod,UsrID);
|
||||
return (DB_QueryCOUNT (Query,"can not check if ID is confirmed") != 0);
|
||||
}
|
||||
|
@ -781,7 +781,7 @@ static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
|
|||
|
||||
/***** Remove one of my user's IDs *****/
|
||||
sprintf (Query,"DELETE FROM usr_IDs"
|
||||
" WHERE UsrCod='%ld' AND UsrID='%s'",
|
||||
" WHERE UsrCod=%ld AND UsrID='%s'",
|
||||
UsrCod,UsrID);
|
||||
DB_QueryREPLACE (Query,"can not remove a user's ID");
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed
|
|||
sprintf (Query,"INSERT INTO usr_IDs"
|
||||
" (UsrCod,UsrID,CreatTime,Confirmed)"
|
||||
" VALUES"
|
||||
" ('%ld','%s',NOW(),'%c')",
|
||||
" (%ld,'%s',NOW(),'%c')",
|
||||
UsrCod,NewID,
|
||||
Confirmed ? 'Y' :
|
||||
'N');
|
||||
|
@ -1046,7 +1046,7 @@ void ID_ConfirmUsrID (const struct UsrData *UsrDat,const char *UsrID)
|
|||
|
||||
/***** Update database *****/
|
||||
sprintf (Query,"UPDATE usr_IDs SET Confirmed='Y'"
|
||||
" WHERE UsrCod='%ld' AND UsrID='%s' AND Confirmed<>'Y'",
|
||||
" WHERE UsrCod=%ld AND UsrID='%s' AND Confirmed<>'Y'",
|
||||
UsrDat->UsrCod,UsrID);
|
||||
DB_QueryINSERT (Query,"can not confirm a user's ID");
|
||||
}
|
||||
|
|
10
swad_MFU.c
10
swad_MFU.c
|
@ -107,7 +107,7 @@ void MFU_GetMFUActions (struct MFU_ListMFUActions *ListMFUActions,unsigned MaxAc
|
|||
|
||||
/***** Get most frequently used actions *****/
|
||||
sprintf (Query,"SELECT ActCod FROM actions_MFU"
|
||||
" WHERE UsrCod='%ld' ORDER BY Score DESC,LastClick DESC",
|
||||
" WHERE UsrCod=%ld ORDER BY Score DESC,LastClick DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get most frequently used actions");
|
||||
|
||||
|
@ -153,7 +153,7 @@ Act_Action_t MFU_GetMyLastActionInCurrentTab (void)
|
|||
{
|
||||
/***** Get my most frequently used actions *****/
|
||||
sprintf (Query,"SELECT ActCod FROM actions_MFU"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY LastClick DESC,Score DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumActions = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get most frequently used actions");
|
||||
|
@ -356,7 +356,7 @@ void MFU_UpdateMFUActions (void)
|
|||
|
||||
/***** Get current score *****/
|
||||
sprintf (Query,"SELECT Score FROM actions_MFU"
|
||||
" WHERE UsrCod='%ld' AND ActCod='%ld'",
|
||||
" WHERE UsrCod=%ld AND ActCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get score for current action"))
|
||||
|
@ -378,7 +378,7 @@ void MFU_UpdateMFUActions (void)
|
|||
sprintf (Query,"REPLACE INTO actions_MFU"
|
||||
" (UsrCod,ActCod,Score,LastClick)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%f',NOW())",
|
||||
" (%ld,%ld,'%f',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod,
|
||||
Score);
|
||||
|
@ -386,7 +386,7 @@ void MFU_UpdateMFUActions (void)
|
|||
|
||||
/***** Update score for other actions *****/
|
||||
sprintf (Query,"UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
|
||||
" WHERE UsrCod='%ld' AND ActCod<>'%ld'",
|
||||
" WHERE UsrCod=%ld AND ActCod<>%ld",
|
||||
MFU_DECREASE_FACTOR,MFU_MIN_SCORE,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod);
|
||||
|
|
|
@ -157,7 +157,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
|||
/***** Get active notices in course *****/
|
||||
sprintf (Query,"SELECT NotCod,UNIX_TIMESTAMP(CreatTime) AS T,UsrCod,Content"
|
||||
" FROM notices"
|
||||
" WHERE CrsCod='%ld' AND Status='%u'"
|
||||
" WHERE CrsCod=%ld AND Status=%u"
|
||||
" ORDER BY T DESC",
|
||||
Crs->CrsCod,(unsigned) Not_ACTIVE_NOTICE);
|
||||
NumNotices = DB_QuerySELECT (Query,&mysql_res,"can not get notices from database");
|
||||
|
@ -256,7 +256,7 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
|
|||
sprintf (Query,"SELECT ExaCod,UNIX_TIMESTAMP(CallDate) AS T,"
|
||||
"DATE_FORMAT(ExamDate,'%%d/%%m/%%Y %%H:%%i')"
|
||||
" FROM exam_announcements"
|
||||
" WHERE CrsCod='%ld' AND Status='%u' AND ExamDate>=NOW()"
|
||||
" WHERE CrsCod=%ld AND Status=%u AND ExamDate>=NOW()"
|
||||
" ORDER BY T",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT);
|
||||
|
|
|
@ -628,7 +628,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
|
|||
/* Check if the new nickname
|
||||
matches any of the nicknames of other users */
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||
" WHERE Nickname='%s' AND UsrCod<>'%ld'",
|
||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that this nickname
|
||||
{
|
||||
|
@ -725,10 +725,10 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
|
|||
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
|
||||
" VALUES"
|
||||
" ('%s','%s','%s','%s','%s','%s',"
|
||||
"'%s','%s','%s','%u','%s','%s',"
|
||||
"'%ld',"
|
||||
"'%s','%s','%s',%u,'%s','%s',"
|
||||
"%ld,"
|
||||
"'%s','%s','%s','%s','%s',%s,'%s',"
|
||||
"'%u','%u','-1','0')",
|
||||
"%u,%u,-1,0)",
|
||||
UsrDat->EncryptedUsrCod,
|
||||
UsrDat->Password,
|
||||
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
|
||||
|
@ -759,7 +759,7 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
|
|||
sprintf (Query,"INSERT INTO usr_IDs"
|
||||
" (UsrCod,UsrID,CreatTime,Confirmed)"
|
||||
" VALUES"
|
||||
" ('%ld','%s',NOW(),'%c')",
|
||||
" (%ld,'%s',NOW(),'%c')",
|
||||
UsrDat->UsrCod,
|
||||
UsrDat->IDs.List[NumID].ID,
|
||||
UsrDat->IDs.List[NumID].Confirmed ? 'Y' :
|
||||
|
@ -982,7 +982,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Grp_RemUsrFromAllGrps (UsrDat,QuietOrVerbose);
|
||||
|
||||
/***** Remove user's requests for inscription *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr_requests WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_usr_requests WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's requests for inscription");
|
||||
|
||||
|
@ -990,7 +990,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Dup_RemoveUsrFromDuplicated (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from the table of courses and users *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from all courses");
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/***** Remove user as administrator of any degree *****/
|
||||
sprintf (Query,"DELETE FROM admin WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM admin WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user as administrator");
|
||||
|
||||
|
@ -1055,12 +1055,12 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Ann_RemoveUsrFromSeenAnnouncements (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from table of connected users *****/
|
||||
sprintf (Query,"DELETE FROM connected WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM connected WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from table of connected users");
|
||||
|
||||
/***** Remove all sessions of this user *****/
|
||||
sprintf (Query,"DELETE FROM sessions WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM sessions WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove sessions of a user");
|
||||
|
||||
|
@ -1123,36 +1123,36 @@ static void Acc_RemoveUsr (struct UsrData *UsrDat)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove user's webs / social networks *****/
|
||||
sprintf (Query,"DELETE FROM usr_webs WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_webs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's webs / social networks");
|
||||
|
||||
/***** Remove user's nicknames *****/
|
||||
sprintf (Query,"DELETE FROM usr_nicknames WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_nicknames WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's nicknames");
|
||||
|
||||
/***** Remove user's emails *****/
|
||||
sprintf (Query,"DELETE FROM pending_emails WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM pending_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove pending user's emails");
|
||||
|
||||
sprintf (Query,"DELETE FROM usr_emails WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's emails");
|
||||
|
||||
/***** Remove user's IDs *****/
|
||||
sprintf (Query,"DELETE FROM usr_IDs WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_IDs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's IDs");
|
||||
|
||||
/***** Remove user's last data *****/
|
||||
sprintf (Query,"DELETE FROM usr_last WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_last WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's last data");
|
||||
|
||||
/***** Remove user's data *****/
|
||||
sprintf (Query,"DELETE FROM usr_data WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's data");
|
||||
}
|
||||
|
|
|
@ -4703,7 +4703,7 @@ char *Act_GetActionTextFromDB (long ActCod,
|
|||
|
||||
/***** Get test for an action from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM actions"
|
||||
" WHERE ActCod='%ld' AND Language='%s'",
|
||||
" WHERE ActCod=%ld AND Language='%s'",
|
||||
ActCod,Txt_STR_LANG_ID[Txt_LANGUAGE_ES]); // !!! TODO: Replace Txt_LANGUAGE_ES by Gbl.Prefs.Language !!!
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get text for an action"))
|
||||
{
|
||||
|
|
|
@ -1023,7 +1023,7 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
|
|||
DoQuery = false; // Nothing to get from database
|
||||
else
|
||||
{
|
||||
sprintf (UsrSubQuery,"UsrCod='%ld'",Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
sprintf (UsrSubQuery,"UsrCod=%ld",Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (AgendaType == Agd_MY_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
|
@ -1078,7 +1078,7 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
|
|||
break;
|
||||
case Agd_ANOTHER_AGENDA_TODAY:
|
||||
case Agd_ANOTHER_AGENDA:
|
||||
sprintf (UsrSubQuery,"UsrCod='%ld'",Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
sprintf (UsrSubQuery,"UsrCod=%ld",Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
if (AgendaType == Agd_ANOTHER_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
|
@ -1173,7 +1173,7 @@ static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent)
|
|||
"NOW()<StartTime," // Future event?
|
||||
"Event,Location"
|
||||
" FROM agendas"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,AgdEvent->UsrCod);
|
||||
|
||||
/***** Get data of event from database *****/
|
||||
|
@ -1267,7 +1267,7 @@ static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,
|
|||
|
||||
/***** Get text of event from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM agendas"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,AgdEvent->UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get event text");
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ void Agd_RemoveEvent (void)
|
|||
|
||||
/***** Remove event *****/
|
||||
sprintf (Query,"DELETE FROM agendas"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove event");
|
||||
|
||||
|
@ -1388,7 +1388,7 @@ void Agd_HideEvent (void)
|
|||
|
||||
/***** Set event private *****/
|
||||
sprintf (Query,"UPDATE agendas SET Hidden='Y'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not hide event");
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ void Agd_UnhideEvent (void)
|
|||
|
||||
/***** Set event public *****/
|
||||
sprintf (Query,"UPDATE agendas SET Hidden='N'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not show event");
|
||||
|
||||
|
@ -1453,7 +1453,7 @@ void Agd_MakeEventPrivate (void)
|
|||
|
||||
/***** Make event private *****/
|
||||
sprintf (Query,"UPDATE agendas SET Public='N'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not make event private");
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ void Agd_MakeEventPublic (void)
|
|||
|
||||
/***** Make event public *****/
|
||||
sprintf (Query,"UPDATE agendas SET Public='Y'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not make event public");
|
||||
|
||||
|
@ -1726,7 +1726,7 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
sprintf (Query,"INSERT INTO agendas"
|
||||
" (UsrCod,StartTime,EndTime,Event,Location,Txt)"
|
||||
" VALUES"
|
||||
" ('%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||
"'%s','%s','%s')",
|
||||
AgdEvent->UsrCod,
|
||||
AgdEvent->TimeUTC[Agd_START_TIME],
|
||||
|
@ -1750,10 +1750,10 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
|
||||
/***** Update the data of the event *****/
|
||||
sprintf (Query,"UPDATE agendas SET "
|
||||
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',Location='%s',Txt='%s'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent->TimeUTC[Agd_START_TIME],
|
||||
AgdEvent->TimeUTC[Agd_END_TIME ],
|
||||
AgdEvent->Event,AgdEvent->Location,Txt,
|
||||
|
@ -1770,7 +1770,7 @@ void Agd_RemoveUsrEvents (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove events *****/
|
||||
sprintf (Query,"DELETE FROM agendas WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM agendas WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the events of a user");
|
||||
}
|
||||
|
||||
|
@ -1783,7 +1783,7 @@ unsigned Agd_GetNumEventsFromUsr (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of events in a course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM agendas WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM agendas WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of events from user");
|
||||
}
|
||||
|
@ -1806,12 +1806,12 @@ unsigned Agd_GetNumUsrsWithEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM agendas"
|
||||
" WHERE UsrCod>'0'");
|
||||
" WHERE UsrCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,agendas"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -1823,7 +1823,7 @@ unsigned Agd_GetNumUsrsWithEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,agendas"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
|
@ -1834,7 +1834,7 @@ unsigned Agd_GetNumUsrsWithEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,agendas"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -1844,7 +1844,7 @@ unsigned Agd_GetNumUsrsWithEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM courses,crs_usr,agendas"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=agendas.UsrCod",
|
||||
|
@ -1853,7 +1853,7 @@ unsigned Agd_GetNumUsrsWithEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM crs_usr,agendas"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=agendas.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -1892,12 +1892,12 @@ unsigned Agd_GetNumEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM agendas"
|
||||
" WHERE UsrCod>'0'");
|
||||
" WHERE UsrCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,agendas"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -1908,7 +1908,7 @@ unsigned Agd_GetNumEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,crs_usr,agendas"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -1918,7 +1918,7 @@ unsigned Agd_GetNumEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM degrees,courses,crs_usr,agendas"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=agendas.UsrCod",
|
||||
|
@ -1927,7 +1927,7 @@ unsigned Agd_GetNumEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM courses,crs_usr,agendas"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=agendas.UsrCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -1935,7 +1935,7 @@ unsigned Agd_GetNumEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM crs_usr,agendas"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=agendas.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
|
|
@ -112,7 +112,7 @@ void Ann_ShowAllAnnouncements (void)
|
|||
/* Select only active announcements for unknown users */
|
||||
sprintf (Query,"SELECT AnnCod,Status,Roles,Subject,Content"
|
||||
" FROM announcements"
|
||||
" WHERE Status='%u' AND (Roles&%u)<>0 "
|
||||
" WHERE Status=%u AND (Roles&%u)<>0 "
|
||||
" ORDER BY AnnCod DESC",
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,
|
||||
(unsigned) (1 << Rol_UNKNOWN));
|
||||
|
@ -218,9 +218,9 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
|
|||
/***** Select announcements not seen *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
sprintf (Query,"SELECT AnnCod,Subject,Content FROM announcements"
|
||||
" WHERE Status='%u' AND (Roles&%u)<>0 "
|
||||
" WHERE Status=%u AND (Roles&%u)<>0 "
|
||||
" AND AnnCod NOT IN"
|
||||
" (SELECT AnnCod FROM ann_seen WHERE UsrCod='%ld')"
|
||||
" (SELECT AnnCod FROM ann_seen WHERE UsrCod=%ld)"
|
||||
" ORDER BY AnnCod DESC", // Newest first
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,
|
||||
(unsigned) Gbl.Usrs.Me.UsrDat.Roles, // All my roles in different courses
|
||||
|
@ -515,7 +515,7 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
|
|||
sprintf (Query,"INSERT INTO announcements"
|
||||
" (Roles,Subject,Content)"
|
||||
" VALUES"
|
||||
" ('%u','%s','%s')",
|
||||
" (%u,'%s','%s')",
|
||||
Roles,Subject,Content);
|
||||
DB_QueryINSERT (Query,"can not create announcement");
|
||||
}
|
||||
|
@ -533,8 +533,8 @@ void Ann_HideActiveAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Set global announcement as hidden *****/
|
||||
sprintf (Query,"UPDATE announcements SET Status='%u'"
|
||||
" WHERE AnnCod='%ld'",
|
||||
sprintf (Query,"UPDATE announcements SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod);
|
||||
DB_QueryUPDATE (Query,"can not hide announcement");
|
||||
}
|
||||
|
@ -552,8 +552,8 @@ void Ann_RevealHiddenAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Set global announcement as shown *****/
|
||||
sprintf (Query,"UPDATE announcements SET Status='%u'"
|
||||
" WHERE AnnCod='%ld'",
|
||||
sprintf (Query,"UPDATE announcements SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod);
|
||||
DB_QueryUPDATE (Query,"can not reveal announcement");
|
||||
}
|
||||
|
@ -572,12 +572,12 @@ void Ann_RemoveAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Remove announcement *****/
|
||||
sprintf (Query,"DELETE FROM announcements WHERE AnnCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM announcements WHERE AnnCod=%ld",
|
||||
AnnCod);
|
||||
DB_QueryDELETE (Query,"can not remove announcement");
|
||||
|
||||
/***** Remove users who have seen the announcement *****/
|
||||
sprintf (Query,"DELETE FROM ann_seen WHERE AnnCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM ann_seen WHERE AnnCod=%ld",
|
||||
AnnCod);
|
||||
DB_QueryDELETE (Query,"can not remove announcement");
|
||||
|
||||
|
@ -604,7 +604,7 @@ void Ann_MarkAnnouncementAsSeen (void)
|
|||
sprintf (Query,"REPLACE INTO ann_seen"
|
||||
" (AnnCod,UsrCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
AnnCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not mark announcement as seen");
|
||||
|
||||
|
@ -621,7 +621,7 @@ void Ann_RemoveUsrFromSeenAnnouncements (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove user from seen announcements *****/
|
||||
sprintf (Query,"DELETE FROM ann_seen WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM ann_seen WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from seen announcements");
|
||||
}
|
||||
|
|
|
@ -596,10 +596,10 @@ void Asg_GetListAssignments (void)
|
|||
if (Gbl.CurrentCrs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS)
|
||||
sprintf (Query,"SELECT AsgCod"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod='%ld'%s"
|
||||
" WHERE CrsCod=%ld%s"
|
||||
" AND (AsgCod NOT IN (SELECT AsgCod FROM asg_grp) OR"
|
||||
" AsgCod IN (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld' AND asg_grp.GrpCod=crs_grp_usr.GrpCod))"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld AND asg_grp.GrpCod=crs_grp_usr.GrpCod))"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
HiddenSubQuery,
|
||||
|
@ -608,7 +608,7 @@ void Asg_GetListAssignments (void)
|
|||
else // Gbl.CurrentCrs.Grps.WhichGrps == Grp_ALL_GROUPS
|
||||
sprintf (Query,"SELECT AsgCod"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod='%ld'%s"
|
||||
" WHERE CrsCod=%ld%s"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,OrderBySubQuery);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignments");
|
||||
|
@ -658,7 +658,7 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
|
|||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"Title,Folder"
|
||||
" FROM assignments"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Get data of assignment *****/
|
||||
|
@ -689,7 +689,7 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
|
|||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"Title,Folder"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod='%ld' AND Folder='%s'",
|
||||
" WHERE CrsCod=%ld AND Folder='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Asg->Folder);
|
||||
|
||||
/***** Get data of assignment *****/
|
||||
|
@ -805,7 +805,7 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT
|
|||
|
||||
/***** Get text of assignment from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM assignments"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment text");
|
||||
|
||||
|
@ -844,7 +844,7 @@ void Asg_GetNotifAssignment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT Title,Txt FROM assignments WHERE AsgCod='%ld'",
|
||||
sprintf (Query,"SELECT Title,Txt FROM assignments WHERE AsgCod=%ld",
|
||||
AsgCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
|
@ -958,7 +958,7 @@ void Asg_RemoveAssignment (void)
|
|||
|
||||
/***** Remove assignment *****/
|
||||
sprintf (Query,"DELETE FROM assignments"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove assignment");
|
||||
|
||||
|
@ -993,7 +993,7 @@ void Asg_HideAssignment (void)
|
|||
|
||||
/***** Hide assignment *****/
|
||||
sprintf (Query,"UPDATE assignments SET Hidden='Y'"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not hide assignment");
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ void Asg_ShowAssignment (void)
|
|||
|
||||
/***** Hide assignment *****/
|
||||
sprintf (Query,"UPDATE assignments SET Hidden='N'"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not show assignment");
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ static bool Asg_CheckIfSimilarAssignmentExists (const char *Field,const char *Va
|
|||
|
||||
/***** Get number of assignments with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM assignments"
|
||||
" WHERE CrsCod='%ld' AND %s='%s' AND AsgCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND %s='%s' AND AsgCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Field,Value,AsgCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get similar assignments") != 0);
|
||||
}
|
||||
|
@ -1406,8 +1406,8 @@ static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigne
|
|||
char Query[512];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE assignments SET NumNotif=NumNotif+'%u'"
|
||||
" WHERE AsgCod='%ld'",
|
||||
sprintf (Query,"UPDATE assignments SET NumNotif=NumNotif+%u"
|
||||
" WHERE AsgCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,AsgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of notifications of an assignment");
|
||||
}
|
||||
|
@ -1426,7 +1426,7 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
|
|||
sprintf (Query,"INSERT INTO assignments"
|
||||
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
" (%ld,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||
"'%s','%s','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -1454,10 +1454,10 @@ static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
|||
|
||||
/***** Update the data of the assignment *****/
|
||||
sprintf (Query,"UPDATE assignments SET "
|
||||
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',Folder='%s',Txt='%s'"
|
||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg->TimeUTC[Dat_START_TIME],
|
||||
Asg->TimeUTC[Dat_END_TIME ],
|
||||
Asg->Title,
|
||||
|
@ -1484,7 +1484,7 @@ static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Get if an assignment is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM asg_grp WHERE AsgCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM asg_grp WHERE AsgCod=%ld",
|
||||
AsgCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if an assignment is associated to groups") != 0);
|
||||
}
|
||||
|
@ -1499,7 +1499,7 @@ bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod)
|
|||
|
||||
/***** Get if an assignment is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM asg_grp"
|
||||
" WHERE AsgCod='%ld' AND GrpCod='%ld'",
|
||||
" WHERE AsgCod=%ld AND GrpCod=%ld",
|
||||
AsgCod,GrpCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if an assignment is associated to a group") != 0);
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Remove groups of the assignment *****/
|
||||
sprintf (Query,"DELETE FROM asg_grp WHERE AsgCod='%ld'",AsgCod);
|
||||
sprintf (Query,"DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod);
|
||||
DB_QueryDELETE (Query,"can not remove the groups associated to an assignment");
|
||||
}
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ void Asg_RemoveGroup (long GrpCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Remove group from all the assignments *****/
|
||||
sprintf (Query,"DELETE FROM asg_grp WHERE GrpCod='%ld'",GrpCod);
|
||||
sprintf (Query,"DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove group from the associations between assignments and groups");
|
||||
}
|
||||
|
||||
|
@ -1540,7 +1540,7 @@ void Asg_RemoveGroupsOfType (long GrpTypCod)
|
|||
|
||||
/***** Remove group from all the assignments *****/
|
||||
sprintf (Query,"DELETE FROM asg_grp USING crs_grp,asg_grp"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=asg_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove groups of a type from the associations between assignments and groups");
|
||||
|
@ -1564,7 +1564,7 @@ static void Asg_CreateGrps (long AsgCod)
|
|||
sprintf (Query,"INSERT INTO asg_grp"
|
||||
" (AsgCod,GrpCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||
DB_QueryINSERT (Query,"can not associate a group to an assignment");
|
||||
}
|
||||
|
@ -1589,7 +1589,7 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg)
|
|||
/***** Get groups associated to an assignment from database *****/
|
||||
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
|
||||
" FROM asg_grp,crs_grp,crs_grp_types"
|
||||
" WHERE asg_grp.AsgCod='%ld'"
|
||||
" WHERE asg_grp.AsgCod=%ld"
|
||||
" AND asg_grp.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
|
@ -1647,13 +1647,13 @@ void Asg_RemoveCrsAssignments (long CrsCod)
|
|||
|
||||
/***** Remove groups *****/
|
||||
sprintf (Query,"DELETE FROM asg_grp USING assignments,asg_grp"
|
||||
" WHERE assignments.CrsCod='%ld'"
|
||||
" WHERE assignments.CrsCod=%ld"
|
||||
" AND assignments.AsgCod=asg_grp.AsgCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the groups associated to assignments of a course");
|
||||
|
||||
/***** Remove assignments *****/
|
||||
sprintf (Query,"DELETE FROM assignments WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM assignments WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the assignments of a course");
|
||||
}
|
||||
|
||||
|
@ -1671,14 +1671,14 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
|
|||
// Students and teachers can edit assignments depending on groups
|
||||
/***** Get if I can edit an assignment from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM assignments"
|
||||
" WHERE AsgCod='%ld'"
|
||||
" WHERE AsgCod=%ld"
|
||||
" AND "
|
||||
"("
|
||||
"AsgCod NOT IN (SELECT AsgCod FROM asg_grp)" // Assignment is for the whole course
|
||||
" OR "
|
||||
"AsgCod IN" // Assignment is for specific groups
|
||||
" (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND asg_grp.GrpCod=crs_grp_usr.GrpCod)"
|
||||
")",
|
||||
AsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -1697,7 +1697,7 @@ unsigned Asg_GetNumAssignmentsInCrs (long CrsCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Get number of assignments in a course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM assignments WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM assignments WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of assignments in course");
|
||||
}
|
||||
|
@ -1721,12 +1721,12 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE CrsCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT assignments.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,assignments"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -1737,7 +1737,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT assignments.CrsCod)"
|
||||
" FROM centres,degrees,courses,assignments"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
|
@ -1747,7 +1747,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT assignments.CrsCod)"
|
||||
" FROM degrees,courses,assignments"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=assignments.CrsCod",
|
||||
|
@ -1756,7 +1756,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT assignments.CrsCod)"
|
||||
" FROM courses,assignments"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=assignments.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -1764,7 +1764,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -1803,12 +1803,12 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE CrsCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
|
||||
" FROM institutions,centres,degrees,courses,assignments"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -1818,7 +1818,7 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
|
||||
" FROM centres,degrees,courses,assignments"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=assignments.CrsCod",
|
||||
|
@ -1827,7 +1827,7 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
|
||||
" FROM degrees,courses,assignments"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=assignments.CrsCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
@ -1835,14 +1835,14 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
|
||||
" FROM courses,assignments"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=assignments.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM assignments"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -631,17 +631,17 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
|
|||
if (Gbl.CurrentCrs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS)
|
||||
sprintf (Query,"SELECT AttCod"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod='%ld'%s"
|
||||
" WHERE CrsCod=%ld%s"
|
||||
" AND (AttCod NOT IN (SELECT AttCod FROM att_grp) OR"
|
||||
" AttCod IN (SELECT att_grp.AttCod FROM att_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND att_grp.GrpCod=crs_grp_usr.GrpCod))"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery);
|
||||
else // Gbl.CurrentCrs.Grps.WhichGrps == Grp_ALL_GROUPS
|
||||
sprintf (Query,"SELECT AttCod"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod='%ld'%s"
|
||||
" WHERE CrsCod=%ld%s"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,OrderBySubQuery);
|
||||
|
||||
|
@ -714,7 +714,7 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
|
|||
"CommentTchVisible,"
|
||||
"Title"
|
||||
" FROM att_events"
|
||||
" WHERE AttCod='%ld'",
|
||||
" WHERE AttCod=%ld",
|
||||
Att->AttCod);
|
||||
|
||||
/***** Get data of attendance event from database *****/
|
||||
|
@ -811,7 +811,7 @@ static void Att_GetAttEventTxtFromDB (long AttCod,char Txt[Cns_MAX_BYTES_TEXT +
|
|||
|
||||
/***** Get text of attendance event from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM att_events"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get attendance event text");
|
||||
|
||||
|
@ -957,7 +957,7 @@ void Att_HideAttEvent (void)
|
|||
|
||||
/***** Hide attendance event *****/
|
||||
sprintf (Query,"UPDATE att_events SET Hidden='Y'"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not hide attendance event");
|
||||
|
||||
|
@ -989,7 +989,7 @@ void Att_ShowAttEvent (void)
|
|||
|
||||
/***** Hide attendance event *****/
|
||||
sprintf (Query,"UPDATE att_events SET Hidden='N'"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not show attendance event");
|
||||
|
||||
|
@ -1012,7 +1012,7 @@ static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Valu
|
|||
|
||||
/***** Get number of attendance events with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_events"
|
||||
" WHERE CrsCod='%ld' AND %s='%s' AND AttCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND %s='%s' AND AttCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Field,Value,AttCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get similar attendance events") != 0);
|
||||
}
|
||||
|
@ -1334,8 +1334,8 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
|||
" (CrsCod,Hidden,UsrCod,"
|
||||
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
|
||||
" VALUES"
|
||||
" ('%ld','%c','%ld',"
|
||||
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),'%c','%s','%s')",
|
||||
" (%ld,'%c',%ld,"
|
||||
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),'%c','%s','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Att->Hidden ? 'Y' :
|
||||
'N',
|
||||
|
@ -1366,10 +1366,10 @@ void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
|||
/***** Update the data of the attendance event *****/
|
||||
sprintf (Query,"UPDATE att_events SET "
|
||||
"Hidden='%c',"
|
||||
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"CommentTchVisible='%c',Title='%s',Txt='%s'"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Att->Hidden ? 'Y' :
|
||||
'N',
|
||||
Att->TimeUTC[Att_START_TIME],
|
||||
|
@ -1399,7 +1399,7 @@ bool Att_CheckIfAttEventIsAssociatedToGrps (long AttCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Get if an attendance event is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_grp WHERE AttCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_grp WHERE AttCod=%ld",
|
||||
AttCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if an attendance event is associated to groups") != 0);
|
||||
}
|
||||
|
@ -1414,7 +1414,7 @@ bool Att_CheckIfAttEventIsAssociatedToGrp (long AttCod,long GrpCod)
|
|||
|
||||
/***** Get if an attendance event is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_grp"
|
||||
" WHERE AttCod='%ld' AND GrpCod='%ld'",
|
||||
" WHERE AttCod=%ld AND GrpCod=%ld",
|
||||
AttCod,GrpCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if an attendance event is associated to a group") != 0);
|
||||
}
|
||||
|
@ -1428,7 +1428,7 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Remove groups of the attendance event *****/
|
||||
sprintf (Query,"DELETE FROM att_grp WHERE AttCod='%ld'",AttCod);
|
||||
sprintf (Query,"DELETE FROM att_grp WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE (Query,"can not remove the groups associated to an attendance event");
|
||||
}
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ void Att_RemoveGroup (long GrpCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_grp WHERE GrpCod='%ld'",GrpCod);
|
||||
sprintf (Query,"DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove group from the associations between attendance events and groups");
|
||||
}
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ void Att_RemoveGroupsOfType (long GrpTypCod)
|
|||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_grp USING crs_grp,att_grp"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove groups of a type from the associations between attendance events and groups");
|
||||
|
@ -1479,7 +1479,7 @@ static void Att_CreateGrps (long AttCod)
|
|||
sprintf (Query,"INSERT INTO att_grp"
|
||||
" (AttCod,GrpCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||
DB_QueryINSERT (Query,"can not associate a group to an attendance event");
|
||||
}
|
||||
|
@ -1504,7 +1504,7 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve
|
|||
/***** Get groups associated to an attendance event from database *****/
|
||||
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
|
||||
" FROM att_grp,crs_grp,crs_grp_types"
|
||||
" WHERE att_grp.AttCod='%ld'"
|
||||
" WHERE att_grp.AttCod=%ld"
|
||||
" AND att_grp.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
|
@ -1560,7 +1560,7 @@ static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
|||
{
|
||||
char Query[256];
|
||||
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE AttCod='%ld'",AttCod);
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from all attendance events");
|
||||
}
|
||||
|
||||
|
@ -1587,9 +1587,9 @@ void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
|||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod='%ld'"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod"
|
||||
" AND att_usr.UsrCod='%ld'",
|
||||
" AND att_usr.UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from attendance events of a course");
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
|||
char Query[256];
|
||||
|
||||
sprintf (Query,"DELETE FROM att_events"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
}
|
||||
|
@ -1618,20 +1618,20 @@ void Att_RemoveCrsAttEvents (long CrsCod)
|
|||
|
||||
/***** Remove students *****/
|
||||
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod='%ld'"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the students registered in events of a course");
|
||||
|
||||
/***** Remove groups *****/
|
||||
sprintf (Query,"DELETE FROM att_grp USING att_events,att_grp"
|
||||
" WHERE att_events.CrsCod='%ld'"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_grp.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the groups associated to attendance events of a course");
|
||||
|
||||
/***** Remove attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_events WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM att_events WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the attendance events of a course");
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ unsigned Att_GetNumAttEventsInCrs (long CrsCod)
|
|||
char Query[256];
|
||||
|
||||
/***** Get number of attendance events in a course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_events WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_events WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of attendance events in course");
|
||||
}
|
||||
|
@ -1669,12 +1669,12 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE CrsCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT att_events.CrsCod)"
|
||||
" FROM centres,degrees,courses,att_events"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
|
@ -1684,7 +1684,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT att_events.CrsCod)"
|
||||
" FROM degrees,courses,att_events"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=att_events.CrsCod",
|
||||
|
@ -1693,7 +1693,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT att_events.CrsCod)"
|
||||
" FROM courses,att_events"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=att_events.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -1701,7 +1701,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -1740,12 +1740,12 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE CrsCod>0");
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
|
||||
" FROM centres,degrees,courses,att_events"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=att_events.CrsCod",
|
||||
|
@ -1754,7 +1754,7 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
|
||||
" FROM degrees,courses,att_events"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=att_events.CrsCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
@ -1762,14 +1762,14 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
|
||||
" FROM courses,att_events"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=att_events.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -2140,7 +2140,7 @@ static void Att_PutParamsCodGrps (long AttCod)
|
|||
/***** Get groups associated to an attendance event from database *****/
|
||||
if (Gbl.CurrentCrs.Grps.NumGrps)
|
||||
{
|
||||
sprintf (Query,"SELECT GrpCod FROM att_grp WHERE att_grp.AttCod='%ld'",
|
||||
sprintf (Query,"SELECT GrpCod FROM att_grp WHERE att_grp.AttCod=%ld",
|
||||
AttCod);
|
||||
NumGrps = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get groups of an attendance event");
|
||||
}
|
||||
|
@ -2364,7 +2364,7 @@ static void Att_GetNumStdsTotalWhoAreInAttEvent (struct AttendanceEvent *Att)
|
|||
|
||||
/***** Count number of students registered in an event in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_usr"
|
||||
" WHERE AttCod='%ld' AND Present='Y'",
|
||||
" WHERE AttCod=%ld AND Present='Y'",
|
||||
Att->AttCod);
|
||||
Att->NumStdsTotal = (unsigned) DB_QueryCOUNT (Query,"can not get number of students who are registered in an event");
|
||||
}
|
||||
|
@ -2390,7 +2390,7 @@ static unsigned Att_GetNumStdsFromAListWhoAreInAttEvent (long AttCod,long LstSel
|
|||
|
||||
/***** Count number of students registered in an event in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM att_usr"
|
||||
" WHERE AttCod='%ld'"
|
||||
" WHERE AttCod=%ld"
|
||||
" AND UsrCod IN (",
|
||||
AttCod);
|
||||
for (NumStd = 0;
|
||||
|
@ -2429,7 +2429,7 @@ static bool Att_CheckIfUsrIsInTableAttUsr (long AttCod,long UsrCod,bool *Present
|
|||
|
||||
/***** Check if a student is registered in an event in database *****/
|
||||
sprintf (Query,"SELECT Present FROM att_usr"
|
||||
" WHERE AttCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
if ((NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get if a student is already registered in an event")))
|
||||
{
|
||||
|
@ -2482,7 +2482,7 @@ static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long Us
|
|||
|
||||
/***** Check if a students is registered in an event in database *****/
|
||||
sprintf (Query,"SELECT Present,CommentStd,CommentTch FROM att_usr"
|
||||
" WHERE AttCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
if ((NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get if a student is already registered in an event")))
|
||||
{
|
||||
|
@ -2530,7 +2530,7 @@ void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
|
|||
{
|
||||
/***** Set user as present in database *****/
|
||||
sprintf (Query,"UPDATE att_usr SET Present='Y'"
|
||||
" WHERE AttCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not set user as present in an event");
|
||||
}
|
||||
|
@ -2552,7 +2552,7 @@ static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool P
|
|||
sprintf (Query,"REPLACE INTO att_usr"
|
||||
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%c','%s','%s')",
|
||||
" (%ld,%ld,'%c','%s','%s')",
|
||||
AttCod,UsrCod,
|
||||
Present ? 'Y' :
|
||||
'N',
|
||||
|
@ -2571,7 +2571,7 @@ static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod)
|
|||
|
||||
/***** Remove user if there is no comment in database *****/
|
||||
sprintf (Query,"DELETE FROM att_usr"
|
||||
" WHERE AttCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not remove student from an event");
|
||||
}
|
||||
|
@ -2586,7 +2586,7 @@ void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod)
|
|||
|
||||
/***** Clean table att_usr *****/
|
||||
sprintf (Query,"DELETE FROM att_usr"
|
||||
" WHERE AttCod='%ld' AND Present='N'"
|
||||
" WHERE AttCod=%ld AND Present='N'"
|
||||
" AND CommentStd='' AND CommentTch=''",
|
||||
AttCod);
|
||||
DB_QueryDELETE (Query,"can not remove users absent without comments from an event");
|
||||
|
@ -2925,7 +2925,7 @@ static void Att_GetListSelectedAttCods (char **StrAttCodsSelected)
|
|||
{
|
||||
/***** Get groups associated to an attendance event from database *****/
|
||||
sprintf (Query,"SELECT GrpCod FROM att_grp"
|
||||
" WHERE att_grp.AttCod='%ld'",
|
||||
" WHERE att_grp.AttCod=%ld",
|
||||
Gbl.AttEvents.Lst[NumAttEvent].AttCod);
|
||||
NumGrpsInThisEvent = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get groups of an attendance event");
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ void Ban_GetDataOfBannerByCod (struct Banner *Ban)
|
|||
{
|
||||
/***** Get data of a banner from database *****/
|
||||
sprintf (Query,"SELECT Hidden,ShortName,FullName,Img,WWW"
|
||||
" FROM banners WHERE BanCod='%ld'",
|
||||
" FROM banners WHERE BanCod=%ld",
|
||||
Ban->BanCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a banner");
|
||||
|
||||
|
@ -448,7 +448,7 @@ void Ban_RemoveBanner (void)
|
|||
Ban_GetDataOfBannerByCod (&Ban);
|
||||
|
||||
/***** Remove banner *****/
|
||||
sprintf (Query,"DELETE FROM banners WHERE BanCod='%ld'",Ban.BanCod);
|
||||
sprintf (Query,"DELETE FROM banners WHERE BanCod=%ld",Ban.BanCod);
|
||||
DB_QueryDELETE (Query,"can not remove a banner");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -502,7 +502,7 @@ static void Ban_ShowOrHideBanner (bool Hide)
|
|||
if (Ban.Hidden != Hide)
|
||||
{
|
||||
sprintf (Query,"UPDATE banners SET Hidden='%c'"
|
||||
" WHERE BanCod='%ld'",
|
||||
" WHERE BanCod=%ld",
|
||||
Hide ? 'Y' :
|
||||
'N',
|
||||
Ban.BanCod);
|
||||
|
@ -636,7 +636,7 @@ static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,
|
|||
char Query[128 + Ban_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Get number of banners with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM banners WHERE %s='%s' AND BanCod<>'%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM banners WHERE %s='%s' AND BanCod<>%ld",
|
||||
FieldName,Name,BanCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a banner already existed") != 0);
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,const char *N
|
|||
char Query[128 + Ban_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update banner changing old name by new name *****/
|
||||
sprintf (Query,"UPDATE banners SET %s='%s' WHERE BanCod='%ld'",
|
||||
sprintf (Query,"UPDATE banners SET %s='%s' WHERE BanCod=%ld",
|
||||
FieldName,NewBanName,BanCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a banner");
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ void Ban_ChangeBannerImg (void)
|
|||
if (NewImg[0])
|
||||
{
|
||||
/* Update the table changing old image by new image */
|
||||
sprintf (Query,"UPDATE banners SET Img='%s' WHERE BanCod='%ld'",
|
||||
sprintf (Query,"UPDATE banners SET Img='%s' WHERE BanCod=%ld",
|
||||
NewImg,Ban->BanCod);
|
||||
DB_QueryUPDATE (Query,"can not update the image of a banner");
|
||||
|
||||
|
@ -726,7 +726,7 @@ void Ban_ChangeBannerWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
sprintf (Query,"UPDATE banners SET WWW='%s' WHERE BanCod='%ld'",
|
||||
sprintf (Query,"UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
|
||||
NewWWW,Ban->BanCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of a banner");
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ void Cal_ChangeFirstDayOfWeek (void)
|
|||
/***** Store icon set in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_data SET FirstDayOfWeek='%u'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET FirstDayOfWeek=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about first day of week");
|
||||
|
|
|
@ -138,7 +138,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
|
|||
" FROM degrees,ctr_admin,centres"
|
||||
" WHERE (degrees.Status & %u)<>0"
|
||||
" AND degrees.CtrCod=ctr_admin.CtrCod"
|
||||
" AND ctr_admin.UsrCod='%ld'"
|
||||
" AND ctr_admin.UsrCod=%ld"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" GROUP BY degrees.CtrCod ORDER BY centres.ShortName",
|
||||
(unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -986,14 +986,14 @@ void Ctr_GetListCentres (long InsCod)
|
|||
"centres.ShortName,centres.FullName,centres.WWW,"
|
||||
"COUNT(DISTINCT usr_data.UsrCod) AS NumUsrs"
|
||||
" FROM centres,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=usr_data.CtrCod"
|
||||
" GROUP BY centres.CtrCod)"
|
||||
" UNION "
|
||||
"(SELECT CtrCod,InsCod,PlcCod,Status,RequesterUsrCod,"
|
||||
"ShortName,FullName,WWW,0 AS NumUsrs"
|
||||
" FROM centres"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND CtrCod NOT IN"
|
||||
" (SELECT DISTINCT CtrCod FROM usr_data))"
|
||||
" ORDER BY %s",
|
||||
|
@ -1104,7 +1104,7 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
|||
"centres.ShortName,centres.FullName,centres.WWW,"
|
||||
"COUNT(DISTINCT usr_data.UsrCod) AS NumUsrs"
|
||||
" FROM centres,usr_data"
|
||||
" WHERE centres.CtrCod='%ld'"
|
||||
" WHERE centres.CtrCod=%ld"
|
||||
" AND centres.CtrCod=usr_data.CtrCod"
|
||||
" GROUP BY centres.CtrCod)"
|
||||
" UNION "
|
||||
|
@ -1113,7 +1113,7 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
|||
"ShortName,FullName,WWW,"
|
||||
"0 AS NumUsrs"
|
||||
" FROM centres"
|
||||
" WHERE CtrCod='%ld'"
|
||||
" WHERE CtrCod=%ld"
|
||||
" AND CtrCod NOT IN"
|
||||
" (SELECT DISTINCT CtrCod FROM usr_data))",
|
||||
Ctr->CtrCod,
|
||||
|
@ -1186,7 +1186,7 @@ long Ctr_GetInsCodOfCentreByCod (long CtrCod)
|
|||
if (CtrCod > 0)
|
||||
{
|
||||
/***** Get the institution code of a centre from database *****/
|
||||
sprintf (Query,"SELECT InsCod FROM centres WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"SELECT InsCod FROM centres WHERE CtrCod=%ld",
|
||||
CtrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a centre") == 1)
|
||||
{
|
||||
|
@ -1217,7 +1217,7 @@ void Ctr_GetShortNameOfCentreByCod (struct Centre *Ctr)
|
|||
{
|
||||
/***** Get the short name of a centre from database *****/
|
||||
sprintf (Query,"SELECT ShortName FROM centres"
|
||||
" WHERE CtrCod ='%ld'",
|
||||
" WHERE CtrCod=%ld",
|
||||
Ctr->CtrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a centre") == 1)
|
||||
{
|
||||
|
@ -1248,7 +1248,7 @@ static void Ctr_GetPhotoAttribution (long CtrCod,char **PhotoAttribution)
|
|||
Ctr_FreePhotoAttribution (PhotoAttribution);
|
||||
|
||||
/***** Get photo attribution from database *****/
|
||||
sprintf (Query,"SELECT PhotoAttribution FROM centres WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"SELECT PhotoAttribution FROM centres WHERE CtrCod=%ld",
|
||||
CtrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get photo attribution"))
|
||||
{
|
||||
|
@ -1332,7 +1332,7 @@ void Ctr_WriteSelectorOfCentre (void)
|
|||
/***** Get centres from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT CtrCod,ShortName"
|
||||
" FROM centres"
|
||||
" WHERE InsCod='%ld'"
|
||||
" WHERE InsCod=%ld"
|
||||
" ORDER BY ShortName",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
NumCtrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get centres");
|
||||
|
@ -1717,7 +1717,7 @@ void Ctr_RemoveCentre (void)
|
|||
Fil_RemoveTree (PathCtr);
|
||||
|
||||
/***** Remove centre *****/
|
||||
sprintf (Query,"DELETE FROM centres WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM centres WHERE CtrCod=%ld",
|
||||
Ctr.CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a centre");
|
||||
|
||||
|
@ -1810,7 +1810,7 @@ static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Update institution in table of centres *****/
|
||||
sprintf (Query,"UPDATE centres SET InsCod='%ld' WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
|
||||
InsCod,CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the institution of a centre");
|
||||
}
|
||||
|
@ -1839,7 +1839,7 @@ void Ctr_ChangeCentrePlace (void)
|
|||
Ctr_GetDataOfCentreByCod (Ctr);
|
||||
|
||||
/***** Update place in table of centres *****/
|
||||
sprintf (Query,"UPDATE centres SET PlcCod='%ld' WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
|
||||
NewPlcCod,Ctr->CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the place of a centre");
|
||||
Ctr->PlcCod = NewPlcCod;
|
||||
|
@ -1972,7 +1972,7 @@ static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Nam
|
|||
|
||||
/***** Get number of centres with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM centres"
|
||||
" WHERE InsCod='%ld' AND %s='%s' AND CtrCod<>'%ld'",
|
||||
" WHERE InsCod=%ld AND %s='%s' AND CtrCod<>%ld",
|
||||
InsCod,FieldName,Name,CtrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a centre already existed") != 0);
|
||||
}
|
||||
|
@ -1986,7 +1986,7 @@ static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *N
|
|||
char Query[128 + Hie_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update centre changing old name by new name */
|
||||
sprintf (Query,"UPDATE centres SET %s='%s' WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
|
||||
FieldName,NewCtrName,CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a centre");
|
||||
}
|
||||
|
@ -2076,7 +2076,7 @@ static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
|||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE centres SET WWW='%s' WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
|
||||
NewWWW,CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of a centre");
|
||||
}
|
||||
|
@ -2114,7 +2114,7 @@ void Ctr_ChangeCtrStatus (void)
|
|||
Ctr_GetDataOfCentreByCod (Ctr);
|
||||
|
||||
/***** Update status in table of centres *****/
|
||||
sprintf (Query,"UPDATE centres SET Status='%u' WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"UPDATE centres SET Status=%u WHERE CtrCod=%ld",
|
||||
(unsigned) Status,Ctr->CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the status of a centre");
|
||||
|
||||
|
@ -2385,7 +2385,7 @@ void Ctr_ChangeCtrPhotoAttribution (void)
|
|||
|
||||
/***** Update the table changing old attribution by new attribution *****/
|
||||
sprintf (Query,"UPDATE centres SET PhotoAttribution='%s'"
|
||||
" WHERE CtrCod='%ld'",
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the photo attribution of the current centre");
|
||||
|
||||
|
@ -2744,7 +2744,7 @@ static void Ctr_CreateCentre (struct Centre *Ctr,unsigned Status)
|
|||
" (InsCod,PlcCod,Status,RequesterUsrCod,"
|
||||
"ShortName,FullName,WWW,PhotoAttribution)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%ld',"
|
||||
" (%ld,%ld,%u,%ld,"
|
||||
"'%s','%s','%s','')",
|
||||
Ctr->InsCod,Ctr->PlcCod,
|
||||
Status,
|
||||
|
@ -2784,7 +2784,7 @@ unsigned Ctr_GetNumCtrsInCty (long CtyCod)
|
|||
|
||||
/***** Get number of centres of a country from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions,centres"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod",
|
||||
CtyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of centres in a country");
|
||||
|
@ -2801,7 +2801,7 @@ unsigned Ctr_GetNumCtrsInIns (long InsCod)
|
|||
|
||||
/***** Get number of centres of an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM centres"
|
||||
" WHERE InsCod='%ld'",
|
||||
" WHERE InsCod=%ld",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of centres in an institution");
|
||||
}
|
||||
|
@ -2816,7 +2816,7 @@ unsigned Ctr_GetNumCtrsInPlc (long PlcCod)
|
|||
|
||||
/***** Get number of centres (of the current institution) in a place *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM centres"
|
||||
" WHERE InsCod='%ld' AND PlcCod='%ld'",
|
||||
" WHERE InsCod=%ld AND PlcCod=%ld",
|
||||
Gbl.CurrentIns.Ins.InsCod,PlcCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of centres in a place");
|
||||
}
|
||||
|
@ -2871,7 +2871,7 @@ unsigned Ctr_GetNumCtrsWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
SubQuery,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of centres with users");
|
||||
}
|
||||
|
|
|
@ -209,13 +209,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.162 (2017-03-23)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.163 (2017-03-24)"
|
||||
#define CSS_FILE "swad16.161.css"
|
||||
#define JS_FILE "swad16.144.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.163: Mar 24, 2017 Types of degree can be ordered by name and by number of degrees.
|
||||
Integer fields in database queries without single quotes. (217434 lines)
|
||||
Version 16.162: Mar 23, 2017 Changes in layout of types of degree. (217330 lines)
|
||||
Version 16.161.8: Mar 23, 2017 Some help URLs translated to spanish. (217386 lines)
|
||||
Version 16.161.7: Mar 23, 2017 Some help URLs translated to spanish. (217385 lines)
|
||||
|
|
|
@ -251,7 +251,7 @@ void Cht_ShowListOfChatRoomsWithUsrs (void)
|
|||
|
||||
/***** Get chat rooms with connected users from database *****/
|
||||
sprintf (Query,"SELECT RoomCode,NumUsrs FROM chat"
|
||||
" WHERE NumUsrs>'0' ORDER BY NumUsrs DESC,RoomCode");
|
||||
" WHERE NumUsrs>0 ORDER BY NumUsrs DESC,RoomCode");
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get chat rooms with connected users");
|
||||
|
||||
if (NumRows > 0) // If not empty chat rooms found
|
||||
|
|
|
@ -629,7 +629,7 @@ void Con_UpdateMeInConnectedList (void)
|
|||
sprintf (Query,"REPLACE INTO connected"
|
||||
" (UsrCod,RoleInLastCrs,LastCrsCod,LastTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld',NOW())",
|
||||
" (%ld,%u,%ld,NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Gbl.Usrs.Me.LoggedRole,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -662,7 +662,7 @@ static unsigned Con_GetConnectedUsrsTotal (Rol_Role_t Role)
|
|||
return 0;
|
||||
|
||||
/***** Get number of connected users with a role from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs='%u'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs=%u",
|
||||
(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected users");
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -710,7 +710,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -722,7 +722,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
|
@ -733,7 +733,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM courses,crs_usr,connected,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
|
@ -743,7 +743,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM crs_usr,connected,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -769,7 +769,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM connected,crs_usr,usr_data"
|
||||
" WHERE connected.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
(unsigned) Role);
|
||||
break;
|
||||
|
@ -777,12 +777,12 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
|
@ -792,11 +792,11 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -806,10 +806,10 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM degrees,courses,crs_usr,connected,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
|
@ -819,9 +819,9 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM courses,crs_usr,connected,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -831,8 +831,8 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
|
||||
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||
" FROM crs_usr,connected,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" AND connected.UsrCod=usr_data.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -891,7 +891,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role
|
|||
sprintf (Query,"SELECT connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM connected,crs_usr"
|
||||
" WHERE crs_usr.CrsCod='%ld' AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.CrsCod=%ld AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -1059,7 +1059,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM connected,crs_usr"
|
||||
" WHERE connected.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY Dif",
|
||||
(unsigned) Role);
|
||||
break;
|
||||
|
@ -1067,12 +1067,12 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,connected"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
|
@ -1082,11 +1082,11 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM centres,degrees,courses,crs_usr,connected"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -1096,10 +1096,10 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM degrees,courses,crs_usr,connected"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
|
@ -1109,9 +1109,9 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM courses,crs_usr,connected"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -1121,8 +1121,8 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
sprintf (Query,"SELECT connected.UsrCod,connected.LastCrsCod,"
|
||||
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
|
||||
" FROM crs_usr,connected"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=connected.UsrCod"
|
||||
" ORDER BY Dif",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
|
|
@ -101,7 +101,7 @@ int main (void)
|
|||
|
||||
sprintf (Query,"SELECT usr_IDs.UsrCod,usr_IDs.UsrID"
|
||||
" FROM crs_usr,usr_IDs"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=usr_IDs.UsrCod"
|
||||
" ORDER BY usr_IDs.UsrCod",
|
||||
CrsCod);
|
||||
|
|
|
@ -790,7 +790,7 @@ static unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (long CtyCod)
|
|||
|
||||
/***** Get number of users from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE CtyCod='%ld'",
|
||||
" WHERE CtyCod=%ld",
|
||||
CtyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of users who claim to belong to other countries");
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ static void Cty_GetMapAttribution (long CtyCod,char **MapAttribution)
|
|||
Cty_FreeMapAttribution (MapAttribution);
|
||||
|
||||
/***** Get photo attribution from database *****/
|
||||
sprintf (Query,"SELECT MapAttribution FROM countries WHERE CtyCod='%ld'",
|
||||
sprintf (Query,"SELECT MapAttribution FROM countries WHERE CtyCod=%ld",
|
||||
CtyCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get photo attribution"))
|
||||
{
|
||||
|
@ -2332,7 +2332,7 @@ unsigned Cty_GetNumCtysWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
SubQuery,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of countries with users");
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ unsigned Crs_GetNumCrssInCty (long CtyCod)
|
|||
|
||||
/***** Get number of courses in a country from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions,centres,degrees,courses"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod",
|
||||
|
@ -814,7 +814,7 @@ unsigned Crs_GetNumCrssInIns (long InsCod)
|
|||
|
||||
/***** Get number of courses in a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM centres,degrees,courses"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod",
|
||||
InsCod);
|
||||
|
@ -831,7 +831,7 @@ unsigned Crs_GetNumCrssInCtr (long CtrCod)
|
|||
|
||||
/***** Get number of courses in a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees,courses"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod",
|
||||
CtrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses in a centre");
|
||||
|
@ -847,7 +847,7 @@ unsigned Crs_GetNumCrssInDeg (long DegCod)
|
|||
|
||||
/***** Get number of courses in a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM courses"
|
||||
" WHERE DegCod='%ld'",
|
||||
" WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses in a degree");
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ unsigned Crs_GetNumCrssWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
SubQuery,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of courses with users");
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ void Crs_WriteSelectorOfCourse (void)
|
|||
{
|
||||
/***** Get courses belonging to the current degree from database *****/
|
||||
sprintf (Query,"SELECT CrsCod,ShortName FROM courses"
|
||||
" WHERE DegCod='%ld'"
|
||||
" WHERE DegCod=%ld"
|
||||
" ORDER BY ShortName",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a degree");
|
||||
|
@ -1003,13 +1003,13 @@ static void Crs_GetListCoursesInDegree (Crs_WhatCourses_t WhatCourses)
|
|||
{
|
||||
case Crs_ACTIVE_COURSES:
|
||||
sprintf (Query,"SELECT CrsCod,DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName"
|
||||
" FROM courses WHERE DegCod='%ld' AND Status=0"
|
||||
" FROM courses WHERE DegCod=%ld AND Status=0"
|
||||
" ORDER BY Year,ShortName",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Crs_ALL_COURSES_EXCEPT_REMOVED:
|
||||
sprintf (Query,"SELECT CrsCod,DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName"
|
||||
" FROM courses WHERE DegCod='%ld' AND (Status & %u)=0"
|
||||
" FROM courses WHERE DegCod=%ld AND (Status & %u)=0"
|
||||
" ORDER BY Year,ShortName",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
(unsigned) Crs_STATUS_BIT_REMOVED);
|
||||
|
@ -1938,7 +1938,7 @@ static void Crs_CreateCourse (struct Course *Crs,unsigned Status)
|
|||
sprintf (Query,"INSERT INTO courses"
|
||||
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%s','%u','%ld','%s','%s')",
|
||||
" (%ld,%u,'%s',%u,%ld,'%s','%s')",
|
||||
Crs->DegCod,Crs->Year,
|
||||
Crs->InstitutionalCrsCod,
|
||||
Status,
|
||||
|
@ -2017,7 +2017,7 @@ bool Crs_GetDataOfCourseByCod (struct Course *Crs)
|
|||
{
|
||||
/***** Get data of a course from database *****/
|
||||
sprintf (Query,"SELECT CrsCod,DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName"
|
||||
" FROM courses WHERE CrsCod='%ld'",
|
||||
" FROM courses WHERE CrsCod=%ld",
|
||||
Crs->CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of a course")) // Course found...
|
||||
{
|
||||
|
@ -2100,7 +2100,7 @@ static void Crs_GetShortNamesByCod (long CrsCod,
|
|||
/***** Get the short name of a degree from database *****/
|
||||
sprintf (Query,"SELECT courses.ShortName,degrees.ShortName"
|
||||
" FROM courses,degrees"
|
||||
" WHERE courses.CrsCod='%ld'"
|
||||
" WHERE courses.CrsCod=%ld"
|
||||
" AND courses.DegCod=degrees.DegCod",
|
||||
CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a course") == 1)
|
||||
|
@ -2131,11 +2131,11 @@ void Crs_RemoveCourseCompletely (long CrsCod)
|
|||
Crs_EmptyCourseCompletely (CrsCod);
|
||||
|
||||
/***** Remove course from table of last accesses to courses in database *****/
|
||||
sprintf (Query,"DELETE FROM crs_last WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM crs_last WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove a course");
|
||||
|
||||
/***** Remove course from table of courses in database *****/
|
||||
sprintf (Query,"DELETE FROM courses WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM courses WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove a course");
|
||||
}
|
||||
|
||||
|
@ -2164,33 +2164,33 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove information of the course ****/
|
||||
/* Remove timetable of the course */
|
||||
sprintf (Query,"DELETE FROM timetable_crs WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM timetable_crs WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove the timetable of a course");
|
||||
|
||||
/* Remove other information of the course */
|
||||
sprintf (Query,"DELETE FROM crs_info_src WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM crs_info_src WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove info sources of a course");
|
||||
|
||||
sprintf (Query,"DELETE FROM crs_info_txt WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM crs_info_txt WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove info of a course");
|
||||
|
||||
/***** Remove exam announcements in the course *****/
|
||||
/* Mark all exam announcements in the course as deleted */
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status='%u'"
|
||||
" WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not remove exam announcements of a course");
|
||||
|
||||
/***** Remove course cards of the course *****/
|
||||
/* Remove content of course cards */
|
||||
sprintf (Query,"DELETE FROM crs_records USING crs_record_fields,crs_records"
|
||||
" WHERE crs_record_fields.CrsCod='%ld'"
|
||||
" WHERE crs_record_fields.CrsCod=%ld"
|
||||
" AND crs_record_fields.FieldCod=crs_records.FieldCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove content of cards in a course");
|
||||
|
||||
/* Remove definition of fields in course cards */
|
||||
sprintf (Query,"DELETE FROM crs_record_fields WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM crs_record_fields WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove fields of cards in a course");
|
||||
|
||||
/***** Remove assignments of the course *****/
|
||||
|
@ -2204,11 +2204,11 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
sprintf (Query,"INSERT INTO notices_deleted"
|
||||
" (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
|
||||
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif FROM notices"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryINSERT (Query,"can not remove notices in a course");
|
||||
/* Remove all notices from the course */
|
||||
sprintf (Query,"DELETE FROM notices WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM notices WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove notices in a course");
|
||||
|
||||
/***** Remove all the threads and posts in forums of the course *****/
|
||||
|
@ -2227,7 +2227,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
/* Remove all the users in groups in the course */
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr"
|
||||
" USING crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod",
|
||||
CrsCod);
|
||||
|
@ -2236,24 +2236,24 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
/* Remove all the groups in the course */
|
||||
sprintf (Query,"DELETE FROM crs_grp"
|
||||
" USING crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove groups of a course");
|
||||
|
||||
/* Remove all the group types in the course */
|
||||
sprintf (Query,"DELETE FROM crs_grp_types"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove types of group of a course");
|
||||
|
||||
/***** Remove users' requests for inscription in the course *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr_requests WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_usr_requests WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove requests for inscription to a course");
|
||||
|
||||
/***** Remove possible users remaining in the course (teachers) *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_usr WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove users from a course");
|
||||
|
||||
|
@ -2417,7 +2417,7 @@ static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Update degree in table of courses *****/
|
||||
sprintf (Query,"UPDATE courses SET DegCod='%ld' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
|
||||
DegCod,CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not move course to another degree");
|
||||
}
|
||||
|
@ -2555,7 +2555,7 @@ static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
|||
char Query[128];
|
||||
|
||||
/***** Update year/semester in table of courses *****/
|
||||
sprintf (Query,"UPDATE courses SET Year='%u' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET Year=%u WHERE CrsCod=%ld",
|
||||
NewYear,Crs->CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the year of a course");
|
||||
|
||||
|
@ -2572,7 +2572,7 @@ void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutio
|
|||
char Query[512];
|
||||
|
||||
/***** Update institutional course code in table of courses *****/
|
||||
sprintf (Query,"UPDATE courses SET InsCrsCod='%s' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
||||
NewInstitutionalCrsCod,Crs->CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the institutional code of the current course");
|
||||
|
||||
|
@ -2710,8 +2710,8 @@ static bool Crs_CheckIfCrsNameExistsInYearOfDeg (const char *FieldName,const cha
|
|||
|
||||
/***** Get number of courses in a year of a degree and with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM courses"
|
||||
" WHERE DegCod='%ld' AND Year='%u'"
|
||||
" AND %s='%s' AND CrsCod<>'%ld'",
|
||||
" WHERE DegCod=%ld AND Year=%u"
|
||||
" AND %s='%s' AND CrsCod<>%ld",
|
||||
DegCod,Year,FieldName,Name,CrsCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a course already existed") != 0);
|
||||
}
|
||||
|
@ -2725,7 +2725,7 @@ static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *N
|
|||
char Query[128 + Hie_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update course changing old name by new name *****/
|
||||
sprintf (Query,"UPDATE courses SET %s='%s' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
|
||||
FieldName,NewCrsName,CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a course");
|
||||
}
|
||||
|
@ -2763,7 +2763,7 @@ void Crs_ChangeCrsStatus (void)
|
|||
Crs_GetDataOfCourseByCod (Crs);
|
||||
|
||||
/***** Update status in table of courses *****/
|
||||
sprintf (Query,"UPDATE courses SET Status='%u' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET Status=%u WHERE CrsCod=%ld",
|
||||
(unsigned) Status,Crs->CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the status of a course");
|
||||
|
||||
|
@ -2986,11 +2986,11 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
|
|||
if (Role == Rol_UNKNOWN)
|
||||
SubQuery[0] = '\0'; // Role == Rol_UNKNOWN ==> any role
|
||||
else
|
||||
sprintf (SubQuery," AND crs_usr.Role='%u'",(unsigned) Role);
|
||||
sprintf (SubQuery," AND crs_usr.Role=%u",(unsigned) Role);
|
||||
sprintf (Query,"SELECT degrees.DegCod,courses.CrsCod,degrees.ShortName,degrees.FullName,"
|
||||
"courses.Year,courses.FullName,centres.ShortName,crs_usr.Accepted"
|
||||
" FROM crs_usr,courses,degrees,centres"
|
||||
" WHERE crs_usr.UsrCod='%ld'%s"
|
||||
" WHERE crs_usr.UsrCod=%ld%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -3283,7 +3283,7 @@ void Crs_UpdateCrsLast (void)
|
|||
sprintf (Query,"REPLACE INTO crs_last"
|
||||
" (CrsCod,LastTime)"
|
||||
" VALUES"
|
||||
" ('%ld',NOW())",
|
||||
" (%ld,NOW())",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not update last access to current course");
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ void Deg_SeeDegWithPendingCrss (void)
|
|||
case Rol_DEG_ADM:
|
||||
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
|
||||
" FROM admin,courses,degrees"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=courses.DegCod"
|
||||
" AND (courses.Status & %u)<>0"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
|
@ -617,7 +617,7 @@ void Deg_WriteSelectorOfDegree (void)
|
|||
{
|
||||
/***** Get degrees belonging to the current centre from database *****/
|
||||
sprintf (Query,"SELECT DegCod,ShortName FROM degrees"
|
||||
" WHERE CtrCod='%ld' ORDER BY ShortName",
|
||||
" WHERE CtrCod=%ld ORDER BY ShortName",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
NumDegs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a centre");
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status)
|
|||
sprintf (Query,"INSERT INTO degrees"
|
||||
" (CtrCod,DegTypCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%ld','%s','%s','%s')",
|
||||
" (%ld,%ld,%u,%ld,'%s','%s','%s')",
|
||||
Deg->CtrCod,Deg->DegTypCod,Status,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Deg->ShrtName,Deg->FullName,Deg->WWW);
|
||||
Deg->DegCod = DB_QueryINSERTandReturnCode (Query,"can not create a new degree");
|
||||
|
@ -1411,7 +1411,7 @@ void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs)
|
|||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY degrees.ShortName",
|
||||
(unsigned) Rol_STUDENT);
|
||||
Degs->Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you");
|
||||
|
@ -1454,7 +1454,7 @@ void Deg_GetListDegsOfCurrentCtr (void)
|
|||
/***** Get degrees of the current centre from database *****/
|
||||
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
|
||||
"ShortName,FullName,WWW"
|
||||
" FROM degrees WHERE CtrCod='%ld' ORDER BY FullName",
|
||||
" FROM degrees WHERE CtrCod=%ld ORDER BY FullName",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a centre");
|
||||
|
||||
|
@ -1678,7 +1678,7 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg)
|
|||
/***** Get data of a degree from database *****/
|
||||
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
|
||||
"ShortName,FullName,WWW"
|
||||
" FROM degrees WHERE DegCod ='%ld'",
|
||||
" FROM degrees WHERE DegCod=%ld",
|
||||
Deg->DegCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of a degree")) // Degree found...
|
||||
{
|
||||
|
@ -1747,7 +1747,7 @@ void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg)
|
|||
if (Deg->DegCod > 0)
|
||||
{
|
||||
/***** Get the short name of a degree from database *****/
|
||||
sprintf (Query,"SELECT ShortName FROM degrees WHERE DegCod ='%ld'",
|
||||
sprintf (Query,"SELECT ShortName FROM degrees WHERE DegCod=%ld",
|
||||
Deg->DegCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a degree") == 1)
|
||||
{
|
||||
|
@ -1777,7 +1777,7 @@ long Deg_GetCtrCodOfDegreeByCod (long DegCod)
|
|||
if (DegCod > 0)
|
||||
{
|
||||
/***** Get the centre code of a degree from database *****/
|
||||
sprintf (Query,"SELECT CtrCod FROM degrees WHERE DegCod ='%ld'",
|
||||
sprintf (Query,"SELECT CtrCod FROM degrees WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the centre of a degree") == 1)
|
||||
{
|
||||
|
@ -1808,7 +1808,7 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod)
|
|||
{
|
||||
/***** Get the institution code of a degree from database *****/
|
||||
sprintf (Query,"SELECT centres.InsCod FROM degrees,centres"
|
||||
" WHERE degrees.DegCod='%ld'"
|
||||
" WHERE degrees.DegCod=%ld"
|
||||
" AND degrees.CtrCod=centres.CtrCod",
|
||||
DegCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a degree") == 1)
|
||||
|
@ -1840,7 +1840,7 @@ void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
char PathDeg[PATH_MAX + 1];
|
||||
|
||||
/***** Get courses of a degree from database *****/
|
||||
sprintf (Query,"SELECT CrsCod FROM courses WHERE DegCod='%ld'",
|
||||
sprintf (Query,"SELECT CrsCod FROM courses WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get courses of a degree");
|
||||
|
||||
|
@ -1880,12 +1880,12 @@ void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
Fil_RemoveTree (PathDeg);
|
||||
|
||||
/***** Remove administrators of this degree *****/
|
||||
sprintf (Query,"DELETE FROM admin WHERE Scope='%s' AND Cod='%ld'",
|
||||
sprintf (Query,"DELETE FROM admin WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove administrators of a degree");
|
||||
|
||||
/***** Remove the degree *****/
|
||||
sprintf (Query,"DELETE FROM degrees WHERE DegCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM degrees WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove a degree");
|
||||
|
||||
|
@ -2011,7 +2011,7 @@ static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Nam
|
|||
|
||||
/***** Get number of degrees with a type and a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees"
|
||||
" WHERE CtrCod='%ld' AND %s='%s' AND DegCod<>'%ld'",
|
||||
" WHERE CtrCod=%ld AND %s='%s' AND DegCod<>%ld",
|
||||
CtrCod,FieldName,Name,DegCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a degree already existed") != 0);
|
||||
}
|
||||
|
@ -2025,7 +2025,7 @@ static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *N
|
|||
char Query[128 + Hie_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update degree changing old name by new name *****/
|
||||
sprintf (Query,"UPDATE degrees SET %s='%s' WHERE DegCod='%ld'",
|
||||
sprintf (Query,"UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
|
||||
FieldName,NewDegName,DegCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a degree");
|
||||
}
|
||||
|
@ -2104,7 +2104,7 @@ static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Update centre in table of degrees *****/
|
||||
sprintf (Query,"UPDATE degrees SET CtrCod='%ld' WHERE DegCod='%ld'",
|
||||
sprintf (Query,"UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
||||
CtrCod,DegCod);
|
||||
DB_QueryUPDATE (Query,"can not update the centre of a degree");
|
||||
}
|
||||
|
@ -2192,7 +2192,7 @@ static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW
|
|||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod='%ld'",
|
||||
sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
|
||||
NewWWW,DegCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of a degree");
|
||||
}
|
||||
|
@ -2230,7 +2230,7 @@ void Deg_ChangeDegStatus (void)
|
|||
Deg_GetDataOfDegreeByCod (Deg);
|
||||
|
||||
/***** Update status in table of degrees *****/
|
||||
sprintf (Query,"UPDATE degrees SET Status='%u' WHERE DegCod='%ld'",
|
||||
sprintf (Query,"UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
||||
(unsigned) Status,Deg->DegCod);
|
||||
DB_QueryUPDATE (Query,"can not update the status of a degree");
|
||||
|
||||
|
@ -2341,7 +2341,7 @@ unsigned Deg_GetNumDegsInCty (long InsCod)
|
|||
|
||||
/***** Get number of degrees in a country from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions,centres,degrees"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod",
|
||||
InsCod);
|
||||
|
@ -2358,7 +2358,7 @@ unsigned Deg_GetNumDegsInIns (long InsCod)
|
|||
|
||||
/***** Get number of degrees in an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM centres,degrees"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of degrees in an institution");
|
||||
|
@ -2373,7 +2373,7 @@ unsigned Deg_GetNumDegsInCtr (long CtrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of degrees in a centre from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE CtrCod=%ld",
|
||||
CtrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of degrees in a centre");
|
||||
}
|
||||
|
@ -2411,7 +2411,7 @@ unsigned Deg_GetNumDegsWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
SubQuery,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of degrees with users");
|
||||
}
|
||||
|
@ -2434,26 +2434,26 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
|
|||
struct Degree Deg;
|
||||
|
||||
/***** Get institutions, centres, degrees admin by user from database *****/
|
||||
sprintf (Query,"(SELECT '%u' AS S,'-1' AS Cod,'' AS FullName"
|
||||
sprintf (Query,"(SELECT %u AS S,-1 AS Cod,'' AS FullName"
|
||||
" FROM admin"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND Scope='%s')"
|
||||
" UNION "
|
||||
"(SELECT '%u' AS S,admin.Cod,institutions.FullName"
|
||||
"(SELECT %u AS S,admin.Cod,institutions.FullName"
|
||||
" FROM admin,institutions"
|
||||
" WHERE admin.UsrCod='%ld'"
|
||||
" WHERE admin.UsrCod=%ld"
|
||||
" AND admin.Scope='%s'"
|
||||
" AND admin.Cod=institutions.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT '%u' AS S,admin.Cod,centres.FullName"
|
||||
"(SELECT %u AS S,admin.Cod,centres.FullName"
|
||||
" FROM admin,centres"
|
||||
" WHERE admin.UsrCod='%ld'"
|
||||
" WHERE admin.UsrCod=%ld"
|
||||
" AND admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod)"
|
||||
" UNION "
|
||||
"(SELECT '%u' AS S,admin.Cod,degrees.FullName"
|
||||
"(SELECT %u AS S,admin.Cod,degrees.FullName"
|
||||
" FROM admin,degrees"
|
||||
" WHERE admin.UsrCod='%ld'"
|
||||
" WHERE admin.UsrCod=%ld"
|
||||
" AND admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod)"
|
||||
" ORDER BY S,FullName",
|
||||
|
|
|
@ -62,6 +62,8 @@ extern struct Globals Gbl;
|
|||
/**************************** Private prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void DT_GetParamDegTypOrder (void);
|
||||
|
||||
static void DT_ListDegreeTypes (void);
|
||||
static void DT_EditDegreeTypes (void);
|
||||
static void DT_ListDegreeTypesForSeeing (void);
|
||||
|
@ -124,6 +126,9 @@ void DT_WriteSelectorDegreeTypes (void)
|
|||
|
||||
void DT_SeeDegreeTypes (void)
|
||||
{
|
||||
/***** Get parameter with the type of order in the list of degree types *****/
|
||||
DT_GetParamDegTypOrder ();
|
||||
|
||||
/***** Get list of degree types *****/
|
||||
DT_GetListDegreeTypes ();
|
||||
|
||||
|
@ -134,6 +139,19 @@ void DT_SeeDegreeTypes (void)
|
|||
DT_FreeListDegreeTypes ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Get parameter with the type or order in list of degree types ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void DT_GetParamDegTypOrder (void)
|
||||
{
|
||||
Gbl.Degs.DegTypes.SelectedOrder = (DT_Order_t)
|
||||
Par_GetParToUnsignedLong ("Order",
|
||||
0,
|
||||
DT_NUM_ORDERS - 1,
|
||||
(unsigned long) DT_ORDER_DEFAULT);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Request edition of degree types **********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -211,15 +229,21 @@ static void DT_ListDegreeTypesForSeeing (void)
|
|||
Gbl.CurrentDegTyp.DegTyp.DegTypCod) ? "LIGHT_BLUE" :
|
||||
Gbl.ColorRows[Gbl.RowEvenOdd];
|
||||
|
||||
/* Name of degree type */
|
||||
/* Number of degree type in this list */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"DAT LEFT_MIDDLE %s\">"
|
||||
"<td class=\"DAT_N RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
BgColor,NumDegTyp + 1);
|
||||
|
||||
/* Name of degree type */
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT_N LEFT_MIDDLE %s\">"
|
||||
"%s"
|
||||
"</td>",
|
||||
BgColor,Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName);
|
||||
|
||||
/* Number of degrees of this type */
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT_N RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
|
@ -359,19 +383,35 @@ static void DT_PutFormToCreateDegreeType (void)
|
|||
|
||||
static void DT_PutHeadDegreeTypesForSeeing (void)
|
||||
{
|
||||
extern const char *Txt_Type_of_degree;
|
||||
extern const char *Txt_Degrees;
|
||||
extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS];
|
||||
extern const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS];
|
||||
DT_Order_t Order;
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Type_of_degree,
|
||||
Txt_Degrees);
|
||||
"<th></th>");
|
||||
for (Order = DT_ORDER_BY_DEGREE_TYPE;
|
||||
Order <= DT_ORDER_BY_NUM_DEGREES;
|
||||
Order++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<th class=\"%s\">",
|
||||
Order == DT_ORDER_BY_DEGREE_TYPE ? "LEFT_MIDDLE" :
|
||||
"RIGHT_MIDDLE");
|
||||
|
||||
Act_FormStart (ActSeeDegTyp);
|
||||
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
||||
Act_LinkFormSubmit (Txt_DEGREE_TYPES_HELP_ORDER[Order],"TIT_TBL",NULL);
|
||||
if (Order == Gbl.Degs.DegTypes.SelectedOrder)
|
||||
fprintf (Gbl.F.Out,"<u>");
|
||||
|
||||
fprintf (Gbl.F.Out,"%s",Txt_DEGREE_TYPES_ORDER[Order]);
|
||||
|
||||
if (Order == Gbl.Degs.DegTypes.SelectedOrder)
|
||||
fprintf (Gbl.F.Out,"</u>");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
Act_FormEnd ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</th>");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -427,22 +467,29 @@ static void DT_CreateDegreeType (struct DegreeType *DegTyp)
|
|||
|
||||
void DT_GetListDegreeTypes (void)
|
||||
{
|
||||
static const char *OrderBySubQuery[DT_NUM_ORDERS] =
|
||||
{
|
||||
"DegTypName", // DT_ORDER_BY_DEGREE_TYPE
|
||||
"NumDegs DESC,DegTypName", // DT_ORDER_BY_NUM_DEGREES
|
||||
};
|
||||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRow;
|
||||
|
||||
/***** Get types of degree from database *****/
|
||||
sprintf (Query,"(SELECT deg_types.DegTypCod,deg_types.DegTypName AS DegTypName,"
|
||||
" COUNT(degrees.DegCod)"
|
||||
sprintf (Query,"(SELECT deg_types.DegTypCod,"
|
||||
"deg_types.DegTypName AS DegTypName,"
|
||||
" COUNT(degrees.DegCod) AS NumDegs"
|
||||
" FROM deg_types,degrees"
|
||||
" WHERE deg_types.DegTypCod=degrees.DegTypCod"
|
||||
" GROUP BY degrees.DegTypCod)"
|
||||
" UNION "
|
||||
"(SELECT DegTypCod,DegTypName,'0'"
|
||||
"(SELECT DegTypCod,DegTypName,0 AS NumDegs" // Do not use '0' because NumDegs will be casted to string and order will be wrong
|
||||
" FROM deg_types"
|
||||
" WHERE DegTypCod NOT IN (SELECT DegTypCod FROM degrees))"
|
||||
" ORDER BY DegTypName");
|
||||
" ORDER BY %s",
|
||||
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]);
|
||||
Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get types of degree");
|
||||
|
||||
/***** Get degree types *****/
|
||||
|
@ -595,7 +642,7 @@ static unsigned DT_CountNumDegsOfType (long DegTypCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of degrees of a type from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE DegTypCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE DegTypCod=%ld",
|
||||
DegTypCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of degrees of a type");
|
||||
}
|
||||
|
@ -621,7 +668,7 @@ bool DT_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp)
|
|||
}
|
||||
|
||||
/***** Get the name of a type of degree from database *****/
|
||||
sprintf (Query,"SELECT DegTypName FROM deg_types WHERE DegTypCod='%ld'",
|
||||
sprintf (Query,"SELECT DegTypName FROM deg_types WHERE DegTypCod=%ld",
|
||||
DegTyp->DegTypCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the name of a type of degree");
|
||||
|
||||
|
@ -669,7 +716,7 @@ static void DT_RemoveDegreeTypeCompletely (long DegTypCod)
|
|||
long DegCod;
|
||||
|
||||
/***** Get degrees of a type from database *****/
|
||||
sprintf (Query,"SELECT DegCod FROM degrees WHERE DegTypCod='%ld'",
|
||||
sprintf (Query,"SELECT DegCod FROM degrees WHERE DegTypCod=%ld",
|
||||
DegTypCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a type");
|
||||
|
||||
|
@ -693,7 +740,7 @@ static void DT_RemoveDegreeTypeCompletely (long DegTypCod)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Remove the degree type *****/
|
||||
sprintf (Query,"DELETE FROM deg_types WHERE DegTypCod='%ld'",DegTypCod);
|
||||
sprintf (Query,"DELETE FROM deg_types WHERE DegTypCod=%ld",DegTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove a type of degree");
|
||||
}
|
||||
|
||||
|
@ -748,7 +795,7 @@ void DT_RenameDegreeType (void)
|
|||
{
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE deg_types SET DegTypName='%s'"
|
||||
" WHERE DegTypCod='%ld'",
|
||||
" WHERE DegTypCod=%ld",
|
||||
NewNameDegTyp,DegTyp->DegTypCod);
|
||||
DB_QueryUPDATE (Query,"can not update the type of a degree");
|
||||
|
||||
|
@ -782,7 +829,7 @@ static bool DT_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCo
|
|||
|
||||
/***** Get number of degree types with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM deg_types"
|
||||
" WHERE DegTypName='%s' AND DegTypCod<>'%ld'",
|
||||
" WHERE DegTypName='%s' AND DegTypCod<>%ld",
|
||||
DegTypName,DegTypCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a type of degree already existed") != 0);
|
||||
}
|
||||
|
@ -811,7 +858,7 @@ void DT_ChangeDegreeType (void)
|
|||
Deg_GetDataOfDegreeByCod (Deg);
|
||||
|
||||
/***** Update the table of degrees changing old type by new type *****/
|
||||
sprintf (Query,"UPDATE degrees SET DegTypCod='%ld' WHERE DegCod='%ld'",
|
||||
sprintf (Query,"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
NewDegTypCod,Deg->DegCod);
|
||||
DB_QueryUPDATE (Query,"can not update the type of a degree");
|
||||
|
||||
|
|
|
@ -45,6 +45,14 @@ struct DegreeType
|
|||
unsigned NumDegs; // Number of degrees of this type
|
||||
};
|
||||
|
||||
#define DT_NUM_ORDERS 2
|
||||
typedef enum
|
||||
{
|
||||
DT_ORDER_BY_DEGREE_TYPE = 0,
|
||||
DT_ORDER_BY_NUM_DEGREES = 1,
|
||||
} DT_Order_t;
|
||||
#define DT_ORDER_DEFAULT DT_ORDER_BY_DEGREE_TYPE
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -287,17 +287,17 @@ void Dpt_GetListDepartments (long InsCod)
|
|||
"departments.ShortName,departments.FullName,departments.WWW,"
|
||||
"COUNT(DISTINCT usr_data.UsrCod) AS NumTchs"
|
||||
" FROM departments,usr_data,crs_usr"
|
||||
" WHERE departments.InsCod='%ld'"
|
||||
" WHERE departments.InsCod=%ld"
|
||||
" AND departments.DptCod=usr_data.DptCod"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY departments.DptCod)"
|
||||
" UNION "
|
||||
"(SELECT DptCod,InsCod,ShortName,FullName,WWW,0 AS NumTchs"
|
||||
" FROM departments"
|
||||
" WHERE InsCod='%ld' AND DptCod NOT IN"
|
||||
" WHERE InsCod=%ld AND DptCod NOT IN"
|
||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||
" ORDER BY %s",
|
||||
InsCod,(unsigned) Rol_TEACHER,
|
||||
InsCod,(unsigned) Rol_TEACHER,
|
||||
|
@ -309,14 +309,14 @@ void Dpt_GetListDepartments (long InsCod)
|
|||
" FROM departments,usr_data,crs_usr"
|
||||
" WHERE departments.DptCod=usr_data.DptCod"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY departments.DptCod)"
|
||||
" UNION "
|
||||
"(SELECT DptCod,InsCod,ShortName,FullName,WWW,0 AS NumTchs"
|
||||
" FROM departments"
|
||||
" WHERE DptCod NOT IN"
|
||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||
" ORDER BY %s",
|
||||
(unsigned) Rol_TEACHER,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -405,17 +405,17 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
|
|||
sprintf (Query,"(SELECT departments.InsCod,departments.ShortName,departments.FullName,departments.WWW,"
|
||||
"COUNT(DISTINCT usr_data.UsrCod) AS NumTchs"
|
||||
" FROM departments,usr_data,crs_usr"
|
||||
" WHERE departments.DptCod='%ld'"
|
||||
" WHERE departments.DptCod=%ld"
|
||||
" AND departments.DptCod=usr_data.DptCod"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY departments.DptCod)"
|
||||
" UNION "
|
||||
"(SELECT InsCod,ShortName,FullName,WWW,0"
|
||||
" FROM departments"
|
||||
" WHERE DptCod='%ld' AND DptCod NOT IN"
|
||||
" WHERE DptCod=%ld AND DptCod NOT IN"
|
||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))",
|
||||
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))",
|
||||
Dpt->DptCod,(unsigned) Rol_TEACHER,
|
||||
Dpt->DptCod,(unsigned) Rol_TEACHER);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department");
|
||||
|
@ -474,7 +474,7 @@ unsigned Dpt_GetNumDepartmentsInInstitution (long InsCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of departments in an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM departments WHERE InsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM departments WHERE InsCod=%ld",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of departments in an institution");
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ void Dpt_RemoveDepartment (void)
|
|||
else // Department has no teachers ==> remove it
|
||||
{
|
||||
/***** Remove department *****/
|
||||
sprintf (Query,"DELETE FROM departments WHERE DptCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM departments WHERE DptCod=%ld",
|
||||
Dpt.DptCod);
|
||||
DB_QueryDELETE (Query,"can not remove a department");
|
||||
|
||||
|
@ -677,7 +677,7 @@ void Dpt_ChangeDepartIns (void)
|
|||
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod ();
|
||||
|
||||
/***** Update institution in table of departments *****/
|
||||
sprintf (Query,"UPDATE departments SET InsCod='%ld' WHERE DptCod='%ld'",
|
||||
sprintf (Query,"UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
|
||||
Dpt->InsCod,Dpt->DptCod);
|
||||
DB_QueryUPDATE (Query,"can not update the institution of a department");
|
||||
|
||||
|
@ -805,7 +805,7 @@ static bool Dpt_CheckIfDepartmentNameExists (const char *FieldName,const char *N
|
|||
|
||||
/***** Get number of departments with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM departments"
|
||||
" WHERE %s='%s' AND DptCod<>'%ld'",
|
||||
" WHERE %s='%s' AND DptCod<>%ld",
|
||||
FieldName,Name,DptCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a department already existed") != 0);
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ static void Dpt_UpdateDegNameDB (long DptCod,const char *FieldName,const char *N
|
|||
char Query[128 + Hie_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update department changing old name by new name *****/
|
||||
sprintf (Query,"UPDATE departments SET %s='%s' WHERE DptCod='%ld'",
|
||||
sprintf (Query,"UPDATE departments SET %s='%s' WHERE DptCod=%ld",
|
||||
FieldName,NewDptName,DptCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a department");
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ void Dpt_ChangeDptWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
sprintf (Query,"UPDATE departments SET WWW='%s' WHERE DptCod='%ld'",
|
||||
sprintf (Query,"UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
|
||||
NewWWW,Dpt->DptCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of a department");
|
||||
|
||||
|
@ -1092,7 +1092,7 @@ static void Dpt_CreateDepartment (struct Department *Dpt)
|
|||
sprintf (Query,"INSERT INTO departments"
|
||||
" (InsCod,ShortName,FullName,WWW)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s','%s')",
|
||||
" (%ld,'%s','%s','%s')",
|
||||
Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW);
|
||||
DB_QueryINSERT (Query,"can not create a new department");
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ unsigned Dpt_GetNumberOfDepartmentsInInstitution (long InsCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get departments in an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM departments WHERE InsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM departments WHERE InsCod=%ld",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of departments in an institution");
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
|
|||
sprintf (Query,"REPLACE INTO usr_duplicated"
|
||||
" (UsrCod,InformerCod,InformTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW())",
|
||||
" (%ld,%ld,NOW())",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not report duplicate");
|
||||
|
@ -266,7 +266,7 @@ static void Dup_ListSimilarUsrs (void)
|
|||
Gbl.Usrs.Other.UsrDat.FirstName[0]) // Name and surname 1 not empty
|
||||
sprintf (Query,"SELECT DISTINCT UsrCod FROM"
|
||||
"(SELECT DISTINCT UsrCod FROM usr_IDs"
|
||||
" WHERE UsrID IN (SELECT UsrID FROM usr_IDs WHERE UsrCod='%ld')"
|
||||
" WHERE UsrID IN (SELECT UsrID FROM usr_IDs WHERE UsrCod=%ld)"
|
||||
" UNION"
|
||||
" SELECT UsrCod FROM usr_data"
|
||||
" WHERE Surname1='%s' AND Surname2='%s' AND FirstName='%s')"
|
||||
|
@ -277,7 +277,7 @@ static void Dup_ListSimilarUsrs (void)
|
|||
Gbl.Usrs.Other.UsrDat.FirstName);
|
||||
else
|
||||
sprintf (Query,"SELECT DISTINCT UsrCod FROM usr_IDs"
|
||||
" WHERE UsrID IN (SELECT UsrID FROM usr_IDs WHERE UsrCod='%ld')",
|
||||
" WHERE UsrID IN (SELECT UsrID FROM usr_IDs WHERE UsrCod=%ld)",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get similar users");
|
||||
|
||||
|
@ -379,7 +379,7 @@ static bool Dup_CheckIfUsrIsDup (long UsrCod)
|
|||
{
|
||||
char Query[128];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_duplicated WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_duplicated WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not if user is in list of possible duplicate users") != 0);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ void Dup_RemoveUsrFromDuplicated (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove enrollment request *****/
|
||||
sprintf (Query,"DELETE FROM usr_duplicated WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_duplicated WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from possible duplicates");
|
||||
}
|
||||
|
|
|
@ -205,8 +205,8 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
|||
}
|
||||
|
||||
/***** Update the role of a user in a course *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET Role='%u'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr SET Role=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not modify user's role in course");
|
||||
|
||||
|
@ -249,10 +249,10 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
|
|||
"NumAccTst,LastAccTst,NumQstsLastTst,"
|
||||
"UsrListType,ColsClassPhoto,ListWithPhotos)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%c',"
|
||||
"'-1','-1','-1',"
|
||||
"'0',FROM_UNIXTIME('%ld'),'0',"
|
||||
"'%s','%u','%c')",
|
||||
" (%ld,%ld,%u,'%c',"
|
||||
"-1,-1,-1,"
|
||||
"0,FROM_UNIXTIME(%ld),0,"
|
||||
"'%s',%u,'%c')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
|
||||
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
|
||||
'N',
|
||||
|
@ -404,7 +404,7 @@ void Enr_GetNotifEnrollment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/***** Get user's role in course from database *****/
|
||||
sprintf (Query,"SELECT Role"
|
||||
" FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
|
@ -463,14 +463,14 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
sprintf (Query,"UPDATE usr_data"
|
||||
" SET Password='%s',"
|
||||
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
||||
"Theme='%s',IconSet='%s',Language='%s',FirstDayOfWeek='%u',"
|
||||
"Theme='%s',IconSet='%s',Language='%s',FirstDayOfWeek=%u,"
|
||||
"PhotoVisibility='%s',ProfileVisibility='%s',"
|
||||
"CtyCod='%ld',"
|
||||
"CtyCod=%ld,"
|
||||
"LocalAddress='%s',LocalPhone='%s',"
|
||||
"FamilyAddress='%s',FamilyPhone='%s',"
|
||||
"OriginPlace='%s',Birthday=%s,"
|
||||
"Comments='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->Password,
|
||||
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
|
||||
Usr_StringsSexDB[UsrDat->Sex],
|
||||
|
@ -514,8 +514,8 @@ void Enr_UpdateInstitutionCentreDepartment (void)
|
|||
char Query[256];
|
||||
|
||||
sprintf (Query,"UPDATE usr_data"
|
||||
" SET InsCtyCod='%ld',InsCod='%ld',CtrCod='%ld',DptCod='%ld'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.InsCtyCod,
|
||||
Gbl.Usrs.Me.UsrDat.InsCod,
|
||||
Gbl.Usrs.Me.UsrDat.Tch.CtrCod,
|
||||
|
@ -1896,7 +1896,7 @@ void Enr_SignUpInCrs (void)
|
|||
|
||||
/***** Try to get and old request of the same user in the same course from database *****/
|
||||
sprintf (Query,"SELECT ReqCod FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get enrollment request"))
|
||||
|
@ -1911,8 +1911,8 @@ void Enr_SignUpInCrs (void)
|
|||
/***** Request user in current course in database *****/
|
||||
if (ReqCod > 0) // Old request exists in database
|
||||
{
|
||||
sprintf (Query,"UPDATE crs_usr_requests SET Role='%u',RequestTime=NOW()"
|
||||
" WHERE ReqCod='%ld' AND CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr_requests SET Role=%u,RequestTime=NOW()"
|
||||
" WHERE ReqCod=%ld AND CrsCod=%ld AND UsrCod=%ld",
|
||||
(unsigned) RoleFromForm,
|
||||
ReqCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -1924,7 +1924,7 @@ void Enr_SignUpInCrs (void)
|
|||
sprintf (Query,"INSERT INTO crs_usr_requests"
|
||||
" (CrsCod,UsrCod,Role,RequestTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u',NOW())",
|
||||
" (%ld,%ld,%u,NOW())",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) RoleFromForm);
|
||||
|
@ -1969,7 +1969,7 @@ void Enr_GetNotifEnrollmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/***** Get user and requested role from database *****/
|
||||
sprintf (Query,"SELECT UsrCod,Role"
|
||||
" FROM crs_usr_requests"
|
||||
" WHERE ReqCod='%ld'",
|
||||
" WHERE ReqCod=%ld",
|
||||
ReqCod);
|
||||
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
|
@ -2250,8 +2250,8 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2267,7 +2267,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2283,7 +2283,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2300,7 +2300,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2338,13 +2338,13 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,institutions,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2361,11 +2361,11 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,institutions,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2382,10 +2382,10 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,institutions,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2403,9 +2403,9 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,institutions,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2424,7 +2424,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2450,12 +2450,12 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2472,10 +2472,10 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2492,9 +2492,9 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2513,7 +2513,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2538,11 +2538,11 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,degrees,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2559,9 +2559,9 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='%s'"
|
||||
" WHERE admin.UsrCod=%ld AND admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2580,7 +2580,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM degrees,courses,crs_usr_requests"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2604,10 +2604,10 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2627,7 +2627,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM courses,crs_usr_requests"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2651,7 +2651,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,"
|
||||
"UNIX_TIMESTAMP(RequestTime)"
|
||||
" FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ((1<<Role)&%u)<>0"
|
||||
" ORDER BY RequestTime DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -2845,7 +2845,7 @@ static void Enr_RemoveEnrollmentRequest (long CrsCod,long UsrCod)
|
|||
Important: do this before removing the request *****/
|
||||
/* Request request code (returns 0 or 1 rows) */
|
||||
sprintf (Query,"SELECT ReqCod FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get request code")) // Request exists
|
||||
{
|
||||
|
@ -2861,7 +2861,7 @@ static void Enr_RemoveEnrollmentRequest (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove enrollment request *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a request for enrollment");
|
||||
}
|
||||
|
@ -2878,7 +2878,7 @@ static void Enr_RemoveExpiredEnrollmentRequests (void)
|
|||
Important: do this before removing the request *****/
|
||||
sprintf (Query,"UPDATE notif,crs_usr_requests"
|
||||
" SET notif.Status=(notif.Status | %u)"
|
||||
" WHERE notif.NotifyEvent='%u'"
|
||||
" WHERE notif.NotifyEvent=%u"
|
||||
" AND notif.Cod=crs_usr_requests.ReqCod"
|
||||
" AND crs_usr_requests.RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
|
@ -3274,7 +3274,7 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,long Cod
|
|||
sprintf (Query,"REPLACE INTO admin"
|
||||
" (UsrCod,Scope,Cod)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%ld')",
|
||||
" (%ld,'%s',%ld)",
|
||||
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryREPLACE (Query,"can not create administrator");
|
||||
|
||||
|
@ -3856,7 +3856,7 @@ void Enr_AcceptUsrInCrs (long UsrCod)
|
|||
|
||||
/***** Set enrollment of a user to "accepted" in the current course *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET Accepted='Y'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not confirm user's enrollment");
|
||||
}
|
||||
|
@ -3942,7 +3942,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
|
||||
/***** Remove user from the table of courses-users *****/
|
||||
sprintf (Query,"DELETE FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Crs->CrsCod,UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from a course");
|
||||
|
||||
|
@ -4015,7 +4015,7 @@ static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
|
|||
{
|
||||
/***** Remove user from the table of admins *****/
|
||||
sprintf (Query,"DELETE FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='%s' AND Cod='%ld'",
|
||||
" WHERE UsrCod=%ld AND Scope='%s' AND Cod=%ld",
|
||||
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove an administrator");
|
||||
|
||||
|
|
38
swad_exam.c
38
swad_exam.c
|
@ -320,8 +320,8 @@ static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,u
|
|||
char Query[256];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE exam_announcements SET NumNotif=NumNotif+'%u'"
|
||||
" WHERE ExaCod='%ld'",
|
||||
sprintf (Query,"UPDATE exam_announcements SET NumNotif=NumNotif+%u"
|
||||
" WHERE ExaCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,ExaCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of notifications of an exam announcement");
|
||||
}
|
||||
|
@ -394,8 +394,8 @@ void Exa_RemoveExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as deleted in the database *****/
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status='%u'"
|
||||
" WHERE ExaCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not remove exam announcement");
|
||||
|
@ -437,8 +437,8 @@ void Exa_HideExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as hidden in the database *****/
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status='%u'"
|
||||
" WHERE ExaCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not hide exam announcement");
|
||||
|
@ -471,8 +471,8 @@ void Exa_UnhideExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as visible in the database *****/
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status='%u'"
|
||||
" WHERE ExaCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not unhide exam announcement");
|
||||
|
@ -556,10 +556,10 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
|
|||
|
||||
/***** Build subquery about status depending on my role *****/
|
||||
if (ICanEdit)
|
||||
sprintf (SubQueryStatus,"Status<>'%u'",
|
||||
sprintf (SubQueryStatus,"Status<>%u",
|
||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT);
|
||||
else
|
||||
sprintf (SubQueryStatus,"Status='%u'",
|
||||
sprintf (SubQueryStatus,"Status=%u",
|
||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT);
|
||||
|
||||
/***** Show one highlighted exam announcement *****/
|
||||
|
@ -568,8 +568,8 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
|
|||
/***** Get one exam announcement from database *****/
|
||||
sprintf (Query,"SELECT ExaCod"
|
||||
" FROM exam_announcements"
|
||||
" WHERE ExaCod='%ld'"
|
||||
" AND CrsCod='%ld' AND %s",
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND CrsCod=%ld AND %s",
|
||||
Gbl.ExamAnns.HighlightExaCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,SubQueryStatus);
|
||||
NumExaAnns = DB_QuerySELECT (Query,&mysql_res,"can not get exam announcements in this course for listing");
|
||||
|
@ -606,7 +606,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
|
|||
in current course for a date from database *****/
|
||||
sprintf (Query,"SELECT ExaCod"
|
||||
" FROM exam_announcements"
|
||||
" WHERE CrsCod='%ld' AND %s"
|
||||
" WHERE CrsCod=%ld AND %s"
|
||||
" AND DATE(ExamDate)='%s'"
|
||||
" ORDER BY ExamDate DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,SubQueryStatus,
|
||||
|
@ -642,7 +642,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
|
|||
in current course from database *****/
|
||||
sprintf (Query,"SELECT ExaCod"
|
||||
" FROM exam_announcements"
|
||||
" WHERE CrsCod='%ld' AND %s"
|
||||
" WHERE CrsCod=%ld AND %s"
|
||||
" ORDER BY ExamDate DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,SubQueryStatus);
|
||||
NumExaAnns = DB_QuerySELECT (Query,&mysql_res,"can not get exam announcements in this course for listing");
|
||||
|
@ -747,7 +747,7 @@ static long Exa_AddExamAnnouncementToDB (void)
|
|||
"CallDate,ExamDate,Duration,"
|
||||
"Place,ExamMode,Structure,DocRequired,MatRequired,MatAllowed,OtherInfo)"
|
||||
" VALUES "
|
||||
"('%ld','%u','0','%s','%u','%s',"
|
||||
"(%ld,%u,0,'%s',%u,'%s',"
|
||||
"NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00','%s',"
|
||||
"'%s','%s','%s','%s','%s','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -790,12 +790,12 @@ static void Exa_ModifyExamAnnouncementInDB (void)
|
|||
7 * Cns_MAX_BYTES_TEXT)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to query database.");
|
||||
sprintf (Query,"UPDATE exam_announcements"
|
||||
" SET CrsFullName='%s',Year='%u',ExamSession='%s',"
|
||||
" SET CrsFullName='%s',Year=%u,ExamSession='%s',"
|
||||
"ExamDate='%04u-%02u-%02u %02u:%02u:00',"
|
||||
"Duration='%02u:%02u:00',"
|
||||
"Place='%s',ExamMode='%s',Structure='%s',"
|
||||
"DocRequired='%s',MatRequired='%s',MatAllowed='%s',OtherInfo='%s'"
|
||||
" WHERE ExaCod='%ld'",
|
||||
" WHERE ExaCod=%ld",
|
||||
Gbl.ExamAnns.ExaDat.CrsFullName,
|
||||
Gbl.ExamAnns.ExaDat.Year,
|
||||
Gbl.ExamAnns.ExaDat.Session,
|
||||
|
@ -837,7 +837,7 @@ void Exa_CreateListDatesOfExamAnnouncements (void)
|
|||
in current course from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT(DATE(ExamDate))"
|
||||
" FROM exam_announcements"
|
||||
" WHERE CrsCod='%ld' AND Status='%u'",
|
||||
" WHERE CrsCod=%ld AND Status=%u",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT);
|
||||
NumExaAnns = DB_QuerySELECT (Query,&mysql_res,"can not get exam announcements in this course");
|
||||
|
@ -909,7 +909,7 @@ static void Exa_GetDataExamAnnouncementFromDB (void)
|
|||
sprintf (Query,"SELECT CrsCod,Status,CrsFullName,Year,ExamSession,"
|
||||
"CallDate,ExamDate,Duration,Place,ExamMode,"
|
||||
"Structure,DocRequired,MatRequired,MatAllowed,OtherInfo"
|
||||
" FROM exam_announcements WHERE ExaCod='%ld'",
|
||||
" FROM exam_announcements WHERE ExaCod=%ld",
|
||||
Gbl.ExamAnns.ExaDat.ExaCod);
|
||||
NumExaAnns = DB_QuerySELECT (Query,&mysql_res,"can not get data of an exam announcement");
|
||||
|
||||
|
|
|
@ -2695,7 +2695,7 @@ bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName)
|
|||
bool FolderExists = false;
|
||||
|
||||
/***** Get all the users belonging to current course from database *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users from current course");
|
||||
|
||||
|
@ -2744,10 +2744,10 @@ static void Brw_CreateFoldersAssignmentsIfNotExist (long ZoneUsrCod)
|
|||
/***** Get assignment folders from database *****/
|
||||
// Old behaviour (only create assignment folder if assignment is open) is obsolete since 2015-11-10
|
||||
sprintf (Query,"SELECT Folder FROM assignments"
|
||||
" WHERE CrsCod='%ld' AND Hidden='N' AND Folder<>''"
|
||||
" WHERE CrsCod=%ld AND Hidden='N' AND Folder<>''"
|
||||
" AND (AsgCod NOT IN (SELECT AsgCod FROM asg_grp) OR"
|
||||
" AsgCod IN (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND asg_grp.GrpCod=crs_grp_usr.GrpCod))",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,ZoneUsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get folders of assignments");
|
||||
|
@ -2795,7 +2795,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con
|
|||
unsigned NumUsrsSuccess = 0;
|
||||
|
||||
/***** Get all the users belonging to current course from database *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users from current course");
|
||||
|
||||
|
@ -2910,7 +2910,7 @@ void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName)
|
|||
char PathFolder[PATH_MAX + 1];
|
||||
|
||||
/***** Get all the users belonging to current course from database *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users from current course");
|
||||
|
||||
|
@ -3860,8 +3860,8 @@ static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
|||
char Query[512];
|
||||
|
||||
/***** Update the group of my last access to a common zone *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET %s='%ld'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr SET %s=%ld"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
FieldNameDB,GrpCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the group of the last access to a file browser");
|
||||
|
@ -4093,8 +4093,8 @@ static void Brw_StoreSizeOfFileTreeInDB (void)
|
|||
" (FileBrowser,Cod,ZoneUsrCod,"
|
||||
"NumLevels,NumFolders,NumFiles,TotalSize)"
|
||||
" VALUES"
|
||||
" ('%u','%ld','%ld',"
|
||||
"'%u','%lu','%lu','%llu')",
|
||||
" (%u,%ld,%ld,"
|
||||
"%u,'%lu','%lu','%llu')",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],Cod,ZoneUsrCod,
|
||||
Gbl.FileBrowser.Size.NumLevls,
|
||||
Gbl.FileBrowser.Size.NumFolds,
|
||||
|
@ -4113,7 +4113,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u') AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u) AND files.Cod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
|
@ -4122,7 +4122,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
InsCod);
|
||||
|
@ -4130,7 +4130,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
InsCod);
|
||||
|
@ -4139,7 +4139,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
/***** Remove from database the entries that store
|
||||
the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
InsCod);
|
||||
|
@ -4148,7 +4148,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
/***** Remove from database the entries that store
|
||||
the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
InsCod);
|
||||
|
@ -4156,7 +4156,7 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_INS,
|
||||
(unsigned) Brw_ADMI_SHARE_INS,
|
||||
InsCod);
|
||||
|
@ -4173,7 +4173,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u') AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u) AND files.Cod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
|
@ -4182,7 +4182,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
CtrCod);
|
||||
|
@ -4190,7 +4190,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
CtrCod);
|
||||
|
@ -4198,7 +4198,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
CtrCod);
|
||||
|
@ -4206,7 +4206,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
CtrCod);
|
||||
|
@ -4214,7 +4214,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CTR,
|
||||
(unsigned) Brw_ADMI_SHARE_CTR,
|
||||
CtrCod);
|
||||
|
@ -4231,7 +4231,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u') AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u) AND files.Cod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
|
@ -4240,7 +4240,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
DegCod);
|
||||
|
@ -4248,7 +4248,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
DegCod);
|
||||
|
@ -4256,7 +4256,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
DegCod);
|
||||
|
@ -4264,7 +4264,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
DegCod);
|
||||
|
@ -4272,7 +4272,7 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u') AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u) AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_DEG,
|
||||
(unsigned) Brw_ADMI_SHARE_DEG,
|
||||
DegCod);
|
||||
|
@ -4290,8 +4290,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove format of files of marks *****/
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u'"
|
||||
" AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser=%u"
|
||||
" AND files.Cod=%ld"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) Brw_ADMI_MARKS_CRS,
|
||||
CrsCod);
|
||||
|
@ -4299,8 +4299,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u','%u','%u','%u','%u')"
|
||||
" AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u,%u,%u,%u,%u)"
|
||||
" AND files.Cod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
|
@ -4313,8 +4313,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
(unsigned) Brw_ADMI_SHARE_CRS,
|
||||
|
@ -4328,8 +4328,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
(unsigned) Brw_ADMI_SHARE_CRS,
|
||||
|
@ -4345,8 +4345,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
(unsigned) Brw_ADMI_SHARE_CRS,
|
||||
|
@ -4357,8 +4357,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
(unsigned) Brw_ADMI_SHARE_CRS,
|
||||
|
@ -4370,8 +4370,8 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
(unsigned) Brw_ADMI_SHARE_CRS,
|
||||
|
@ -4392,8 +4392,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove format of files of marks *****/
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u'"
|
||||
" AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser=%u"
|
||||
" AND files.Cod=%ld"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) Brw_ADMI_MARKS_GRP,
|
||||
GrpCod);
|
||||
|
@ -4401,8 +4401,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
|
@ -4413,8 +4413,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
(unsigned) Brw_ADMI_SHARE_GRP,
|
||||
|
@ -4424,8 +4424,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
(unsigned) Brw_ADMI_SHARE_GRP,
|
||||
|
@ -4435,8 +4435,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
(unsigned) Brw_ADMI_SHARE_GRP,
|
||||
|
@ -4446,8 +4446,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
(unsigned) Brw_ADMI_SHARE_GRP,
|
||||
|
@ -4457,8 +4457,8 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
(unsigned) Brw_ADMI_SHARE_GRP,
|
||||
|
@ -4477,14 +4477,14 @@ void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long UsrCod,long CrsCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" WHERE UsrCod=%ld AND ("
|
||||
"(FileBrowser IN (%u,%u,%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld)"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u','%u')"
|
||||
"(FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod))"
|
||||
")",
|
||||
UsrCod,
|
||||
|
@ -4506,14 +4506,14 @@ void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long UsrCod,long CrsCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" WHERE UsrCod=%ld AND ("
|
||||
"(FileBrowser IN (%u,%u,%u,%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld)"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u','%u')"
|
||||
"(FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod))"
|
||||
")",
|
||||
UsrCod,
|
||||
|
@ -4537,14 +4537,14 @@ void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long UsrCod,long CrsCod)
|
|||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" WHERE UsrCod=%ld AND ("
|
||||
"(FileBrowser IN (%u,%u,%u,%u,%u)"
|
||||
" AND Cod=%ld)"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u','%u')"
|
||||
"(FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod))"
|
||||
")",
|
||||
UsrCod,
|
||||
|
@ -4572,8 +4572,8 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" WHERE files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=%ld AND files.ZoneUsrCod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_ASSIG_USR,
|
||||
(unsigned) Brw_ADMI_WORKS_USR,
|
||||
|
@ -4582,8 +4582,8 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u)"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
(unsigned) Brw_ADMI_ASSIG_CRS,
|
||||
(unsigned) Brw_ADMI_WORKS_CRS,
|
||||
CrsCod,UsrCod);
|
||||
|
@ -4591,8 +4591,8 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u)"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
(unsigned) Brw_ADMI_ASSIG_CRS,
|
||||
(unsigned) Brw_ADMI_WORKS_CRS,
|
||||
CrsCod,UsrCod);
|
||||
|
@ -4600,8 +4600,8 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u)"
|
||||
" AND Cod=%ld AND ZoneUsrCod=%ld",
|
||||
(unsigned) Brw_ADMI_ASSIG_USR,
|
||||
(unsigned) Brw_ADMI_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
|
@ -4609,8 +4609,8 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
|||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
" WHERE FileBrowser IN (%u,%u)"
|
||||
" AND Cod=%ld AND ZoneUsrCod=%ld",
|
||||
(unsigned) Brw_ADMI_ASSIG_USR,
|
||||
(unsigned) Brw_ADMI_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
|
@ -4629,38 +4629,38 @@ void Brw_RemoveUsrFilesFromDB (long UsrCod)
|
|||
// User is not removed from file_view table,
|
||||
// in order to take into account his/her views
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.ZoneUsrCod='%ld'"
|
||||
" WHERE files.ZoneUsrCod=%ld"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a user");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld'", // User's clipboard
|
||||
" WHERE UsrCod=%ld", // User's clipboard
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's clipboards");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld'", // User's last visits to all zones
|
||||
" WHERE UsrCod=%ld", // User's last visits to all zones
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's last visits to file zones");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE ZoneUsrCod='%ld'",
|
||||
" WHERE ZoneUsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of user's file zones");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE ZoneUsrCod='%ld'",
|
||||
" WHERE ZoneUsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove files in user's file zones");
|
||||
}
|
||||
|
@ -4863,7 +4863,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
return;
|
||||
}
|
||||
sprintf (Query,"SELECT UNIX_TIMESTAMP(LastClick) FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u AND Cod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB_file_browser_last[Gbl.FileBrowser.Type],
|
||||
Cod);
|
||||
|
@ -4890,7 +4890,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
sprintf (Query,"REPLACE INTO file_browser_last"
|
||||
" (UsrCod,FileBrowser,Cod,LastClick)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld',NOW())",
|
||||
" (%ld,%u,%ld,NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB_file_browser_last[Gbl.FileBrowser.Type],
|
||||
Cod);
|
||||
|
@ -4911,7 +4911,7 @@ static long Brw_GetGrpLastAccZone (const char *FieldNameDB)
|
|||
|
||||
/***** Get the group of my last access to a common zone from database *****/
|
||||
sprintf (Query,"SELECT %s FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
FieldNameDB,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -6689,7 +6689,7 @@ static bool Brw_GetMyClipboard (void)
|
|||
|
||||
/***** Get my current clipboard from database *****/
|
||||
sprintf (Query,"SELECT FileBrowser,Cod,WorksUsrCod,FileType,Path"
|
||||
" FROM clipboard WHERE UsrCod='%ld'",
|
||||
" FROM clipboard WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get source of copy from clipboard");
|
||||
|
||||
|
@ -6808,7 +6808,7 @@ static void Brw_AddPathToClipboards (void)
|
|||
sprintf (Query,"INSERT INTO clipboard"
|
||||
" (UsrCod,FileBrowser,Cod,WorksUsrCod,FileType,Path)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld','%ld','%u','%s')",
|
||||
" (%ld,%u,%ld,%ld,%u,'%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type,
|
||||
Cod,WorksUsrCod,
|
||||
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
@ -6826,10 +6826,10 @@ static void Brw_UpdatePathInClipboard (void)
|
|||
char Query[512 + PATH_MAX];
|
||||
|
||||
/***** Update path in my clipboard *****/
|
||||
sprintf (Query,"UPDATE clipboard SET FileBrowser='%u',"
|
||||
"Cod='%ld',WorksUsrCod='%ld',"
|
||||
"FileType='%u',Path='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE clipboard SET FileBrowser=%u,"
|
||||
"Cod=%ld,WorksUsrCod=%ld,"
|
||||
"FileType=%u,Path='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.FileBrowser.Type,
|
||||
Cod,WorksUsrCod,
|
||||
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
|
@ -6959,7 +6959,7 @@ static void Brw_InsertFolderInExpandedFolders (const char Path[PATH_MAX + 1])
|
|||
sprintf (Query,"INSERT INTO expanded_folders"
|
||||
" (UsrCod,FileBrowser,Cod,WorksUsrCod,Path,ClickTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld','%ld','%s/',NOW())",
|
||||
" (%ld,%u,%ld,%ld,'%s/',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type],
|
||||
Cod,WorksUsrCod,
|
||||
|
@ -6983,23 +6983,23 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,
|
||||
WorksUsrCod);
|
||||
else
|
||||
sprintf (Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod);
|
||||
}
|
||||
else // Briefcase
|
||||
sprintf (Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders);
|
||||
DB_QueryUPDATE (Query,"can not update expanded folder");
|
||||
|
@ -7021,21 +7021,21 @@ static void Brw_RemoveFolderFromExpandedFolders (const char Path[PATH_MAX + 1])
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld' AND Path='%s/'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,WorksUsrCod,Path);
|
||||
else
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND Path='%s/'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,Path);
|
||||
}
|
||||
else // Briefcase
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
Path);
|
||||
|
@ -7058,21 +7058,21 @@ static void Brw_RemoveAffectedExpandedFolders (const char Path[PATH_MAX + 1])
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld' AND Path LIKE '%s/%%'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld AND Path LIKE '%s/%%'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,WorksUsrCod,Path);
|
||||
else
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND Path LIKE '%s/%%'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND Path LIKE '%s/%%'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,Path);
|
||||
}
|
||||
else // Briefcase
|
||||
sprintf (Query,"DELETE FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
Path);
|
||||
|
@ -7099,8 +7099,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
|
@ -7108,8 +7108,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
OldPath);
|
||||
else
|
||||
sprintf (Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||
|
@ -7120,8 +7120,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||
" AND WorksUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND WorksUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
(unsigned) FileBrowserForExpandedFolders,Cod,
|
||||
|
@ -7129,7 +7129,7 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
OldPath);
|
||||
else
|
||||
sprintf (Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
(unsigned) FileBrowserForExpandedFolders,Cod,
|
||||
|
@ -7138,7 +7138,7 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
}
|
||||
else // Briefcase
|
||||
sprintf (Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
MyUsrCod,
|
||||
|
@ -7163,8 +7163,8 @@ static bool Brw_GetIfExpandedTree (const char Path[PATH_MAX + 1])
|
|||
{
|
||||
if (WorksUsrCod > 0)
|
||||
sprintf (Query,"SELECT COUNT(*) FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld"
|
||||
" AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
|
@ -7172,8 +7172,8 @@ static bool Brw_GetIfExpandedTree (const char Path[PATH_MAX + 1])
|
|||
Path);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(*) FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" AND Cod='%ld'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld"
|
||||
" AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
|
@ -7182,7 +7182,7 @@ static bool Brw_GetIfExpandedTree (const char Path[PATH_MAX + 1])
|
|||
}
|
||||
else // Briefcase
|
||||
sprintf (Query,"SELECT COUNT(*) FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Path='%s/'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
|
@ -7288,21 +7288,21 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
case Brw_ADMI_DOCUM_INS:
|
||||
case Brw_ADMI_SHARE_INS:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Brw_ADMI_DOCUM_CTR:
|
||||
case Brw_ADMI_SHARE_CTR:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Brw_ADMI_DOCUM_DEG:
|
||||
case Brw_ADMI_SHARE_DEG:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
|
@ -7311,7 +7311,7 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
case Brw_ADMI_SHARE_CRS:
|
||||
case Brw_ADMI_MARKS_CRS:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -7320,27 +7320,27 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
case Brw_ADMI_SHARE_GRP:
|
||||
case Brw_ADMI_MARKS_GRP:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_ADMI_ASSIG_USR:
|
||||
case Brw_ADMI_WORKS_USR:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u AND Cod=%ld",
|
||||
MyUsrCod,(unsigned) FileBrowser,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
case Brw_ADMI_ASSIG_CRS:
|
||||
case Brw_ADMI_WORKS_CRS:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,WorksUsrCod);
|
||||
break;
|
||||
case Brw_ADMI_BRIEF_USR:
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u'",
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u",
|
||||
MyUsrCod,(unsigned) FileBrowser);
|
||||
break;
|
||||
default:
|
||||
|
@ -8908,7 +8908,7 @@ bool Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,const cha
|
|||
|
||||
/***** Get if a file or folder is hidden from database *****/
|
||||
sprintf (Query,"SELECT Hidden FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
|
@ -8947,7 +8947,7 @@ bool Brw_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata)
|
|||
2) the argument Path begins by 'x/', where x is a path stored in database
|
||||
*/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Hidden='Y'"
|
||||
" AND (Path='%s' OR LOCATE(CONCAT(Path,'/'),'%s')=1)",
|
||||
FileMetadata->FileBrowser,
|
||||
|
@ -9899,7 +9899,7 @@ long Brw_GetFilCodByPath (const char *Path,bool OnlyIfPublic)
|
|||
|
||||
/***** Get code of a file from database *****/
|
||||
sprintf (Query,"SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'%s",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
|
@ -9942,7 +9942,7 @@ void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata)
|
|||
sprintf (Query,"SELECT FilCod,FileBrowser,Cod,ZoneUsrCod,"
|
||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License"
|
||||
" FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
|
@ -10075,7 +10075,7 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
sprintf (Query,"SELECT FilCod,FileBrowser,Cod,ZoneUsrCod,"
|
||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License"
|
||||
" FROM files"
|
||||
" WHERE FilCod='%ld'",
|
||||
" WHERE FilCod=%ld",
|
||||
FileMetadata->FilCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get file metadata"))
|
||||
{
|
||||
|
@ -10289,7 +10289,7 @@ unsigned long Brw_GetNumFileViewsUsr (long UsrCod)
|
|||
unsigned long FileViews;
|
||||
|
||||
/***** Get number of filw views *****/
|
||||
sprintf (Query,"SELECT SUM(NumViews) FROM file_view WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT SUM(NumViews) FROM file_view WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get number of file views"))
|
||||
{
|
||||
|
@ -10329,7 +10329,7 @@ static void Brw_GetFileViewsFromLoggedUsrs (struct FileMetadata *FileMetadata)
|
|||
/***** Get number total of views from logged users *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod),SUM(NumViews)"
|
||||
" FROM file_view"
|
||||
" WHERE FilCod='%ld' AND UsrCod>'0'",
|
||||
" WHERE FilCod=%ld AND UsrCod>0",
|
||||
FileMetadata->FilCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get number of views of a file from logged users"))
|
||||
{
|
||||
|
@ -10370,7 +10370,7 @@ static void Brw_GetFileViewsFromNonLoggedUsrs (struct FileMetadata *FileMetadata
|
|||
|
||||
/***** Get number of public views *****/
|
||||
sprintf (Query,"SELECT SUM(NumViews) FROM file_view"
|
||||
" WHERE FilCod='%ld' AND UsrCod<='0'",
|
||||
" WHERE FilCod=%ld AND UsrCod<=0",
|
||||
FileMetadata->FilCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get number of public views of a file"))
|
||||
{
|
||||
|
@ -10404,7 +10404,7 @@ static unsigned Brw_GetFileViewsFromMe (long FilCod)
|
|||
|
||||
/***** Get number of my views *****/
|
||||
sprintf (Query,"SELECT NumViews FROM file_view"
|
||||
" WHERE FilCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE FilCod=%ld AND UsrCod=%ld",
|
||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get my number of views of a file"))
|
||||
|
@ -10435,7 +10435,7 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
|||
{
|
||||
/* Update number of views in database */
|
||||
sprintf (Query,"UPDATE file_view SET NumViews=NumViews+1"
|
||||
" WHERE FilCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE FilCod=%ld AND UsrCod=%ld",
|
||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update number of views of a file");
|
||||
}
|
||||
|
@ -10445,7 +10445,7 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
|||
sprintf (Query,"INSERT INTO file_view"
|
||||
" (FilCod,UsrCod,NumViews)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','1')",
|
||||
" (%ld,%ld,1)",
|
||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not insert number of views of a file");
|
||||
}
|
||||
|
@ -10463,7 +10463,7 @@ static bool Brw_GetIfFolderHasPublicFiles (const char Path[PATH_MAX + 1])
|
|||
|
||||
/***** Get if a file or folder is public from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%' AND Public='Y'",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
|
@ -10481,7 +10481,7 @@ unsigned Brw_GetNumFilesUsr (long UsrCod)
|
|||
|
||||
/***** Get current number of files published by a user from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM files"
|
||||
" WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')",
|
||||
" WHERE PublisherUsrCod=%ld AND FileType IN (%u,%u)",
|
||||
UsrCod,
|
||||
(unsigned) Brw_IS_FILE,
|
||||
(unsigned) Brw_IS_UNKNOWN); // Unknown entries are counted as files
|
||||
|
@ -10498,7 +10498,7 @@ unsigned Brw_GetNumPublicFilesUsr (long UsrCod)
|
|||
|
||||
/***** Get current number of public files published by a user from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM files"
|
||||
" WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')"
|
||||
" WHERE PublisherUsrCod=%ld AND FileType IN (%u,%u)"
|
||||
" AND Public='Y'",
|
||||
UsrCod,
|
||||
(unsigned) Brw_IS_FILE,
|
||||
|
@ -10518,7 +10518,7 @@ static void Brw_ChangeFileOrFolderHiddenInDB (const char Path[PATH_MAX + 1],bool
|
|||
|
||||
/***** Mark file as hidden in database *****/
|
||||
sprintf (Query,"UPDATE files SET Hidden='%c'"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
IsHidden ? 'Y' :
|
||||
'N',
|
||||
|
@ -10540,8 +10540,8 @@ static void Brw_ChangeFilePublicInDB (long PublisherUsrCod,const char *Path,
|
|||
char Query[512 + PATH_MAX];
|
||||
|
||||
/***** Change publisher, public and license of file in database *****/
|
||||
sprintf (Query,"UPDATE files SET PublisherUsrCod='%ld',Public='%c',License='%u'"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
sprintf (Query,"UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
PublisherUsrCod,
|
||||
IsPublic ? 'Y' :
|
||||
|
@ -10705,8 +10705,8 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
|||
" (FileBrowser,Cod,ZoneUsrCod,"
|
||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
|
||||
" VALUES"
|
||||
" ('%u','%ld','%ld',"
|
||||
"'%ld','%u','%s','N','%c','%u')",
|
||||
" (%u,%ld,%ld,"
|
||||
"%ld,%u,'%s','N','%c',%u)",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
PublisherUsrCod,
|
||||
|
@ -10740,7 +10740,7 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
FileBrowser == Brw_ADMI_MARKS_GRP)
|
||||
{
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld"
|
||||
" AND files.Path='%s'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
|
@ -10749,7 +10749,7 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.ZoneUsrCod=%ld"
|
||||
" AND files.Path='%s'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
|
@ -10757,7 +10757,7 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
|
||||
/***** Remove from database the entry that stores the data of a file *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
DB_QueryDELETE (Query,"can not remove path from database");
|
||||
|
@ -10785,7 +10785,7 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
FileBrowser == Brw_ADMI_MARKS_GRP)
|
||||
{
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld"
|
||||
" AND files.Path LIKE '%s/%%'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
|
@ -10794,7 +10794,7 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.ZoneUsrCod=%ld"
|
||||
" AND files.Path LIKE '%s/%%'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
|
@ -10802,7 +10802,7 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1])
|
|||
|
||||
/***** Remove from database the entries that store the data of files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
DB_QueryDELETE (Query,"can not remove paths from database");
|
||||
|
@ -10821,7 +10821,7 @@ static void Brw_RenameOneFolderInDB (const char OldPath[PATH_MAX + 1],
|
|||
|
||||
/***** Update file or folder in table of common files *****/
|
||||
sprintf (Query,"UPDATE files SET Path='%s'"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld' AND Path='%s'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'",
|
||||
NewPath,
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
|
@ -10843,7 +10843,7 @@ static void Brw_RenameChildrenFilesOrFoldersInDB (const char OldPath[PATH_MAX +
|
|||
|
||||
/***** Update children of a folder in table of files *****/
|
||||
sprintf (Query,"UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
|
@ -10970,7 +10970,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
|
|||
case Rol_STUDENT: // If I am a student, I can modify the file/folder if I am the publisher
|
||||
/***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND (Path='%s' OR Path LIKE '%s/%%')",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,
|
||||
|
|
|
@ -300,10 +300,10 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
"SELECT DISTINCT usr_follow.FollowedCod AS UsrCod"
|
||||
" FROM usr_follow,"
|
||||
"(SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld') AS my_followed,"
|
||||
" WHERE FollowerCod=%ld) AS my_followed,"
|
||||
" usr_data"
|
||||
" WHERE usr_follow.FollowerCod=my_followed.FollowedCod"
|
||||
" AND usr_follow.FollowedCod<>'%ld'"
|
||||
" AND usr_follow.FollowedCod<>%ld"
|
||||
" AND usr_follow.FollowedCod=usr_data.UsrCod"
|
||||
" AND usr_data.ProfileVisibility IN ('%s','%s')"
|
||||
" AND usr_data.Surname1<>''" // Surname 1 not empty
|
||||
|
@ -318,10 +318,10 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
"SELECT DISTINCT crs_usr.UsrCod"
|
||||
" FROM crs_usr,"
|
||||
"(SELECT CrsCod FROM crs_usr"
|
||||
" WHERE UsrCod='%ld') AS my_crs,"
|
||||
" WHERE UsrCod=%ld) AS my_crs,"
|
||||
" usr_data"
|
||||
" WHERE crs_usr.CrsCod=my_crs.CrsCod"
|
||||
" AND crs_usr.UsrCod<>'%ld'"
|
||||
" AND crs_usr.UsrCod<>%ld"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.ProfileVisibility IN ('%s','%s','%s')"
|
||||
" AND usr_data.Surname1<>''" // Surname 1 not empty
|
||||
|
@ -335,7 +335,7 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
"SELECT DISTINCT crs_usr.UsrCod"
|
||||
" FROM crs_usr,"
|
||||
"(SELECT CrsCod,Role FROM crs_usr"
|
||||
" WHERE UsrCod='%ld') AS my_crs_role,"
|
||||
" WHERE UsrCod=%ld) AS my_crs_role,"
|
||||
" usr_data"
|
||||
" WHERE crs_usr.CrsCod=my_crs_role.CrsCod"
|
||||
" AND crs_usr.Role<>my_crs_role.Role"
|
||||
|
@ -349,7 +349,7 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
// Do not select my followed
|
||||
" WHERE UsrCod NOT IN"
|
||||
" (SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld')"
|
||||
" WHERE FollowerCod=%ld)"
|
||||
// Get only MaxUsrsToShow * 2 users
|
||||
" ORDER BY RAND() LIMIT %u"
|
||||
")"
|
||||
|
@ -359,7 +359,7 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
// Add some likely unknown random users with privacy
|
||||
// Pri_VISIBILITY_SYSTEM or Pri_VISIBILITY_WORLD
|
||||
"SELECT UsrCod FROM usr_data"
|
||||
" WHERE UsrCod<>'%ld'"
|
||||
" WHERE UsrCod<>%ld"
|
||||
" AND ProfileVisibility IN ('%s','%s')"
|
||||
" AND Surname1<>''" // Surname 1 not empty
|
||||
" AND FirstName<>''" // First name not empty
|
||||
|
@ -367,7 +367,7 @@ static unsigned Fol_GetUsrsWhoToFollow (unsigned MaxUsrsToShow,
|
|||
// Do not select my followed
|
||||
" AND UsrCod NOT IN"
|
||||
" (SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld')"
|
||||
" WHERE FollowerCod=%ld)"
|
||||
// Get only MaxUsrsToShow users
|
||||
" ORDER BY RAND() LIMIT %u"
|
||||
")"
|
||||
|
@ -447,7 +447,7 @@ bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod)
|
|||
|
||||
/***** Check if a user is a follower of another user *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld' AND FollowedCod='%ld'",
|
||||
" WHERE FollowerCod=%ld AND FollowedCod=%ld",
|
||||
FollowerCod,FollowedCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get if a user is a follower of another one") != 0);
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ unsigned Fol_GetNumFollowing (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Check if a user is a follower of another user *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowerCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowerCod=%ld",
|
||||
UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get number of followed");
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ unsigned Fol_GetNumFollowers (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Check if a user is a follower of another user *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowedCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowedCod=%ld",
|
||||
UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get number of followers");
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ static void Fol_ListFollowingUsr (struct UsrData *UsrDat)
|
|||
{
|
||||
/***** Check if a user is a follower of another user *****/
|
||||
sprintf (Query,"SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld' ORDER BY FollowTime DESC",
|
||||
" WHERE FollowerCod=%ld ORDER BY FollowTime DESC",
|
||||
UsrDat->UsrCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get followed users");
|
||||
if (NumUsrs)
|
||||
|
@ -758,7 +758,7 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
|||
{
|
||||
/***** Check if a user is a follower of another user *****/
|
||||
sprintf (Query,"SELECT FollowerCod FROM usr_follow"
|
||||
" WHERE FollowedCod='%ld' ORDER BY FollowTime DESC",
|
||||
" WHERE FollowedCod=%ld ORDER BY FollowTime DESC",
|
||||
UsrDat->UsrCod);
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get followers");
|
||||
if (NumUsrs)
|
||||
|
@ -1013,7 +1013,7 @@ void Fol_FollowUsr1 (void)
|
|||
sprintf (Query,"REPLACE INTO usr_follow"
|
||||
" (FollowerCod,FollowedCod,FollowTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW())",
|
||||
" (%ld,%ld,NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not follow user");
|
||||
|
@ -1064,7 +1064,7 @@ void Fol_UnfollowUsr1 (void)
|
|||
{
|
||||
/***** Follow user in database *****/
|
||||
sprintf (Query,"DELETE FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld' AND FollowedCod='%ld'",
|
||||
" WHERE FollowerCod=%ld AND FollowedCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not unfollow user");
|
||||
|
@ -1112,7 +1112,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT usr_follow.FollowedCod,COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_follow"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -1125,7 +1125,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT usr_follow.FollowedCod,COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_follow"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -1137,7 +1137,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT usr_follow.FollowedCod,COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM degrees,courses,crs_usr,usr_follow"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_follow.FollowedCod"
|
||||
|
@ -1148,7 +1148,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT usr_follow.FollowedCod,COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM courses,crs_usr,usr_follow"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_follow.FollowedCod"
|
||||
" GROUP BY usr_follow.FollowedCod"
|
||||
|
@ -1158,7 +1158,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT usr_follow.FollowedCod,COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM crs_usr,usr_follow"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=usr_follow.FollowedCod"
|
||||
" GROUP BY usr_follow.FollowedCod"
|
||||
" ORDER BY N DESC,usr_follow.FollowedCod LIMIT 100",
|
||||
|
@ -1194,7 +1194,7 @@ void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
sprintf (Query,"DELETE FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld' OR FollowedCod='%ld'",
|
||||
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from followers and followed");
|
||||
}
|
||||
|
|
402
swad_forum.c
402
swad_forum.c
File diff suppressed because it is too large
Load Diff
|
@ -294,6 +294,7 @@ void Gbl_InitializeGlobals (void)
|
|||
|
||||
Gbl.Degs.DegTypes.Num = 0;
|
||||
Gbl.Degs.DegTypes.Lst = NULL;
|
||||
Gbl.Degs.DegTypes.SelectedOrder = DT_ORDER_DEFAULT;
|
||||
|
||||
Gbl.Degs.EditingDegTyp.DegTypCod = -1L;
|
||||
Gbl.Degs.EditingDegTyp.DegTypName[0] = '\0';
|
||||
|
|
|
@ -258,6 +258,7 @@ struct Globals
|
|||
{
|
||||
unsigned Num; // Number of degree types
|
||||
struct DegreeType *Lst; // List of degree types
|
||||
DT_Order_t SelectedOrder;
|
||||
} DegTypes;
|
||||
struct DegreeType EditingDegTyp;
|
||||
struct Degree EditingDeg;
|
||||
|
|
140
swad_group.c
140
swad_group.c
|
@ -1003,9 +1003,9 @@ void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Q
|
|||
|
||||
/***** Remove user from all the groups of the course *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr"
|
||||
" WHERE UsrCod='%ld' AND GrpCod IN"
|
||||
" WHERE UsrCod=%ld AND GrpCod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
UsrDat->UsrCod,Crs->CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from all groups of a course");
|
||||
|
@ -1029,7 +1029,7 @@ void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrV
|
|||
char Query[128];
|
||||
|
||||
/***** Remove user from all groups *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from the groups he/she belongs to");
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
|||
|
||||
/***** Remove user from group *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr"
|
||||
" WHERE GrpCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
||||
GrpCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from a group");
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
|
|||
sprintf (Query,"INSERT INTO crs_grp_usr"
|
||||
" (GrpCod,UsrCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
GrpCod,UsrDat->UsrCod);
|
||||
DB_QueryINSERT (Query,"can not add a user to a group");
|
||||
}
|
||||
|
@ -2281,7 +2281,7 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
"UNIX_TIMESTAMP(crs_grp_types.OpenTime),"
|
||||
"COUNT(crs_grp.GrpCod)"
|
||||
" FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" GROUP BY crs_grp_types.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName",
|
||||
|
@ -2294,7 +2294,7 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
"UNIX_TIMESTAMP(crs_grp_types.OpenTime),"
|
||||
"COUNT(crs_grp.GrpCod)"
|
||||
" FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" GROUP BY crs_grp_types.GrpTypCod)"
|
||||
" UNION "
|
||||
|
@ -2302,8 +2302,8 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
"Mandatory,Multiple,"
|
||||
"MustBeOpened,"
|
||||
"UNIX_TIMESTAMP(OpenTime),"
|
||||
"'0'"
|
||||
" FROM crs_grp_types WHERE CrsCod='%ld'"
|
||||
"0"
|
||||
" FROM crs_grp_types WHERE CrsCod=%ld"
|
||||
" AND GrpTypCod NOT IN (SELECT GrpTypCod FROM crs_grp))"
|
||||
" ORDER BY GrpTypName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -2382,7 +2382,7 @@ void Grp_OpenGroupsAutomatically (void)
|
|||
|
||||
/***** Find group types to be opened *****/
|
||||
sprintf (Query,"SELECT GrpTypCod FROM crs_grp_types"
|
||||
" WHERE CrsCod='%ld' AND MustBeOpened='Y'"
|
||||
" WHERE CrsCod=%ld AND MustBeOpened='Y'"
|
||||
" AND OpenTime<=NOW()",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumGrpTypes = (unsigned) DB_QuerySELECT (Query,&mysql_res,
|
||||
|
@ -2399,13 +2399,13 @@ void Grp_OpenGroupsAutomatically (void)
|
|||
/***** Open all the closed groups in this course the must be opened
|
||||
and with open time in the past ****/
|
||||
sprintf (Query,"UPDATE crs_grp SET Open='Y'"
|
||||
" WHERE GrpTypCod='%ld' AND Open='N'",
|
||||
" WHERE GrpTypCod=%ld AND Open='N'",
|
||||
GrpTypCod);
|
||||
DB_QueryUPDATE (Query,"can not open groups");
|
||||
|
||||
/***** To not try to open groups again, set MustBeOpened to false *****/
|
||||
sprintf (Query,"UPDATE crs_grp_types SET MustBeOpened='N'"
|
||||
" WHERE GrpTypCod='%ld'",
|
||||
" WHERE GrpTypCod=%ld",
|
||||
GrpTypCod);
|
||||
DB_QueryUPDATE (Query,"can not update the opening of a type of group");
|
||||
}
|
||||
|
@ -2532,7 +2532,7 @@ unsigned Grp_CountNumGrpsInCurrentCrs (void)
|
|||
|
||||
/***** Get number of group in current course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of groups in this course");
|
||||
|
@ -2547,7 +2547,7 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of groups of a type from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp WHERE GrpTypCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp WHERE GrpTypCod=%ld",
|
||||
GrpTypCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of groups of a type");
|
||||
}
|
||||
|
@ -2563,7 +2563,7 @@ unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
|
|||
/***** Get groups of a type from database *****/
|
||||
sprintf (Query,"SELECT GrpCod,GrpName,MaxStudents,Open,FileZones"
|
||||
" FROM crs_grp"
|
||||
" WHERE GrpTypCod='%ld'"
|
||||
" WHERE GrpTypCod=%ld"
|
||||
" ORDER BY GrpName",
|
||||
GrpTypCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,"can not get groups of a type");
|
||||
|
@ -2584,7 +2584,7 @@ static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp)
|
|||
/***** Get data of a type of group from database *****/
|
||||
sprintf (Query,"SELECT GrpTypName,Mandatory,Multiple,MustBeOpened,UNIX_TIMESTAMP(OpenTime)"
|
||||
" FROM crs_grp_types"
|
||||
" WHERE CrsCod='%ld' AND GrpTypCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,GrpTyp->GrpTypCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get type of group");
|
||||
|
||||
|
@ -2617,7 +2617,7 @@ static bool Grp_GetMultipleEnrollmentOfAGroupType (long GrpTypCod)
|
|||
bool MultipleEnrollment;
|
||||
|
||||
/***** Get data of a type of group from database *****/
|
||||
sprintf (Query,"SELECT Multiple FROM crs_grp_types WHERE GrpTypCod='%ld'",
|
||||
sprintf (Query,"SELECT Multiple FROM crs_grp_types WHERE GrpTypCod=%ld",
|
||||
GrpTypCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get if type of group has multiple enrollment") != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting type of group.");
|
||||
|
@ -2662,7 +2662,7 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
|
|||
"crs_grp.GrpName,crs_grp.MaxStudents,"
|
||||
"crs_grp.Open,crs_grp.FileZones"
|
||||
" FROM crs_grp,crs_grp_types"
|
||||
" WHERE crs_grp.GrpCod='%ld'"
|
||||
" WHERE crs_grp.GrpCod=%ld"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod",
|
||||
GrpDat->GrpCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a group");
|
||||
|
@ -2718,7 +2718,7 @@ static long Grp_GetTypeOfGroupOfAGroup (long GrpCod)
|
|||
long GrpTypCod;
|
||||
|
||||
/***** Get data of a group from database *****/
|
||||
sprintf (Query,"SELECT GrpTypCod FROM crs_grp WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"SELECT GrpTypCod FROM crs_grp WHERE GrpCod=%ld",
|
||||
GrpCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the type of a group") != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting group.");
|
||||
|
@ -2744,7 +2744,7 @@ bool Grp_CheckIfGroupExists (long GrpCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get if a group exists from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp WHERE GrpCod='%ld'",GrpCod);
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp WHERE GrpCod=%ld",GrpCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a group exists") != 0);
|
||||
}
|
||||
|
||||
|
@ -2758,9 +2758,9 @@ bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod)
|
|||
|
||||
/***** Get if a group exists from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp,crs_grp_types"
|
||||
" WHERE crs_grp.GrpCod='%ld'"
|
||||
" WHERE crs_grp.GrpCod=%ld"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp_types.CrsCod='%ld'",
|
||||
" AND crs_grp_types.CrsCod=%ld",
|
||||
GrpCod,CrsCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a group belongs to a course") != 0);
|
||||
}
|
||||
|
@ -2776,12 +2776,12 @@ unsigned Grp_CountNumStdsInGrp (long GrpCod)
|
|||
/***** Get number of students in a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM crs_grp_usr,crs_grp,crs_grp_types,crs_usr"
|
||||
" WHERE crs_grp_usr.GrpCod='%ld'"
|
||||
" WHERE crs_grp_usr.GrpCod=%ld"
|
||||
" AND crs_grp_usr.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
GrpCod,(unsigned) Rol_STUDENT);
|
||||
return (unsigned) DB_QueryCOUNT (Query,
|
||||
"can not get number of students in a group");
|
||||
|
@ -2800,11 +2800,11 @@ static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod)
|
|||
|
||||
/***** Get number of students not belonging to groups of a type from database ******/
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND Role='%u'"
|
||||
" WHERE CrsCod=%ld AND Role=%u"
|
||||
" AND UsrCod NOT IN"
|
||||
" (SELECT DISTINCT crs_grp_usr.UsrCod"
|
||||
" FROM crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_STUDENT,GrpTypCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type");
|
||||
|
@ -2835,9 +2835,9 @@ static long Grp_GetFirstCodGrpStdBelongsTo (long GrpTypCod,long UsrCod)
|
|||
|
||||
/***** Get a group which a user belong to from database *****/
|
||||
sprintf (Query,"SELECT crs_grp.GrpCod FROM crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld'",
|
||||
" AND crs_grp_usr.UsrCod=%ld",
|
||||
GrpTypCod,UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the group which a user belongs to");
|
||||
|
||||
|
@ -2870,7 +2870,7 @@ bool Grp_GetIfIBelongToGrp (long GrpCod)
|
|||
|
||||
/***** Get if I belong to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp_usr"
|
||||
" WHERE GrpCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
||||
GrpCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if you belong to a group") != 0);
|
||||
}
|
||||
|
@ -2892,24 +2892,24 @@ unsigned Grp_NumGrpTypesMandatIDontBelong (void)
|
|||
"COUNT(*) AS NumStudents,"
|
||||
"crs_grp.MaxStudents as MaxStudents"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr,crs_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'"
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_grp.GrpCod"
|
||||
" HAVING NumStudents<MaxStudents) AS grp_types_open_not_full"
|
||||
" WHERE GrpTypCod NOT IN"
|
||||
" (SELECT DISTINCT crs_grp_types.GrpTypCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld')",
|
||||
" AND crs_grp_usr.UsrCod=%ld)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Rol_STUDENT,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -2935,13 +2935,13 @@ static bool Grp_GetIfGrpIsAvailable (long GrpTypCod)
|
|||
"COUNT(*) AS NumStudents,"
|
||||
"crs_grp.MaxStudents as MaxStudents"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr,crs_usr"
|
||||
" WHERE crs_grp_types.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp_types.GrpTypCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'"
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_grp.GrpCod"
|
||||
" HAVING NumStudents<MaxStudents) AS available_grp_types",
|
||||
GrpTypCod,(unsigned) Rol_STUDENT);
|
||||
|
@ -2968,25 +2968,25 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod,
|
|||
if (CrsCod < 0) // Query the groups from all the user's courses
|
||||
sprintf (Query,"SELECT GrpCod"
|
||||
" FROM crs_grp_usr"
|
||||
" WHERE UsrCod='%ld'", // Groups will be unordered
|
||||
" WHERE UsrCod=%ld", // Groups will be unordered
|
||||
UsrCod);
|
||||
else if (GrpTypCod < 0) // Query the groups of any type in the course
|
||||
sprintf (Query,"SELECT crs_grp.GrpCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod=%ld"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
else // Query only the groups of specified type in the course
|
||||
sprintf (Query,"SELECT crs_grp.GrpCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" AND crs_grp_types.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod=%ld"
|
||||
" ORDER BY crs_grp.GrpName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,GrpTypCod,UsrCod);
|
||||
LstGrps->NumGrps = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get the groups which a user belongs to");
|
||||
|
@ -3027,11 +3027,11 @@ void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps)
|
|||
/***** Get groups which I belong to from database *****/
|
||||
sprintf (Query,"SELECT crs_grp.GrpCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.FileZones='Y'"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod=%ld"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
LstGrps->NumGrps = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get the groups which I belong to");
|
||||
|
@ -3089,9 +3089,9 @@ void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GroupNames)
|
|||
|
||||
/***** Get the names of groups which a user belongs to, from database *****/
|
||||
sprintf (Query,"SELECT crs_grp.GrpName FROM crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod=%ld"
|
||||
" ORDER BY crs_grp.GrpName",
|
||||
GrpTypCod,UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the names of groups a user belongs to");
|
||||
|
@ -3235,8 +3235,8 @@ static bool Grp_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCo
|
|||
|
||||
/***** Get number of group types with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp_types"
|
||||
" WHERE CrsCod='%ld' AND GrpTypName='%s'"
|
||||
" AND GrpTypCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND GrpTypName='%s'"
|
||||
" AND GrpTypCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,GrpTypName,GrpTypCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of type of group already existed") != 0);
|
||||
}
|
||||
|
@ -3251,7 +3251,7 @@ static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long
|
|||
|
||||
/***** Get number of groups with a type and a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp"
|
||||
" WHERE GrpTypCod='%ld' AND GrpName='%s' AND GrpCod<>'%ld'",
|
||||
" WHERE GrpTypCod=%ld AND GrpName='%s' AND GrpCod<>%ld",
|
||||
GrpTypCod,GrpName,GrpCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of group already existed") != 0);
|
||||
}
|
||||
|
@ -3269,7 +3269,7 @@ static void Grp_CreateGroupType (void)
|
|||
sprintf (Query,"INSERT INTO crs_grp_types"
|
||||
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%c','%c','%c',FROM_UNIXTIME('%ld'))",
|
||||
" (%ld,'%s','%c','%c','%c',FROM_UNIXTIME(%ld))",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment ? 'Y' :
|
||||
'N',
|
||||
|
@ -3299,7 +3299,7 @@ static void Grp_CreateGroup (void)
|
|||
sprintf (Query,"INSERT INTO crs_grp"
|
||||
" (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%u','N','N')",
|
||||
" (%ld,'%s',%u,'N','N')",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,
|
||||
Gbl.CurrentCrs.Grps.GrpName,
|
||||
Gbl.CurrentCrs.Grps.MaxStudents);
|
||||
|
@ -3467,25 +3467,25 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
|||
Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** Change all groups of this type in course timetable *****/
|
||||
sprintf (Query,"UPDATE timetable_crs SET GrpCod='-1'"
|
||||
sprintf (Query,"UPDATE timetable_crs SET GrpCod=-1"
|
||||
" WHERE GrpCod IN"
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod='%ld')",
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE (Query,"can not update all groups of a type in course timetable");
|
||||
|
||||
/***** Remove all the students in groups of this type *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod='%ld')",
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove users from all groups of a type");
|
||||
|
||||
/***** Remove all the groups of this type *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp WHERE GrpTypCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_grp WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove groups of a type");
|
||||
|
||||
/***** Remove the group type *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_types WHERE GrpTypCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_grp_types WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove a type of group");
|
||||
|
||||
|
@ -3525,17 +3525,17 @@ static void Grp_RemoveGroupCompletely (void)
|
|||
Svy_RemoveGroup (GrpDat.GrpCod);
|
||||
|
||||
/***** Change this group in course timetable *****/
|
||||
sprintf (Query,"UPDATE timetable_crs SET GrpCod='-1' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not update a group in course timetable");
|
||||
|
||||
/***** Remove all the students in this group *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove users from a group");
|
||||
|
||||
/***** Remove the group *****/
|
||||
sprintf (Query,"DELETE FROM crs_grp WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_grp WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove a group");
|
||||
|
||||
|
@ -3567,7 +3567,7 @@ void Grp_OpenGroup (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing open/close status *****/
|
||||
sprintf (Query,"UPDATE crs_grp SET Open='Y' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not open a group");
|
||||
|
||||
|
@ -3600,7 +3600,7 @@ void Grp_CloseGroup (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing open/close status *****/
|
||||
sprintf (Query,"UPDATE crs_grp SET Open='N' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not close a group");
|
||||
|
||||
|
@ -3633,7 +3633,7 @@ void Grp_EnableFileZonesGrp (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing file zones status *****/
|
||||
sprintf (Query,"UPDATE crs_grp SET FileZones='Y' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not enable file zones of a group");
|
||||
|
||||
|
@ -3666,7 +3666,7 @@ void Grp_DisableFileZonesGrp (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing file zones status *****/
|
||||
sprintf (Query,"UPDATE crs_grp SET FileZones='N' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not disable file zones of a group");
|
||||
|
||||
|
@ -3714,7 +3714,7 @@ void Grp_ChangeGroupType (void)
|
|||
else
|
||||
{
|
||||
/* Update the table of groups changing old type by new type */
|
||||
sprintf (Query,"UPDATE crs_grp SET GrpTypCod='%ld' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
|
||||
NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not update the type of a group");
|
||||
|
||||
|
@ -3763,7 +3763,7 @@ void Grp_ChangeMandatGrpTyp (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of types of group changing the old type of enrollment by the new *****/
|
||||
sprintf (Query,"UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
|
||||
NewMandatoryEnrollment ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
@ -3817,7 +3817,7 @@ void Grp_ChangeMultiGrpTyp (void)
|
|||
{
|
||||
/***** Update of the table of types of group changing the old type of enrollment by the new *****/
|
||||
sprintf (Query,"UPDATE crs_grp_types SET Multiple='%c'"
|
||||
" WHERE GrpTypCod='%ld'",
|
||||
" WHERE GrpTypCod=%ld",
|
||||
NewMultipleEnrollment ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
@ -3859,8 +3859,8 @@ void Grp_ChangeOpenTimeGrpTyp (void)
|
|||
/***** Update the table of types of group
|
||||
changing the old open time of enrollment by the new *****/
|
||||
sprintf (Query,"UPDATE crs_grp_types"
|
||||
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME('%ld')"
|
||||
" WHERE GrpTypCod='%ld'",
|
||||
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
||||
'N',
|
||||
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC,
|
||||
|
@ -3913,7 +3913,7 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
else
|
||||
{
|
||||
/***** Update the table of groups changing the old maximum of students to the new *****/
|
||||
sprintf (Query,"UPDATE crs_grp SET MaxStudents='%u' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld",
|
||||
NewMaxStds,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not update the maximum number of students in a group");
|
||||
|
||||
|
@ -4006,7 +4006,7 @@ void Grp_RenameGroupType (void)
|
|||
{
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE crs_grp_types SET GrpTypName='%s'"
|
||||
" WHERE GrpTypCod='%ld'",
|
||||
" WHERE GrpTypCod=%ld",
|
||||
NewNameGrpTyp,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE (Query,"can not update the type of a group");
|
||||
|
@ -4079,7 +4079,7 @@ void Grp_RenameGroup (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE crs_grp SET GrpName='%s' WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
|
||||
NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a group");
|
||||
|
||||
|
|
|
@ -268,17 +268,17 @@ void Hld_GetListHolidays (void)
|
|||
"DATE_FORMAT(holidays.EndDate,'%%Y%%m%%d') AS EndDate,"
|
||||
"holidays.Name"
|
||||
" FROM holidays,places"
|
||||
" WHERE holidays.InsCod='%ld'"
|
||||
" WHERE holidays.InsCod=%ld"
|
||||
" AND holidays.PlcCod=places.PlcCod"
|
||||
" AND places.InsCod='%ld')"
|
||||
" AND places.InsCod=%ld)"
|
||||
" UNION "
|
||||
"(SELECT HldCod,PlcCod,'' as Place,HldTyp,"
|
||||
"DATE_FORMAT(StartDate,'%%Y%%m%%d') AS StartDate,"
|
||||
"DATE_FORMAT(EndDate,'%%Y%%m%%d') AS EndDate,Name"
|
||||
" FROM holidays"
|
||||
" WHERE InsCod='%ld'"
|
||||
" WHERE InsCod=%ld"
|
||||
" AND PlcCod NOT IN"
|
||||
"(SELECT DISTINCT PlcCod FROM places WHERE InsCod='%ld'))"
|
||||
"(SELECT DISTINCT PlcCod FROM places WHERE InsCod=%ld))"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -373,19 +373,19 @@ static void Hld_GetDataOfHolidayByCod (struct Holiday *Hld)
|
|||
"DATE_FORMAT(holidays.StartDate,'%%Y%%m%%d'),"
|
||||
"DATE_FORMAT(holidays.EndDate,'%%Y%%m%%d'),holidays.Name"
|
||||
" FROM holidays,places"
|
||||
" WHERE holidays.HldCod='%ld'"
|
||||
" AND holidays.InsCod='%ld'"
|
||||
" WHERE holidays.HldCod=%ld"
|
||||
" AND holidays.InsCod=%ld"
|
||||
" AND holidays.PlcCod=places.PlcCod"
|
||||
" AND places.InsCod='%ld')"
|
||||
" AND places.InsCod=%ld)"
|
||||
" UNION "
|
||||
"(SELECT PlcCod,'' as Place,HldTyp,"
|
||||
"DATE_FORMAT(StartDate,'%%Y%%m%%d'),"
|
||||
"DATE_FORMAT(EndDate,'%%Y%%m%%d'),Name"
|
||||
" FROM holidays"
|
||||
" WHERE HldCod='%ld'"
|
||||
" AND InsCod='%ld'"
|
||||
" WHERE HldCod=%ld"
|
||||
" AND InsCod=%ld"
|
||||
" AND PlcCod NOT IN"
|
||||
"(SELECT DISTINCT PlcCod FROM places WHERE InsCod='%ld'))",
|
||||
"(SELECT DISTINCT PlcCod FROM places WHERE InsCod=%ld))",
|
||||
Hld->HldCod,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -642,7 +642,7 @@ void Hld_RemoveHoliday (void)
|
|||
Hld_GetDataOfHolidayByCod (&Hld);
|
||||
|
||||
/***** Remove holiday *****/
|
||||
sprintf (Query,"DELETE FROM holidays WHERE HldCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM holidays WHERE HldCod=%ld",
|
||||
Hld.HldCod);
|
||||
DB_QueryDELETE (Query,"can not remove a holiday");
|
||||
|
||||
|
@ -683,7 +683,7 @@ void Hld_ChangeHolidayPlace (void)
|
|||
Hld_GetDataOfHolidayByCod (Hld);
|
||||
|
||||
/***** Update the place in database *****/
|
||||
sprintf (Query,"UPDATE holidays SET PlcCod='%ld' WHERE HldCod='%ld'",
|
||||
sprintf (Query,"UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
|
||||
NewPlace.PlcCod,Hld->HldCod);
|
||||
DB_QueryUPDATE (Query,"can not update the place of a holiday");
|
||||
|
||||
|
@ -723,8 +723,8 @@ void Hld_ChangeHolidayType (void)
|
|||
|
||||
/***** Update holiday/no school period in database *****/
|
||||
Dat_AssignDate (&Hld->EndDate,&Hld->StartDate);
|
||||
sprintf (Query,"UPDATE holidays SET HldTyp='%u',EndDate=StartDate"
|
||||
" WHERE HldCod='%ld'",
|
||||
sprintf (Query,"UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
|
||||
" WHERE HldCod=%ld",
|
||||
(unsigned) Hld->HldTyp,Hld->HldCod);
|
||||
DB_QueryUPDATE (Query,"can not update the type of a holiday");
|
||||
|
||||
|
@ -812,7 +812,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
|||
}
|
||||
|
||||
/***** Update the date in database *****/
|
||||
sprintf (Query,"UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod='%ld'",
|
||||
sprintf (Query,"UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
|
||||
StrStartOrEndDate,
|
||||
NewDate.Year,
|
||||
NewDate.Month,
|
||||
|
@ -872,7 +872,7 @@ void Hld_RenameHoliday (void)
|
|||
{
|
||||
/***** If degree was in database... *****/
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE holidays SET Name='%s' WHERE HldCod='%ld'",
|
||||
sprintf (Query,"UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
|
||||
NewHldName,Hld->HldCod);
|
||||
DB_QueryUPDATE (Query,"can not update the text of a holiday");
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ static void Hld_CreateHoliday (struct Holiday *Hld)
|
|||
sprintf (Query,"INSERT INTO holidays"
|
||||
" (InsCod,PlcCod,HldTyp,StartDate,EndDate,Name)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%04u%02u%02u','%04u%02u%02u','%s')",
|
||||
" (%ld,%ld,%u,'%04u%02u%02u','%04u%02u%02u','%s')",
|
||||
Gbl.CurrentIns.Ins.InsCod,Hld->PlcCod,(unsigned) Hld->HldTyp,
|
||||
Hld->StartDate.Year,
|
||||
Hld->StartDate.Month,
|
||||
|
|
|
@ -131,7 +131,7 @@ void Ico_ChangeIconSet (void)
|
|||
/***** Store icon set in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_data SET IconSet='%s' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about icon set");
|
||||
|
|
|
@ -325,12 +325,12 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DegTypCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.DegTypCod='%ld'"
|
||||
" WHERE degrees.DegTypCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.Stat.DegTypCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -340,9 +340,9 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
(unsigned) Rol_TEACHER,
|
||||
Gbl.Stat.DptCod);
|
||||
|
@ -352,7 +352,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DegTypCod > 0)
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses"
|
||||
" WHERE degrees.DegTypCod='%ld'"
|
||||
" WHERE degrees.DegTypCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.Stat.DegTypCod);
|
||||
|
@ -367,14 +367,14 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DptCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -382,7 +382,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
else
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM institutions,centres,degrees,courses"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -393,13 +393,13 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DptCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -407,7 +407,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
else
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM centres,degrees,courses"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
|
@ -417,12 +417,12 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DptCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -430,7 +430,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
else
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
@ -439,12 +439,12 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DptCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.DegCod='%ld'"
|
||||
" WHERE degrees.DegCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
|
@ -452,7 +452,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
else
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses"
|
||||
" WHERE degrees.DegCod='%ld'"
|
||||
" WHERE degrees.DegCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -461,13 +461,13 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
if (Gbl.Stat.DptCod > 0)
|
||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE courses.CrsCod='%ld'"
|
||||
" WHERE courses.CrsCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.DptCod=%ld"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -476,7 +476,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
|||
else
|
||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||
" FROM degrees,courses"
|
||||
" WHERE courses.CrsCod='%ld'"
|
||||
" WHERE courses.CrsCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" ORDER BY degrees.FullName,courses.FullName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -1384,7 +1384,7 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
|||
int NumIndicatorsFromDB = -1; // -1 means not yet calculated
|
||||
|
||||
/***** Get number of indicators of a course from database *****/
|
||||
sprintf (Query,"SELECT NumIndicators FROM courses WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT NumIndicators FROM courses WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get number of indicators"))
|
||||
{
|
||||
|
@ -1411,7 +1411,7 @@ static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
|||
char Query[128];
|
||||
|
||||
/***** Store number of indicators of a course in database *****/
|
||||
sprintf (Query,"UPDATE courses SET NumIndicators='%u' WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
||||
NumIndicators,CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not store number of indicators of a course");
|
||||
}
|
||||
|
@ -1504,12 +1504,12 @@ static unsigned long Ind_GetNumFilesInDocumZonesOfCrsFromDB (long CrsCod)
|
|||
sprintf (Query,"SELECT"
|
||||
" (SELECT COALESCE(SUM(NumFiles),0)"
|
||||
" FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld') +"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
||||
" (SELECT COALESCE(SUM(file_browser_size.NumFiles),0)"
|
||||
" FROM crs_grp_types,crs_grp,file_browser_size"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND file_browser_size.FileBrowser='%u'"
|
||||
" AND file_browser_size.FileBrowser=%u"
|
||||
" AND file_browser_size.Cod=crs_grp.GrpCod)",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_DOCUM_CRS],
|
||||
CrsCod,
|
||||
|
@ -1546,12 +1546,12 @@ static unsigned long Ind_GetNumFilesInShareZonesOfCrsFromDB (long CrsCod)
|
|||
sprintf (Query,"SELECT"
|
||||
" (SELECT COALESCE(SUM(NumFiles),0)"
|
||||
" FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld') +"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
||||
" (SELECT COALESCE(SUM(file_browser_size.NumFiles),0)"
|
||||
" FROM crs_grp_types,crs_grp,file_browser_size"
|
||||
" WHERE crs_grp_types.CrsCod='%ld'"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND file_browser_size.FileBrowser='%u'"
|
||||
" AND file_browser_size.FileBrowser=%u"
|
||||
" AND file_browser_size.Cod=crs_grp.GrpCod)",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_SHARE_CRS],
|
||||
CrsCod,
|
||||
|
@ -1587,7 +1587,7 @@ static unsigned long Ind_GetNumFilesInAssigZonesOfCrsFromDB (long CrsCod)
|
|||
/***** Get number of files in document zones of a course from database *****/
|
||||
sprintf (Query,"SELECT COALESCE(SUM(NumFiles),0)"
|
||||
" FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_ASSIG_USR],
|
||||
CrsCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get the number of files");
|
||||
|
@ -1620,7 +1620,7 @@ static unsigned long Ind_GetNumFilesInWorksZonesOfCrsFromDB (long CrsCod)
|
|||
/***** Get number of files in document zones of a course from database *****/
|
||||
sprintf (Query,"SELECT COALESCE(SUM(NumFiles),0)"
|
||||
" FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_WORKS_USR],
|
||||
CrsCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get the number of files");
|
||||
|
|
30
swad_info.c
30
swad_info.c
|
@ -516,7 +516,7 @@ static bool Inf_CheckIfIHaveReadInfo (void)
|
|||
|
||||
/***** Get if info source is already stored in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_info_read"
|
||||
" WHERE UsrCod='%ld' AND CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
@ -543,10 +543,10 @@ bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void)
|
|||
|
||||
/***** Get info types where students must read info *****/
|
||||
sprintf (Query,"SELECT InfoType FROM crs_info_src"
|
||||
" WHERE CrsCod='%ld' AND MustBeRead='Y'"
|
||||
" WHERE CrsCod=%ld AND MustBeRead='Y'"
|
||||
" AND InfoType NOT IN"
|
||||
" (SELECT InfoType FROM crs_info_read"
|
||||
" WHERE UsrCod='%ld' AND CrsCod='%ld')",
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get if you must read any course info");
|
||||
|
@ -691,7 +691,7 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
|||
|
||||
/***** Insert or replace info source for a specific type of course information *****/
|
||||
sprintf (Query,"UPDATE crs_info_src SET MustBeRead='%c'"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
MustBeRead ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
@ -712,7 +712,7 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
|||
sprintf (Query,"REPLACE INTO crs_info_read"
|
||||
" (UsrCod,CrsCod,InfoType)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%s')",
|
||||
" (%ld,%ld,'%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
@ -722,7 +722,7 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
|||
{
|
||||
/***** Remove I have read course information *****/
|
||||
sprintf (Query,"DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod='%ld' AND CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
@ -740,7 +740,7 @@ void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod)
|
|||
|
||||
/***** Remove user's status about reading of course information *****/
|
||||
sprintf (Query,"DELETE FROM crs_info_read"
|
||||
" WHERE UsrCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld",
|
||||
UsrCod,CrsCod);
|
||||
DB_QueryDELETE (Query,"can not set that I have not read course info");
|
||||
}
|
||||
|
@ -1461,20 +1461,20 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
|||
|
||||
/***** Get if info source is already stored in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_info_src"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
if (DB_QueryCOUNT (Query,"can not get if info source is already stored in database")) // Info is already stored in database, so update it
|
||||
{ // Update info source
|
||||
if (InfoSrc == Inf_INFO_SRC_NONE)
|
||||
sprintf (Query,"UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
else // MustBeRead remains unchanged
|
||||
sprintf (Query,"UPDATE crs_info_src SET InfoSrc='%s'"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
Inf_NamesInDBForInfoSrc[InfoSrc],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
@ -1485,7 +1485,7 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
|||
sprintf (Query,"INSERT INTO crs_info_src"
|
||||
" (CrsCod,InfoType,InfoSrc,MustBeRead)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s','N')",
|
||||
" (%ld,'%s','%s','N')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
||||
Inf_NamesInDBForInfoSrc[InfoSrc]);
|
||||
|
@ -1507,7 +1507,7 @@ Inf_InfoSrc_t Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType)
|
|||
|
||||
/***** Get info source for a specific type of info from database *****/
|
||||
sprintf (Query,"SELECT InfoSrc FROM crs_info_src"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get info source"))
|
||||
{
|
||||
|
@ -1545,7 +1545,7 @@ void Inf_GetAndCheckInfoSrcFromDB (long CrsCod,
|
|||
|
||||
/***** Get info source for a specific type of info from database *****/
|
||||
sprintf (Query,"SELECT InfoSrc,MustBeRead FROM crs_info_src"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info source");
|
||||
|
||||
|
@ -1673,7 +1673,7 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD)
|
|||
sprintf (Query,"REPLACE INTO crs_info_txt"
|
||||
" (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s','%s')",
|
||||
" (%ld,'%s','%s','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
||||
InfoTxtHTML,InfoTxtMD);
|
||||
|
@ -1696,7 +1696,7 @@ static void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
|||
/***** Get info source for a specific type of course information
|
||||
(bibliography, FAQ, links or evaluation) from database *****/
|
||||
sprintf (Query,"SELECT InfoTxtHTML,InfoTxtMD FROM crs_info_txt"
|
||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info text");
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
|
||||
" FROM centres,ins_admin,institutions"
|
||||
" WHERE (centres.Status & %u)<>0"
|
||||
" AND centres.InsCod=ins_admin.InsCod AND ins_admin.UsrCod='%ld'"
|
||||
" AND centres.InsCod=ins_admin.InsCod AND ins_admin.UsrCod=%ld"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" GROUP BY centres.InsCod ORDER BY institutions.ShortName",
|
||||
(unsigned) Ctr_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -959,7 +959,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
case Ins_GET_BASIC_DATA:
|
||||
sprintf (Query,"SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW"
|
||||
" FROM institutions"
|
||||
" WHERE CtyCod='%ld'"
|
||||
" WHERE CtyCod=%ld"
|
||||
" ORDER BY FullName",
|
||||
CtyCod);
|
||||
break;
|
||||
|
@ -978,13 +978,13 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
"institutions.ShortName,institutions.FullName,"
|
||||
"institutions.WWW,COUNT(*) AS NumUsrs"
|
||||
" FROM institutions,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=usr_data.InsCod"
|
||||
" GROUP BY institutions.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs"
|
||||
" FROM institutions"
|
||||
" WHERE CtyCod='%ld'"
|
||||
" WHERE CtyCod=%ld"
|
||||
" AND InsCod NOT IN"
|
||||
" (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
" ORDER BY %s",
|
||||
|
@ -1123,7 +1123,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
|
|||
{
|
||||
/***** Get data of an institution from database *****/
|
||||
sprintf (Query,"SELECT CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW"
|
||||
" FROM institutions WHERE InsCod='%ld'",
|
||||
" FROM institutions WHERE InsCod=%ld",
|
||||
Ins->InsCod);
|
||||
|
||||
/***** Count number of rows in result *****/
|
||||
|
@ -1207,7 +1207,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
|
|||
if (Ins->InsCod != Cached.InsCod) // If not cached...
|
||||
{
|
||||
/***** Get the short name of an institution from database *****/
|
||||
sprintf (Query,"SELECT ShortName FROM institutions WHERE InsCod='%ld'",
|
||||
sprintf (Query,"SELECT ShortName FROM institutions WHERE InsCod=%ld",
|
||||
Ins->InsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of an institution") == 1)
|
||||
{
|
||||
|
@ -1264,7 +1264,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
|
|||
/***** Get the short name of an institution from database *****/
|
||||
sprintf (Query,"SELECT institutions.FullName,countries.Name_%s"
|
||||
" FROM institutions,countries"
|
||||
" WHERE institutions.InsCod='%ld'"
|
||||
" WHERE institutions.InsCod=%ld"
|
||||
" AND institutions.CtyCod=countries.CtyCod",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the full name of an institution") == 1)
|
||||
|
@ -1344,7 +1344,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
{
|
||||
/***** Get institutions of selected country from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT InsCod,ShortName FROM institutions"
|
||||
" WHERE CtyCod='%ld'"
|
||||
" WHERE CtyCod=%ld"
|
||||
" ORDER BY ShortName",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
NumInss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get institutions");
|
||||
|
@ -1707,7 +1707,7 @@ void Ins_RemoveInstitution (void)
|
|||
Fil_RemoveTree (PathIns);
|
||||
|
||||
/***** Remove institution *****/
|
||||
sprintf (Query,"DELETE FROM institutions WHERE InsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM institutions WHERE InsCod=%ld",
|
||||
Ins.InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove an institution");
|
||||
|
||||
|
@ -1838,7 +1838,7 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
|||
|
||||
/***** Get number of institutions in current country with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions"
|
||||
" WHERE CtyCod='%ld' AND %s='%s' AND InsCod<>'%ld'",
|
||||
" WHERE CtyCod=%ld AND %s='%s' AND InsCod<>%ld",
|
||||
CtyCod,FieldName,Name,InsCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of an institution already existed") != 0);
|
||||
}
|
||||
|
@ -1852,7 +1852,7 @@ static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *N
|
|||
char Query[128 + Hie_MAX_BYTES_FULL_NAME];
|
||||
|
||||
/***** Update institution changing old name by new name */
|
||||
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod='%ld'",
|
||||
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
||||
FieldName,NewInsName,InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of an institution");
|
||||
}
|
||||
|
@ -1930,7 +1930,7 @@ static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Update country in table of institutions *****/
|
||||
sprintf (Query,"UPDATE institutions SET CtyCod='%ld' WHERE InsCod='%ld'",
|
||||
sprintf (Query,"UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
CtyCod,InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the country of an institution");
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW
|
|||
char Query[128 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE institutions SET WWW='%s' WHERE InsCod='%ld'",
|
||||
sprintf (Query,"UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
||||
NewWWW,InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of an institution");
|
||||
}
|
||||
|
@ -2056,7 +2056,7 @@ void Ins_ChangeInsStatus (void)
|
|||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Update status in table of institutions *****/
|
||||
sprintf (Query,"UPDATE institutions SET Status='%u' WHERE InsCod='%ld'",
|
||||
sprintf (Query,"UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
||||
(unsigned) Status,Ins->InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the status of an institution");
|
||||
|
||||
|
@ -2396,7 +2396,7 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
|
|||
sprintf (Query,"INSERT INTO institutions"
|
||||
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld','%s','%s','%s')",
|
||||
" (%ld,%u,%ld,'%s','%s','%s')",
|
||||
Ins->CtyCod,
|
||||
Status,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -2434,7 +2434,7 @@ unsigned Ins_GetNumInssInCty (long CtyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of degrees of a place from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions WHERE CtyCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions WHERE CtyCod=%ld",
|
||||
CtyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of institutions in a country");
|
||||
}
|
||||
|
@ -2505,7 +2505,7 @@ unsigned Ins_GetNumInssWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
SubQuery,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of institutions with users");
|
||||
}
|
||||
|
|
10
swad_link.c
10
swad_link.c
|
@ -274,7 +274,7 @@ void Lnk_GetDataOfLinkByCod (struct Link *Lnk)
|
|||
{
|
||||
/***** Get data of an institutional link from database *****/
|
||||
sprintf (Query,"SELECT ShortName,FullName,WWW FROM links"
|
||||
" WHERE LnkCod='%ld'",
|
||||
" WHERE LnkCod=%ld",
|
||||
Lnk->LnkCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of an institutional link");
|
||||
|
||||
|
@ -435,7 +435,7 @@ void Lnk_RemoveLink (void)
|
|||
Lnk_GetDataOfLinkByCod (&Lnk);
|
||||
|
||||
/***** Remove link *****/
|
||||
sprintf (Query,"DELETE FROM links WHERE LnkCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM links WHERE LnkCod=%ld",
|
||||
Lnk.LnkCod);
|
||||
DB_QueryDELETE (Query,"can not remove an institutional link");
|
||||
|
||||
|
@ -564,7 +564,7 @@ static bool Lnk_CheckIfLinkNameExists (const char *FieldName,const char *Name,lo
|
|||
char Query[256 + Lnk_MAX_BYTES_LINK_FULL_NAME];
|
||||
|
||||
/***** Get number of links with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM links WHERE %s='%s' AND LnkCod<>'%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM links WHERE %s='%s' AND LnkCod<>%ld",
|
||||
FieldName,Name,LnkCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of an institutional link already existed") != 0);
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *N
|
|||
char Query[128 + Lnk_MAX_BYTES_LINK_FULL_NAME];
|
||||
|
||||
/***** Update institutional link changing old name by new name */
|
||||
sprintf (Query,"UPDATE links SET %s='%s' WHERE LnkCod='%ld'",
|
||||
sprintf (Query,"UPDATE links SET %s='%s' WHERE LnkCod=%ld",
|
||||
FieldName,NewLnkName,LnkCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of an institutional link");
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ void Lnk_ChangeLinkWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
sprintf (Query,"UPDATE links SET WWW='%s' WHERE LnkCod='%ld'",
|
||||
sprintf (Query,"UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
|
||||
NewWWW,Lnk->LnkCod);
|
||||
DB_QueryUPDATE (Query,"can not update the web of an institutional link");
|
||||
|
||||
|
|
28
swad_mail.c
28
swad_mail.c
|
@ -406,7 +406,7 @@ void Mai_GetDataOfMailDomainByCod (struct Mail *Mai)
|
|||
if (Mai->MaiCod > 0)
|
||||
{
|
||||
/***** Get data of a mail domain from database *****/
|
||||
sprintf (Query,"SELECT Domain,Info FROM mail_domains WHERE MaiCod='%ld'",
|
||||
sprintf (Query,"SELECT Domain,Info FROM mail_domains WHERE MaiCod=%ld",
|
||||
Mai->MaiCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a mail domain");
|
||||
|
||||
|
@ -555,7 +555,7 @@ void Mai_RemoveMailDomain (void)
|
|||
Mai_GetDataOfMailDomainByCod (&Mai);
|
||||
|
||||
/***** Remove mail *****/
|
||||
sprintf (Query,"DELETE FROM mail_domains WHERE MaiCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM mail_domains WHERE MaiCod=%ld",
|
||||
Mai.MaiCod);
|
||||
DB_QueryDELETE (Query,"can not remove a mail domain");
|
||||
|
||||
|
@ -685,7 +685,7 @@ static bool Mai_CheckIfMailDomainNameExists (const char *FieldName,const char *N
|
|||
|
||||
/***** Get number of mail_domains with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM mail_domains"
|
||||
" WHERE %s='%s' AND MaiCod<>'%ld'",
|
||||
" WHERE %s='%s' AND MaiCod<>%ld",
|
||||
FieldName,Name,MaiCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a mail domain already existed") != 0);
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const
|
|||
char Query[128 + Mai_MAX_BYTES_MAIL_INFO];
|
||||
|
||||
/***** Update mail domain changing old name by new name */
|
||||
sprintf (Query,"UPDATE mail_domains SET %s='%s' WHERE MaiCod='%ld'",
|
||||
sprintf (Query,"UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
|
||||
FieldName,NewMaiName,MaiCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a mail domain");
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
|
|||
|
||||
/***** Get current (last updated) user's nickname from database *****/
|
||||
sprintf (Query,"SELECT E_mail,Confirmed FROM usr_emails"
|
||||
" WHERE UsrCod='%ld' ORDER BY CreatTime DESC LIMIT 1",
|
||||
" WHERE UsrCod=%ld ORDER BY CreatTime DESC LIMIT 1",
|
||||
UsrDat->UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get email address");
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
|
|||
|
||||
/***** Get my emails *****/
|
||||
sprintf (Query,"SELECT E_mail,Confirmed FROM usr_emails"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY CreatTime DESC",
|
||||
UsrDat->UsrCod);
|
||||
NumEmails = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get old email addresses of a user");
|
||||
|
@ -1413,7 +1413,7 @@ static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EM
|
|||
|
||||
/***** Remove an old email address *****/
|
||||
sprintf (Query,"DELETE FROM usr_emails"
|
||||
" WHERE UsrCod='%ld' AND E_mail='%s'",
|
||||
" WHERE UsrCod=%ld AND E_mail='%s'",
|
||||
UsrCod,Email);
|
||||
DB_QueryREPLACE (Query,"can not remove an old email address");
|
||||
}
|
||||
|
@ -1530,20 +1530,20 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
|
|||
/***** Check if the new email matches any of the confirmed emails of other users *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_emails"
|
||||
" WHERE E_mail='%s' AND Confirmed='Y'"
|
||||
" AND UsrCod<>'%ld'",
|
||||
" AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not check if email already existed")) // An email of another user is the same that my email
|
||||
return false; // Don't update
|
||||
|
||||
/***** Delete email (not confirmed) for other users *****/
|
||||
sprintf (Query,"DELETE FROM pending_emails"
|
||||
" WHERE E_mail='%s' AND UsrCod<>'%ld'",
|
||||
" WHERE E_mail='%s' AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove pending email for other users");
|
||||
|
||||
sprintf (Query,"DELETE FROM usr_emails"
|
||||
" WHERE E_mail='%s' AND Confirmed='N'"
|
||||
" AND UsrCod<>'%ld'",
|
||||
" AND UsrCod<>%ld",
|
||||
NewEmail,UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove not confirmed email for other users");
|
||||
|
||||
|
@ -1551,7 +1551,7 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
|
|||
sprintf (Query,"REPLACE INTO usr_emails"
|
||||
" (UsrCod,E_mail,CreatTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%s',NOW())",
|
||||
" (%ld,'%s',NOW())",
|
||||
UsrDat->UsrCod,NewEmail);
|
||||
DB_QueryREPLACE (Query,"can not update email");
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]
|
|||
sprintf (Query,"INSERT INTO pending_emails"
|
||||
" (UsrCod,E_mail,MailKey,DateAndTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s',NOW())",
|
||||
" (%ld,'%s','%s',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Email,
|
||||
MailKey);
|
||||
|
@ -1751,7 +1751,7 @@ void Mai_ConfirmEmail (void)
|
|||
/***** Check user's code and email
|
||||
and get if email is already confirmed *****/
|
||||
sprintf (Query,"SELECT Confirmed FROM usr_emails"
|
||||
" WHERE UsrCod='%ld' AND E_mail='%s'",
|
||||
" WHERE UsrCod=%ld AND E_mail='%s'",
|
||||
UsrCod,Email);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's code and email"))
|
||||
{
|
||||
|
@ -1764,7 +1764,7 @@ void Mai_ConfirmEmail (void)
|
|||
else
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_emails SET Confirmed='Y'"
|
||||
" WHERE usr_emails.UsrCod='%ld'"
|
||||
" WHERE usr_emails.UsrCod=%ld"
|
||||
" AND usr_emails.E_mail='%s'",
|
||||
UsrCod,Email);
|
||||
DB_QueryUPDATE (Query,"can not confirm email");
|
||||
|
|
10
swad_mark.c
10
swad_mark.c
|
@ -91,7 +91,7 @@ void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks)
|
|||
sprintf (Query,"INSERT INTO marks_properties"
|
||||
" (FilCod,%s,%s)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%u')",
|
||||
" (%ld,%u,%u)",
|
||||
Mrk_HeadOrFootStr[Brw_HEADER],
|
||||
Mrk_HeadOrFootStr[Brw_FOOTER],
|
||||
FilCod,
|
||||
|
@ -197,7 +197,7 @@ static void Mrk_GetNumRowsHeaderAndFooter (struct MarksProperties *Marks)
|
|||
/***** Get number of rows of header and footer from database *****/
|
||||
sprintf (Query,"SELECT marks_properties.%s,marks_properties.%s"
|
||||
" FROM files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld' AND files.Path='%s'"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
Mrk_HeadOrFootStr[Brw_HEADER],
|
||||
Mrk_HeadOrFootStr[Brw_FOOTER],
|
||||
|
@ -271,8 +271,8 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
|||
/***** Update properties of marks in the database *****/
|
||||
Cod = Brw_GetCodForFiles ();
|
||||
sprintf (Query,"UPDATE marks_properties,files"
|
||||
" SET marks_properties.%s='%u'"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld' AND files.Path='%s'"
|
||||
" SET marks_properties.%s=%u"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
Mrk_HeadOrFootStr[HeaderOrFooter],NumRows,
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
|
@ -753,7 +753,7 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
sprintf (Query,"SELECT files.FileBrowser,files.Cod,files.Path,"
|
||||
"marks_properties.Header,marks_properties.Footer"
|
||||
" FROM files,marks_properties"
|
||||
" WHERE files.FilCod='%ld'"
|
||||
" WHERE files.FilCod=%ld"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
MrkCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
|
|
|
@ -448,7 +448,7 @@ void Mnu_ChangeMenu (void)
|
|||
/***** Store menu in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_data SET Menu='%u' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about menu");
|
||||
}
|
||||
|
|
164
swad_message.c
164
swad_message.c
|
@ -506,7 +506,7 @@ static void Msg_WriteFormSubjectAndContentMsgToUsrs (char Content[Cns_MAX_BYTES_
|
|||
{
|
||||
/* Get subject and content of message from database */
|
||||
sprintf (Query,"SELECT Subject,Content FROM msg_content"
|
||||
" WHERE MsgCod='%ld'",MsgCod);
|
||||
" WHERE MsgCod=%ld",MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get message content");
|
||||
|
||||
/* Result should have a unique row */
|
||||
|
@ -1197,13 +1197,13 @@ static void Msg_ExpandSentMsg (long MsgCod)
|
|||
|
||||
/***** Expand message in sent message table *****/
|
||||
sprintf (Query,"UPDATE msg_snt SET Expanded='Y'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not expand a sent message");
|
||||
|
||||
/***** Contract all my other messages in sent message table *****/
|
||||
sprintf (Query,"UPDATE msg_snt SET Expanded='N'"
|
||||
" WHERE UsrCod='%ld' AND MsgCod<>'%ld'",
|
||||
" WHERE UsrCod=%ld AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
|
||||
DB_QueryUPDATE (Query,"can not contract a sent message");
|
||||
}
|
||||
|
@ -1218,13 +1218,13 @@ static void Msg_ExpandReceivedMsg (long MsgCod)
|
|||
|
||||
/***** Expand message in received message table and mark it as read by me *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Open='Y',Expanded='Y'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not expand a received message");
|
||||
|
||||
/***** Contract all my other messages in received message table *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Expanded='N'"
|
||||
" WHERE UsrCod='%ld' AND MsgCod<>'%ld'",
|
||||
" WHERE UsrCod=%ld AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
|
||||
DB_QueryUPDATE (Query,"can not contract a received message");
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ static void Msg_ContractSentMsg (long MsgCod)
|
|||
|
||||
/***** Contract message in sent message table *****/
|
||||
sprintf (Query,"UPDATE msg_snt SET Expanded='N'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not contract a sent message");
|
||||
}
|
||||
|
@ -1254,7 +1254,7 @@ static void Msg_ContractReceivedMsg (long MsgCod)
|
|||
|
||||
/***** Contract message in received message table *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Expanded='N'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not contract a received message");
|
||||
}
|
||||
|
@ -1269,7 +1269,7 @@ void Msg_SetReceivedMsgAsOpen (long MsgCod,long UsrCod)
|
|||
|
||||
/***** Mark message as read by user *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Open='Y'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not mark a received message as open");
|
||||
}
|
||||
|
@ -1314,7 +1314,7 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
|||
sprintf (Query,"INSERT INTO msg_snt"
|
||||
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%ld','N',NOW())",
|
||||
" (%ld,%ld,%ld,'N',NOW())",
|
||||
MsgCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -1385,12 +1385,12 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
|||
/* Insert messages into msg_rcv_deleted */
|
||||
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted"
|
||||
" (MsgCod,UsrCod,Notified,Open,Replied)"
|
||||
" SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv WHERE UsrCod='%ld'",
|
||||
" SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not remove received messages");
|
||||
|
||||
/* Delete messages from msg_rcv *****/
|
||||
sprintf (Query,"DELETE FROM msg_rcv WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM msg_rcv WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove received messages");
|
||||
|
||||
/***** Move message from msg_snt to msg_snt_deleted *****/
|
||||
|
@ -1398,12 +1398,12 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
|||
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted"
|
||||
" (MsgCod,CrsCod,UsrCod,CreatTime)"
|
||||
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
|
||||
" FROM msg_snt WHERE UsrCod='%ld'",
|
||||
" FROM msg_snt WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not remove sent messages");
|
||||
|
||||
/* Delete message from msg_snt *****/
|
||||
sprintf (Query,"DELETE FROM msg_snt WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM msg_snt WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove sent messages");
|
||||
}
|
||||
|
||||
|
@ -1419,7 +1419,7 @@ static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEm
|
|||
sprintf (Query,"INSERT INTO msg_rcv"
|
||||
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%c','N','N','N')",
|
||||
" (%ld,%ld,'%c','N','N','N')",
|
||||
MsgCod,UsrCod,
|
||||
NotifyByEmail ? 'Y' :
|
||||
'N');
|
||||
|
@ -1435,7 +1435,7 @@ static void Msg_SetReceivedMsgAsReplied (long MsgCod)
|
|||
char Query[512];
|
||||
|
||||
/***** Update received message by setting Replied field to true *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Replied='Y' WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE msg_rcv SET Replied='Y' WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update a received message");
|
||||
}
|
||||
|
@ -1453,12 +1453,12 @@ static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod)
|
|||
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted"
|
||||
" (MsgCod,UsrCod,Notified,Open,Replied)"
|
||||
" SELECT MsgCod,UsrCod,Notified,Open,Replied"
|
||||
" FROM msg_rcv WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
DB_QueryINSERT (Query,"can not remove a received message");
|
||||
|
||||
/* Delete message from msg_rcv *****/
|
||||
sprintf (Query,"DELETE FROM msg_rcv WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a received message");
|
||||
|
||||
|
@ -1484,12 +1484,12 @@ static void Msg_MoveSentMsgToDeleted (long MsgCod)
|
|||
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted"
|
||||
" (MsgCod,CrsCod,UsrCod,CreatTime)"
|
||||
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
|
||||
" FROM msg_snt WHERE MsgCod='%ld'",
|
||||
" FROM msg_snt WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
DB_QueryINSERT (Query,"can not remove a sent message");
|
||||
|
||||
/* Delete message from msg_snt *****/
|
||||
sprintf (Query,"DELETE FROM msg_snt WHERE MsgCod='%ld'",MsgCod);
|
||||
sprintf (Query,"DELETE FROM msg_snt WHERE MsgCod=%ld",MsgCod);
|
||||
DB_QueryDELETE (Query,"can not remove a sent message");
|
||||
|
||||
/***** If message content is not longer necessary, move it to msg_content_deleted *****/
|
||||
|
@ -1510,7 +1510,7 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
|
|||
sprintf (Query,"INSERT IGNORE INTO msg_content_deleted"
|
||||
" (MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL)"
|
||||
" SELECT MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL"
|
||||
" FROM msg_content WHERE MsgCod='%ld'",
|
||||
" FROM msg_content WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
DB_QueryINSERT (Query,"can not remove the content of a message");
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
|
|||
should be deleted to ensure the protection of personal data */
|
||||
|
||||
/* Delete message from msg_content *****/
|
||||
sprintf (Query,"DELETE FROM msg_content WHERE MsgCod='%ld'",MsgCod);
|
||||
sprintf (Query,"DELETE FROM msg_content WHERE MsgCod=%ld",MsgCod);
|
||||
DB_QueryUPDATE (Query,"can not remove the content of a message");
|
||||
}
|
||||
|
||||
|
@ -1559,7 +1559,7 @@ static bool Msg_CheckIfSentMsgIsDeleted (long MsgCod)
|
|||
|
||||
/***** Get if the message code is in table of sent messages not deleted *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_snt"
|
||||
" WHERE MsgCod='%ld'",MsgCod);
|
||||
" WHERE MsgCod=%ld",MsgCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a sent message is deleted") == 0); // The message has been deleted by its author when it is not present in table of sent messages undeleted
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ static bool Msg_CheckIfReceivedMsgIsDeletedForAllItsRecipients (long MsgCod)
|
|||
|
||||
/***** Get if the message code is in table of received messages not deleted *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_rcv"
|
||||
" WHERE MsgCod='%ld'",MsgCod);
|
||||
" WHERE MsgCod=%ld",MsgCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a received message is deleted by all recipients") == 0); // The message has been deleted by all its recipients when it is not present in table of received messages undeleted
|
||||
}
|
||||
|
||||
|
@ -1591,18 +1591,18 @@ static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromTo
|
|||
{
|
||||
if (FilterFromToSubquery[0])
|
||||
sprintf (SubQuery,"SELECT msg_rcv.MsgCod FROM msg_rcv,msg_snt,usr_data"
|
||||
" WHERE msg_rcv.UsrCod='%ld' AND msg_rcv.Open='N'"
|
||||
" WHERE msg_rcv.UsrCod=%ld AND msg_rcv.Open='N'"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.CrsCod='%ld'"
|
||||
" AND msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.UsrCod=usr_data.UsrCod%s",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
FilterCrsCod,
|
||||
FilterFromToSubquery);
|
||||
else
|
||||
sprintf (SubQuery,"SELECT msg_rcv.MsgCod FROM msg_rcv,msg_snt"
|
||||
" WHERE msg_rcv.UsrCod='%ld' AND msg_rcv.Open='N'"
|
||||
" WHERE msg_rcv.UsrCod=%ld AND msg_rcv.Open='N'"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.CrsCod='%ld'",
|
||||
" AND msg_snt.CrsCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
FilterCrsCod);
|
||||
}
|
||||
|
@ -1610,14 +1610,14 @@ static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromTo
|
|||
{
|
||||
if (FilterFromToSubquery[0])
|
||||
sprintf (SubQuery,"SELECT msg_rcv.MsgCod FROM msg_rcv,msg_snt,usr_data"
|
||||
" WHERE msg_rcv.UsrCod='%ld' AND msg_rcv.Open='N'"
|
||||
" WHERE msg_rcv.UsrCod=%ld AND msg_rcv.Open='N'"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.UsrCod=usr_data.UsrCod%s",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
FilterFromToSubquery);
|
||||
else
|
||||
sprintf (SubQuery,"SELECT MsgCod FROM msg_rcv"
|
||||
" WHERE UsrCod='%ld' AND Open='N'",
|
||||
" WHERE UsrCod=%ld AND Open='N'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
|
@ -1846,7 +1846,7 @@ static unsigned long Msg_GetNumUsrsBannedByMe (void)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of users I have banned *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_banned WHERE ToUsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_banned WHERE ToUsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get number of users you have banned");
|
||||
}
|
||||
|
@ -1888,9 +1888,9 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
if (FilterFromToSubquery[0])
|
||||
sprintf (PtrQuery,"SELECT msg_rcv.MsgCod"
|
||||
" FROM msg_rcv,msg_snt,usr_data"
|
||||
" WHERE msg_rcv.UsrCod='%ld'%s"
|
||||
" WHERE msg_rcv.UsrCod=%ld%s"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.CrsCod='%ld'"
|
||||
" AND msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.UsrCod=usr_data.UsrCod%s"
|
||||
" ORDER BY msg_rcv.MsgCod DESC",
|
||||
UsrCod,StrUnreadMsg,FilterCrsCod,
|
||||
|
@ -1898,9 +1898,9 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
else
|
||||
sprintf (PtrQuery,"SELECT msg_rcv.MsgCod"
|
||||
" FROM msg_rcv,msg_snt"
|
||||
" WHERE msg_rcv.UsrCod='%ld'%s"
|
||||
" WHERE msg_rcv.UsrCod=%ld%s"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.CrsCod='%ld'"
|
||||
" AND msg_snt.CrsCod=%ld"
|
||||
" ORDER BY msg_rcv.MsgCod DESC",
|
||||
UsrCod,StrUnreadMsg,
|
||||
FilterCrsCod);
|
||||
|
@ -1909,8 +1909,8 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
if (FilterFromToSubquery[0])
|
||||
sprintf (PtrQuery,"SELECT DISTINCT msg_snt.MsgCod"
|
||||
" FROM msg_snt,msg_rcv,usr_data"
|
||||
" WHERE msg_snt.UsrCod='%ld'"
|
||||
" AND msg_snt.CrsCod='%ld'"
|
||||
" WHERE msg_snt.UsrCod=%ld"
|
||||
" AND msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.MsgCod=msg_rcv.MsgCod"
|
||||
" AND msg_rcv.UsrCod=usr_data.UsrCod%s"
|
||||
" ORDER BY msg_snt.MsgCod DESC",
|
||||
|
@ -1919,7 +1919,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
else
|
||||
sprintf (PtrQuery,"SELECT MsgCod"
|
||||
" FROM msg_snt"
|
||||
" WHERE UsrCod='%ld' AND CrsCod='%ld'"
|
||||
" WHERE UsrCod=%ld AND CrsCod=%ld"
|
||||
" ORDER BY MsgCod DESC",
|
||||
UsrCod,FilterCrsCod);
|
||||
break;
|
||||
|
@ -1936,7 +1936,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
"");
|
||||
sprintf (PtrQuery,"SELECT msg_rcv.MsgCod"
|
||||
" FROM msg_rcv,msg_snt,usr_data"
|
||||
" WHERE msg_rcv.UsrCod='%ld'%s"
|
||||
" WHERE msg_rcv.UsrCod=%ld%s"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.UsrCod=usr_data.UsrCod%s"
|
||||
" ORDER BY msg_rcv.MsgCod DESC",
|
||||
|
@ -1949,7 +1949,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
"");
|
||||
sprintf (PtrQuery,"SELECT MsgCod"
|
||||
" FROM msg_rcv"
|
||||
" WHERE UsrCod='%ld'%s"
|
||||
" WHERE UsrCod=%ld%s"
|
||||
" ORDER BY MsgCod DESC",
|
||||
UsrCod,StrUnreadMsg);
|
||||
}
|
||||
|
@ -1958,7 +1958,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
if (FilterFromToSubquery[0])
|
||||
sprintf (PtrQuery,"SELECT DISTINCT msg_snt.MsgCod"
|
||||
" FROM msg_snt,msg_rcv,usr_data"
|
||||
" WHERE msg_snt.UsrCod='%ld'"
|
||||
" WHERE msg_snt.UsrCod=%ld"
|
||||
" AND msg_snt.MsgCod=msg_rcv.MsgCod"
|
||||
" AND msg_rcv.UsrCod=usr_data.UsrCod%s"
|
||||
" ORDER BY msg_snt.MsgCod DESC",
|
||||
|
@ -1967,7 +1967,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCo
|
|||
else
|
||||
sprintf (PtrQuery,"SELECT MsgCod"
|
||||
" FROM msg_snt"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY MsgCod DESC",
|
||||
UsrCod);
|
||||
break;
|
||||
|
@ -1994,7 +1994,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod)
|
|||
|
||||
/***** Get the number of unique messages sent by any teacher from this course *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr"
|
||||
" WHERE msg_snt.CrsCod='%ld' AND crs_usr.CrsCod='%ld' AND crs_usr.Role='%u'"
|
||||
" WHERE msg_snt.CrsCod=%ld AND crs_usr.CrsCod=%ld AND crs_usr.Role=%u"
|
||||
" AND msg_snt.UsrCod=crs_usr.UsrCod",
|
||||
CrsCod,CrsCod,(unsigned) Rol_TEACHER);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers");
|
||||
|
@ -2010,9 +2010,9 @@ unsigned long Msg_GetNumMsgsSentByUsr (long UsrCod)
|
|||
|
||||
/***** Get the number of unique messages sent by any teacher from this course *****/
|
||||
sprintf (Query,"SELECT"
|
||||
" (SELECT COUNT(*) FROM msg_snt WHERE UsrCod='%ld')"
|
||||
" (SELECT COUNT(*) FROM msg_snt WHERE UsrCod=%ld)"
|
||||
" +"
|
||||
" (SELECT COUNT(*) FROM msg_snt_deleted WHERE UsrCod='%ld')",
|
||||
" (SELECT COUNT(*) FROM msg_snt_deleted WHERE UsrCod=%ld)",
|
||||
UsrCod,
|
||||
UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get the number of messages sent by a user");
|
||||
|
@ -2049,7 +2049,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,%s"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2061,7 +2061,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,%s"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=%s.CrsCod",
|
||||
|
@ -2072,7 +2072,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM degrees,courses,%s"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=%s.CrsCod",
|
||||
Table,
|
||||
|
@ -2082,7 +2082,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM courses,%s"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=%s.CrsCod",
|
||||
Table,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -2091,7 +2091,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM %s"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Table,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -2129,7 +2129,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,%s,msg_snt"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2142,7 +2142,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,%s,msg_snt"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
|
@ -2154,7 +2154,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM degrees,courses,%s,msg_snt"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=%s.MsgCod",
|
||||
|
@ -2165,7 +2165,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM courses,%s,msg_snt"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=%s.MsgCod",
|
||||
Table,
|
||||
|
@ -2175,7 +2175,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM msg_snt,%s"
|
||||
" WHERE msg_snt.CrsCod='%ld'"
|
||||
" WHERE msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.MsgCod=%s.MsgCod",
|
||||
Table,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -2203,7 +2203,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,msg_snt,msg_rcv"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2213,7 +2213,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,msg_snt,msg_rcv_deleted"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2227,7 +2227,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,msg_snt,msg_rcv"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
|
@ -2236,7 +2236,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,msg_snt,msg_rcv_deleted"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
|
@ -2249,7 +2249,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM degrees,courses,msg_snt,msg_rcv"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=msg_rcv.MsgCod"
|
||||
|
@ -2257,7 +2257,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM degrees,courses,msg_snt,msg_rcv_deleted"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=msg_rcv_deleted.MsgCod"
|
||||
|
@ -2269,14 +2269,14 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM courses,msg_snt,msg_rcv"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=msg_rcv.MsgCod"
|
||||
" AND msg_rcv.Notified='Y')"
|
||||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM courses,msg_snt,msg_rcv_deleted"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=msg_snt.CrsCod"
|
||||
" AND msg_snt.MsgCod=msg_rcv_deleted.MsgCod"
|
||||
" AND msg_rcv_deleted.Notified='Y')",
|
||||
|
@ -2287,13 +2287,13 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
|||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM msg_snt,msg_rcv"
|
||||
" WHERE msg_snt.CrsCod='%ld'"
|
||||
" WHERE msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.MsgCod=msg_rcv.MsgCod"
|
||||
" AND msg_rcv.Notified='Y')"
|
||||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM msg_snt,msg_rcv_deleted"
|
||||
" WHERE msg_snt.CrsCod='%ld'"
|
||||
" WHERE msg_snt.CrsCod=%ld"
|
||||
" AND msg_snt.MsgCod=msg_rcv_deleted.MsgCod"
|
||||
" AND msg_rcv_deleted.Notified='Y')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -2480,7 +2480,7 @@ void Msg_GetDistinctCoursesInMyMessages (void)
|
|||
case Msg_MESSAGES_RECEIVED:
|
||||
sprintf (Query,"SELECT DISTINCT courses.CrsCod,courses.ShortName"
|
||||
" FROM msg_rcv,msg_snt,courses"
|
||||
" WHERE msg_rcv.UsrCod='%ld'"
|
||||
" WHERE msg_rcv.UsrCod=%ld"
|
||||
" AND msg_rcv.MsgCod=msg_snt.MsgCod"
|
||||
" AND msg_snt.CrsCod=courses.CrsCod"
|
||||
" ORDER BY courses.ShortName",
|
||||
|
@ -2489,7 +2489,7 @@ void Msg_GetDistinctCoursesInMyMessages (void)
|
|||
case Msg_MESSAGES_SENT:
|
||||
sprintf (Query,"SELECT DISTINCT courses.CrsCod,courses.ShortName"
|
||||
" FROM msg_snt,courses"
|
||||
" WHERE msg_snt.UsrCod='%ld'"
|
||||
" WHERE msg_snt.UsrCod=%ld"
|
||||
" AND msg_snt.CrsCod=courses.CrsCod"
|
||||
" ORDER BY courses.ShortName",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -2661,7 +2661,7 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
|||
/***** Get data of message from table msg_snt *****/
|
||||
*Deleted = false;
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM msg_snt WHERE MsgCod='%ld'",
|
||||
" FROM msg_snt WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a message");
|
||||
|
||||
|
@ -2669,7 +2669,7 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
|||
{
|
||||
/***** Get data of message from table msg_snt_deleted *****/
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM msg_snt_deleted WHERE MsgCod='%ld'",
|
||||
" FROM msg_snt_deleted WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a message");
|
||||
|
||||
|
@ -2710,7 +2710,7 @@ void Msg_GetMsgSubject (long MsgCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1])
|
|||
MYSQL_ROW row;
|
||||
|
||||
/***** Get subject of message from database *****/
|
||||
sprintf (Query,"SELECT Subject FROM msg_content WHERE MsgCod='%ld'",MsgCod);
|
||||
sprintf (Query,"SELECT Subject FROM msg_content WHERE MsgCod=%ld",MsgCod);
|
||||
|
||||
/***** Result should have a unique row *****/
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the subject of a message") == 1)
|
||||
|
@ -2741,7 +2741,7 @@ static void Msg_GetMsgContent (long MsgCod,char Content[Cns_MAX_BYTES_LONG_TEXT
|
|||
|
||||
/***** Get content of message from database *****/
|
||||
sprintf (Query,"SELECT Content,ImageName,ImageTitle,ImageURL"
|
||||
" FROM msg_content WHERE MsgCod='%ld'",
|
||||
" FROM msg_content WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the content of a message");
|
||||
|
||||
|
@ -2776,7 +2776,7 @@ static void Msg_GetStatusOfSentMsg (long MsgCod,bool *Expanded)
|
|||
|
||||
/***** Get if sent message has been replied/expanded from database *****/
|
||||
sprintf (Query,"SELECT Expanded FROM msg_snt"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get if a sent message has been replied/expanded");
|
||||
|
||||
|
@ -2807,7 +2807,7 @@ static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,boo
|
|||
|
||||
/***** Get if received message has been replied/expanded from database *****/
|
||||
sprintf (Query,"SELECT Open,Replied,Expanded FROM msg_rcv"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get if a received message has been replied/expanded");
|
||||
|
||||
|
@ -3017,7 +3017,7 @@ void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Get subject of message from database *****/
|
||||
sprintf (Query,"SELECT Subject,Content FROM msg_content WHERE MsgCod='%ld'",
|
||||
sprintf (Query,"SELECT Subject,Content FROM msg_content WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
|
@ -3368,9 +3368,9 @@ static void Msg_WriteMsgTo (long MsgCod)
|
|||
|
||||
/***** Get number of recipients of a message from database *****/
|
||||
sprintf (Query,"SELECT "
|
||||
"(SELECT COUNT(*) FROM msg_rcv WHERE MsgCod='%ld')"
|
||||
"(SELECT COUNT(*) FROM msg_rcv WHERE MsgCod=%ld)"
|
||||
" + "
|
||||
"(SELECT COUNT(*) FROM msg_rcv_deleted WHERE MsgCod='%ld')",
|
||||
"(SELECT COUNT(*) FROM msg_rcv_deleted WHERE MsgCod=%ld)",
|
||||
MsgCod,MsgCod);
|
||||
NumRecipientsTotal = (unsigned) DB_QueryCOUNT (Query,"can not get number of recipients");
|
||||
|
||||
|
@ -3378,12 +3378,12 @@ static void Msg_WriteMsgTo (long MsgCod)
|
|||
sprintf (Query,"(SELECT msg_rcv.UsrCod,'N',msg_rcv.Open,"
|
||||
"usr_data.Surname1 AS S1,usr_data.Surname2 AS S2,usr_data.FirstName AS FN"
|
||||
" FROM msg_rcv,usr_data"
|
||||
" WHERE msg_rcv.MsgCod='%ld' AND msg_rcv.UsrCod=usr_data.UsrCod)"
|
||||
" WHERE msg_rcv.MsgCod=%ld AND msg_rcv.UsrCod=usr_data.UsrCod)"
|
||||
" UNION "
|
||||
"(SELECT msg_rcv_deleted.UsrCod,'Y',msg_rcv_deleted.Open,"
|
||||
"usr_data.Surname1 AS S1,usr_data.Surname2 AS S2,usr_data.FirstName AS FN"
|
||||
" FROM msg_rcv_deleted,usr_data"
|
||||
" WHERE msg_rcv_deleted.MsgCod='%ld' AND msg_rcv_deleted.UsrCod=usr_data.UsrCod)"
|
||||
" WHERE msg_rcv_deleted.MsgCod=%ld AND msg_rcv_deleted.UsrCod=usr_data.UsrCod)"
|
||||
" ORDER BY S1,S2,FN",
|
||||
MsgCod,MsgCod);
|
||||
NumRecipientsKnown = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get recipients of a message");
|
||||
|
@ -3652,7 +3652,7 @@ void Msg_BanSenderWhenShowingMsgs (void)
|
|||
sprintf (Query,"REPLACE INTO msg_banned"
|
||||
" (FromUsrCod,ToUsrCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not ban sender");
|
||||
|
||||
|
@ -3709,7 +3709,7 @@ static void Msg_UnbanSender (void)
|
|||
|
||||
/***** Remove pair (sender's code - my code) from table of banned senders *****/
|
||||
sprintf (Query,"DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod='%ld' AND ToUsrCod='%ld'",
|
||||
" WHERE FromUsrCod=%ld AND ToUsrCod=%ld",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not ban sender");
|
||||
|
||||
|
@ -3729,7 +3729,7 @@ static bool Msg_CheckIfUsrIsBanned (long FromUsrCod,long ToUsrCod)
|
|||
|
||||
/***** Get if FromUsrCod is banned by ToUsrCod *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM msg_banned"
|
||||
" WHERE FromUsrCod='%ld' AND ToUsrCod='%ld'",
|
||||
" WHERE FromUsrCod=%ld AND ToUsrCod=%ld",
|
||||
FromUsrCod,ToUsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user is banned") != 0);
|
||||
}
|
||||
|
@ -3745,7 +3745,7 @@ void Msg_RemoveUsrFromBanned (long UsrCod)
|
|||
/***** Remove pair (sender's code - my code)
|
||||
from table of banned senders *****/
|
||||
sprintf (Query,"DELETE FROM msg_banned"
|
||||
" WHERE FromUsrCod='%ld' OR ToUsrCod='%ld'",
|
||||
" WHERE FromUsrCod=%ld OR ToUsrCod=%ld",
|
||||
UsrCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from table of banned users");
|
||||
}
|
||||
|
@ -3769,7 +3769,7 @@ void Msg_ListBannedUsrs (void)
|
|||
|
||||
/***** Get my banned users *****/
|
||||
sprintf (Query,"SELECT msg_banned.FromUsrCod FROM msg_banned,usr_data"
|
||||
" WHERE msg_banned.ToUsrCod='%ld'"
|
||||
" WHERE msg_banned.ToUsrCod=%ld"
|
||||
" AND msg_banned.FromUsrCod=usr_data.UsrCod"
|
||||
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
|
@ -220,7 +220,7 @@ void Net_ShowWebsAndSocialNets (const struct UsrData *UsrDat)
|
|||
{
|
||||
/***** Get user's web / social network from database *****/
|
||||
sprintf (Query,"SELECT URL FROM usr_webs"
|
||||
" WHERE UsrCod='%ld' AND Web='%s'",
|
||||
" WHERE UsrCod=%ld AND Web='%s'",
|
||||
UsrDat->UsrCod,Net_WebsAndSocialNetworksDB[NumURL]);
|
||||
|
||||
/***** Check if exists the web / social network for this user *****/
|
||||
|
@ -308,7 +308,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
{
|
||||
/***** Get user's web / social network from database *****/
|
||||
sprintf (Query,"SELECT URL FROM usr_webs"
|
||||
" WHERE UsrCod='%ld' AND Web='%s'",
|
||||
" WHERE UsrCod=%ld AND Web='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Net_WebsAndSocialNetworksDB[NumURL]);
|
||||
|
||||
|
@ -412,7 +412,7 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
|||
sprintf (Query,"REPLACE INTO usr_webs"
|
||||
" (UsrCod,Web,URL)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s')",
|
||||
" (%ld,'%s','%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Net_WebsAndSocialNetworksDB[Web],
|
||||
URL);
|
||||
|
@ -421,7 +421,7 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
|||
else
|
||||
{
|
||||
/***** Remove web / social network *****/
|
||||
sprintf (Query,"DELETE FROM usr_webs WHERE UsrCod='%ld' AND Web='%s'",
|
||||
sprintf (Query,"DELETE FROM usr_webs WHERE UsrCod=%ld AND Web='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Net_WebsAndSocialNetworksDB[Web]);
|
||||
DB_QueryREPLACE (Query,"can not remove user's web / social network");
|
||||
|
@ -465,7 +465,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
sprintf (Query,"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_webs"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -479,7 +479,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
sprintf (Query,"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_webs"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -492,7 +492,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
sprintf (Query,"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM degrees,courses,crs_usr,usr_webs"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_webs.UsrCod"
|
||||
|
@ -504,7 +504,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
sprintf (Query,"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM courses,crs_usr,usr_webs"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_webs.UsrCod"
|
||||
" GROUP BY usr_webs.Web"
|
||||
|
@ -515,7 +515,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
sprintf (Query,"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM crs_usr,usr_webs"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=usr_webs.UsrCod"
|
||||
" GROUP BY usr_webs.Web"
|
||||
" ORDER BY N DESC,usr_webs.Web",
|
||||
|
|
|
@ -111,7 +111,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
|||
|
||||
/***** Get current (last updated) user's nickname from database *****/
|
||||
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
|
||||
" WHERE UsrCod='%ld' ORDER BY CreatTime DESC LIMIT 1",
|
||||
" WHERE UsrCod=%ld ORDER BY CreatTime DESC LIMIT 1",
|
||||
UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get nickname"))
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ void Nck_ShowFormChangeUsrNickname (void)
|
|||
|
||||
/***** Get my nicknames *****/
|
||||
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY CreatTime DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumNicks = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get nicknames of a user");
|
||||
|
@ -337,7 +337,7 @@ static void Nck_RemoveNicknameFromDB (const char *Nickname)
|
|||
|
||||
/***** Remove an old nickname *****/
|
||||
sprintf (Query,"DELETE FROM usr_nicknames"
|
||||
" WHERE UsrCod='%ld' AND Nickname='%s'",
|
||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Nickname);
|
||||
DB_QueryREPLACE (Query,"can not remove an old nickname");
|
||||
}
|
||||
|
@ -377,13 +377,13 @@ void Nck_UpdateNick (void)
|
|||
{
|
||||
/***** Check if the new nickname matches any of my old nicknames *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||
" WHERE UsrCod='%ld' AND Nickname='%s'",
|
||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,NewNicknameWithoutArroba);
|
||||
if (!DB_QueryCOUNT (Query,"can not check if nickname already existed")) // No matches
|
||||
{
|
||||
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||
" WHERE Nickname='%s' AND UsrCod<>'%ld'",
|
||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that my nickname
|
||||
{
|
||||
|
@ -434,7 +434,7 @@ void Nck_UpdateMyNick (const char *NewNickname)
|
|||
sprintf (Query,"REPLACE INTO usr_nicknames"
|
||||
" (UsrCod,Nickname,CreatTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%s',NOW())",
|
||||
" (%ld,'%s',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,NewNickname);
|
||||
DB_QueryREPLACE (Query,"can not update your nickname");
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ static long Not_InsertNoticeInDB (const char *Content)
|
|||
sprintf (Query,"INSERT INTO notices"
|
||||
" (CrsCod,UsrCod,CreatTime,Content,Status)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW(),'%s','%u')",
|
||||
" (%ld,%ld,NOW(),'%s',%u)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Content,(unsigned) Not_ACTIVE_NOTICE);
|
||||
return DB_QueryINSERTandReturnCode (Query,"can not create notice");
|
||||
|
@ -181,7 +181,7 @@ static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned Nu
|
|||
char Query[512];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE notices SET NumNotif='%u' WHERE NotCod='%ld'",
|
||||
sprintf (Query,"UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,NotCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of notifications of a notice");
|
||||
}
|
||||
|
@ -228,8 +228,8 @@ void Not_HideActiveNotice (void)
|
|||
NotCod = Not_GetParamNotCod ();
|
||||
|
||||
/***** Set notice as hidden *****/
|
||||
sprintf (Query,"UPDATE notices SET Status='%u'"
|
||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE notices SET Status=%u"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Not_OBSOLETE_NOTICE,
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not hide notice");
|
||||
|
@ -251,8 +251,8 @@ void Not_RevealHiddenNotice (void)
|
|||
NotCod = Not_GetParamNotCod ();
|
||||
|
||||
/***** Set notice as active *****/
|
||||
sprintf (Query,"UPDATE notices SET Status='%u'"
|
||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"UPDATE notices SET Status=%u"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Not_ACTIVE_NOTICE,
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not reveal notice");
|
||||
|
@ -306,13 +306,13 @@ void Not_RemoveNotice (void)
|
|||
" (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
|
||||
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
|
||||
" FROM notices"
|
||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryINSERT (Query,"can not remove notice");
|
||||
|
||||
/* Remove notice */
|
||||
sprintf (Query,"DELETE FROM notices"
|
||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove notice");
|
||||
|
||||
|
@ -369,7 +369,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
|||
case Not_LIST_BRIEF_NOTICES:
|
||||
sprintf (Query,"SELECT NotCod,UNIX_TIMESTAMP(CreatTime) AS F,UsrCod,Content,Status"
|
||||
" FROM notices"
|
||||
" WHERE CrsCod='%ld' AND Status='%u'"
|
||||
" WHERE CrsCod=%ld AND Status=%u"
|
||||
" ORDER BY CreatTime DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Not_ACTIVE_NOTICE);
|
||||
|
@ -377,7 +377,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
|||
case Not_LIST_FULL_NOTICES:
|
||||
sprintf (Query,"SELECT NotCod,UNIX_TIMESTAMP(CreatTime) AS F,UsrCod,Content,Status"
|
||||
" FROM notices"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" ORDER BY CreatTime DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -546,7 +546,7 @@ static void Not_GetDataAndShowNotice (long NotCod)
|
|||
/***** Get notice data from database *****/
|
||||
sprintf (Query,"SELECT UNIX_TIMESTAMP(CreatTime) AS F,UsrCod,Content,Status"
|
||||
" FROM notices"
|
||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get notice from database"))
|
||||
|
@ -761,7 +761,7 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Get subject of message from database *****/
|
||||
sprintf (Query,"SELECT Content FROM notices WHERE NotCod='%ld'",
|
||||
sprintf (Query,"SELECT Content FROM notices WHERE NotCod=%ld",
|
||||
NotCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
|
@ -817,56 +817,56 @@ unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t Status,unsigned *NumN
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM notices"
|
||||
" WHERE Status='%u'",
|
||||
" WHERE Status=%u",
|
||||
Status);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
|
||||
" FROM institutions,centres,degrees,courses,notices"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=notices.CrsCod"
|
||||
" AND notices.Status='%u'",
|
||||
" AND notices.Status=%u",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
Status);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
|
||||
" FROM centres,degrees,courses,notices"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=notices.CrsCod"
|
||||
" AND notices.Status='%u'",
|
||||
" AND notices.Status=%u",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
Status);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
|
||||
" FROM degrees,courses,notices"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=notices.CrsCod"
|
||||
" AND notices.Status='%u'",
|
||||
" AND notices.Status=%u",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
Status);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
|
||||
" FROM courses,notices"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=notices.CrsCod"
|
||||
" AND notices.Status='%u'",
|
||||
" AND notices.Status=%u",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
Status);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM notices"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND Status='%u'",
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND Status=%u",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Status);
|
||||
break;
|
||||
|
@ -919,7 +919,7 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
|
||||
" FROM institutions,centres,degrees,courses,notices_deleted"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -929,7 +929,7 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
|
||||
" FROM centres,degrees,courses,notices_deleted"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=notices_deleted.CrsCod",
|
||||
|
@ -938,7 +938,7 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
|
||||
" FROM degrees,courses,notices_deleted"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=notices_deleted.CrsCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
@ -946,14 +946,14 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
|
||||
" FROM courses,notices_deleted"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=notices_deleted.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM notices_deleted"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -342,7 +342,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
sprintf (Query,"SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||
"Cod,UNIX_TIMESTAMP(TimeNotif),Status"
|
||||
" FROM notif"
|
||||
" WHERE ToUsrCod='%ld'%s"
|
||||
" WHERE ToUsrCod=%ld%s"
|
||||
" ORDER BY TimeNotif DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,SubQuery);
|
||||
NumNotifications = DB_QuerySELECT (Query,&mysql_res,"can not get your notifications");
|
||||
|
@ -928,17 +928,17 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon
|
|||
{
|
||||
if (Cod > 0) // Set only one notification for the user as seen
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld' AND NotifyEvent='%u' AND Cod='%ld'",
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||
else if (CrsCod > 0) // Set all notifications of this type in the current course for the user as seen
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld' AND NotifyEvent='%u' AND CrsCod='%ld'",
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
else // Set all notifications of this type for the user as seen
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld' AND NotifyEvent='%u'",
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as seen");
|
||||
|
@ -955,7 +955,7 @@ void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
|
||||
/***** Set notification as removed *****/
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent='%u' AND Cod='%ld'",
|
||||
" WHERE NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) NotifyEvent,Cod);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as removed");
|
||||
|
@ -972,12 +972,12 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long
|
|||
/***** Set notification as removed *****/
|
||||
if (Cod > 0) // Set only one notification as removed
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld' AND NotifyEvent='%u' AND Cod='%ld'",
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||
else // Set all notifications of this type, in the current course for the user, as removed
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld' AND NotifyEvent='%u' AND CrsCod='%ld'",
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as removed");
|
||||
|
@ -999,16 +999,16 @@ void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
|
|||
except notifications about new messages *****/
|
||||
if (ToUsrCod > 0) // If the user code is specified
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld'"
|
||||
" AND CrsCod='%ld'"
|
||||
" AND NotifyEvent<>'%u'", // messages will remain available
|
||||
" WHERE ToUsrCod=%ld"
|
||||
" AND CrsCod=%ld"
|
||||
" AND NotifyEvent<>%u", // messages will remain available
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
ToUsrCod,
|
||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||
else // User code not specified ==> any user
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND NotifyEvent<>'%u'", // messages will remain available
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND NotifyEvent<>%u", // messages will remain available
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as removed");
|
||||
|
@ -1114,9 +1114,9 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
|||
return;
|
||||
}
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent='%u' AND Cod IN"
|
||||
" WHERE NotifyEvent=%u AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%')",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) NotifyEvent,
|
||||
|
@ -1139,9 +1139,9 @@ void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
|||
|
||||
/***** Set notifications as removed *****/
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent IN ('%u','%u','%u','%u') AND Cod IN"
|
||||
" WHERE NotifyEvent IN (%u,%u,%u,%u) AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u') AND Cod='%ld')",
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) Ntf_EVENT_DOCUMENT_FILE,
|
||||
(unsigned) Ntf_EVENT_TEACHERS_FILE,
|
||||
|
@ -1188,16 +1188,16 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
case Brw_ADMI_SHARE_CRS:
|
||||
case Brw_ADMI_MARKS_CRS: // Notify all users in course except me
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND UsrCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND UsrCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_TEACH_CRS: // Notify all teachers in course except me
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND UsrCod<>'%ld'"
|
||||
" AND Role='%u'", // Notify teachers only
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND UsrCod<>%ld"
|
||||
" AND Role=%u", // Notify teachers only
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Rol_TEACHER);
|
||||
|
@ -1206,19 +1206,19 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
case Brw_ADMI_SHARE_GRP:
|
||||
case Brw_ADMI_MARKS_GRP: // Notify all users in group except me
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_grp_usr"
|
||||
" WHERE crs_grp_usr.GrpCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod<>'%ld'",
|
||||
" WHERE crs_grp_usr.GrpCod=%ld"
|
||||
" AND crs_grp_usr.UsrCod<>%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_TEACH_GRP: // Notify all teachers in group except me
|
||||
sprintf (Query,"SELECT crs_grp_usr.UsrCod"
|
||||
" FROM crs_grp_usr,crs_grp,crs_usr"
|
||||
" WHERE crs_grp_usr.GrpCod='%ld'"
|
||||
" AND crs_grp_usr.UsrCod<>'%ld'"
|
||||
" WHERE crs_grp_usr.GrpCod=%ld"
|
||||
" AND crs_grp_usr.UsrCod<>%ld"
|
||||
" AND crs_grp_usr.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'", // Notify teachers only
|
||||
" AND crs_usr.Role=%u", // Notify teachers only
|
||||
Gbl.CurrentCrs.Grps.GrpCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Rol_TEACHER);
|
||||
|
@ -1233,24 +1233,24 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
// Cases 1 and 2 are mutually exclusive, so the union returns the case 1 or 2
|
||||
sprintf (Query,"(SELECT crs_usr.UsrCod"
|
||||
" FROM assignments,crs_usr"
|
||||
" WHERE assignments.AsgCod='%ld'"
|
||||
" WHERE assignments.AsgCod=%ld"
|
||||
" AND assignments.AsgCod NOT IN"
|
||||
" (SELECT AsgCod FROM asg_grp WHERE AsgCod='%ld')"
|
||||
" (SELECT AsgCod FROM asg_grp WHERE AsgCod=%ld)"
|
||||
" AND assignments.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod<>'%ld')"
|
||||
" AND crs_usr.UsrCod<>%ld)"
|
||||
" UNION "
|
||||
"(SELECT DISTINCT crs_grp_usr.UsrCod"
|
||||
" FROM asg_grp,crs_grp_usr"
|
||||
" WHERE asg_grp.AsgCod='%ld'"
|
||||
" WHERE asg_grp.AsgCod=%ld"
|
||||
" AND asg_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod<>'%ld')",
|
||||
" AND crs_grp_usr.UsrCod<>%ld)",
|
||||
Cod,Cod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Ntf_EVENT_EXAM_ANNOUNCEMENT:
|
||||
case Ntf_EVENT_NOTICE:
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
|
@ -1261,9 +1261,9 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
if (Gbl.CurrentCrs.Crs.NumTchs)
|
||||
// If this course has teachers ==> send notification to teachers
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND UsrCod<>'%ld'"
|
||||
" AND Role='%u'", // Notify teachers only
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND UsrCod<>%ld"
|
||||
" AND Role=%u", // Notify teachers only
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Rol_TEACHER);
|
||||
|
@ -1274,10 +1274,10 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
// ==> send notification to administrators or superusers
|
||||
sprintf (Query,"SELECT UsrCod FROM admin"
|
||||
" WHERE (Scope='%s'"
|
||||
" OR (Scope='%s' AND Cod='%ld')"
|
||||
" OR (Scope='%s' AND Cod='%ld')"
|
||||
" OR (Scope='%s' AND Cod='%ld'))"
|
||||
" AND UsrCod<>'%ld'",
|
||||
" OR (Scope='%s' AND Cod=%ld)"
|
||||
" OR (Scope='%s' AND Cod=%ld)"
|
||||
" OR (Scope='%s' AND Cod=%ld))"
|
||||
" AND UsrCod<>%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
|
@ -1288,8 +1288,8 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
// Cod is the code of the social publishing
|
||||
sprintf (Query,"SELECT DISTINCT(PublisherCod) FROM social_pubs"
|
||||
" WHERE NotCod = (SELECT NotCod FROM social_pubs"
|
||||
" WHERE PubCod='%ld')"
|
||||
" AND PublisherCod<>'%ld'",
|
||||
" WHERE PubCod=%ld)"
|
||||
" AND PublisherCod<>%ld",
|
||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Ntf_EVENT_TIMELINE_FAV: // New favourite to one of my social notes or comments
|
||||
|
@ -1304,13 +1304,13 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
{
|
||||
case For_FORUM_COURSE_USRS:
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND Role='%u' AND UsrCod<>'%ld'",
|
||||
" WHERE CrsCod=%ld AND Role=%u AND UsrCod<>%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Rol_TEACHER,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -1322,8 +1322,8 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
case Ntf_EVENT_FORUM_REPLY:
|
||||
sprintf (Query,"SELECT DISTINCT(UsrCod) FROM forum_post"
|
||||
" WHERE ThrCod = (SELECT ThrCod FROM forum_post"
|
||||
" WHERE PstCod='%ld')"
|
||||
" AND UsrCod<>'%ld'",
|
||||
" WHERE PstCod=%ld)"
|
||||
" AND UsrCod<>%ld",
|
||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Ntf_EVENT_MESSAGE: // This function should not be called in this case
|
||||
|
@ -1334,19 +1334,19 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
// Cases 1 and 2 are mutually exclusive, so the union returns the case 1 or 2
|
||||
sprintf (Query,"(SELECT crs_usr.UsrCod"
|
||||
" FROM surveys,crs_usr"
|
||||
" WHERE surveys.SvyCod='%ld'"
|
||||
" WHERE surveys.SvyCod=%ld"
|
||||
" AND surveys.SvyCod NOT IN"
|
||||
" (SELECT SvyCod FROM svy_grp WHERE SvyCod='%ld')"
|
||||
" (SELECT SvyCod FROM svy_grp WHERE SvyCod=%ld)"
|
||||
" AND surveys.Scope='%s' AND surveys.Cod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod<>'%ld'"
|
||||
" AND crs_usr.UsrCod<>%ld"
|
||||
" AND (surveys.Roles&(1<<crs_usr.Role))<>0)"
|
||||
" UNION "
|
||||
"(SELECT DISTINCT crs_grp_usr.UsrCod"
|
||||
" FROM svy_grp,crs_grp_usr,surveys,crs_usr"
|
||||
" WHERE svy_grp.SvyCod='%ld'"
|
||||
" WHERE svy_grp.SvyCod=%ld"
|
||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_grp_usr.UsrCod<>'%ld'"
|
||||
" AND crs_grp_usr.UsrCod<>%ld"
|
||||
" AND svy_grp.SvyCod=surveys.SvyCod"
|
||||
" AND surveys.Scope='%s' AND surveys.Cod=crs_usr.CrsCod"
|
||||
" AND (surveys.Roles&(1<<crs_usr.Role))<>0)",
|
||||
|
@ -1438,8 +1438,8 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
|||
" (NotifyEvent,ToUsrCod,FromUsrCod,"
|
||||
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
|
||||
" VALUES"
|
||||
" ('%u','%ld','%ld',"
|
||||
"'%ld','%ld','%ld','%ld','%ld',NOW(),'%u')",
|
||||
" (%u,%ld,%ld,"
|
||||
"%ld,%ld,%ld,%ld,%ld,NOW(),%u)",
|
||||
(unsigned) NotifyEvent,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status);
|
||||
DB_QueryINSERT (Query,"can not create new notification event");
|
||||
|
@ -1455,7 +1455,7 @@ static void Ntf_UpdateMyLastAccessToNotifications (void)
|
|||
|
||||
/***** Reset to 0 my number of new received messages *****/
|
||||
sprintf (Query,"UPDATE usr_last SET LastAccNotif=NOW()"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update last access to notifications");
|
||||
}
|
||||
|
@ -1566,7 +1566,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
{
|
||||
/***** Get pending notifications of this user from database ******/
|
||||
sprintf (Query,"SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod"
|
||||
" FROM notif WHERE ToUsrCod='%ld'"
|
||||
" FROM notif WHERE ToUsrCod=%ld"
|
||||
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0"
|
||||
" ORDER BY TimeNotif,NotifyEvent",
|
||||
ToUsrDat->UsrCod,
|
||||
|
@ -1736,7 +1736,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
|
||||
/***** Mark all the pending notifications of this user as 'sent' *****/
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld'"
|
||||
" WHERE ToUsrCod=%ld"
|
||||
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0",
|
||||
(unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod,
|
||||
(unsigned) Ntf_STATUS_BIT_EMAIL,
|
||||
|
@ -1793,7 +1793,7 @@ static void Ntf_GetNumNotifSent (long DegCod,long CrsCod,
|
|||
|
||||
/***** Get number of notifications sent by email from database *****/
|
||||
sprintf (Query,"SELECT NumEvents,NumMails FROM sta_notif"
|
||||
" WHERE DegCod='%ld' AND CrsCod='%ld' AND NotifyEvent='%u'",
|
||||
" WHERE DegCod=%ld AND CrsCod=%ld AND NotifyEvent=%u",
|
||||
DegCod,CrsCod,(unsigned) NotifyEvent);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get number of notifications sent by email");
|
||||
|
||||
|
@ -1832,7 +1832,7 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
|
|||
sprintf (Query,"REPLACE INTO sta_notif"
|
||||
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%u','%u')",
|
||||
" (%ld,%ld,%u,%u,%u)",
|
||||
DegCod,CrsCod,(unsigned) NotifyEvent,
|
||||
CurrentNumEvents + NumEvents,
|
||||
CurrentNumMails + NumMails);
|
||||
|
@ -1849,7 +1849,7 @@ void Ntf_MarkAllNotifAsSeen (void)
|
|||
|
||||
/***** Set all my notifications as seen *****/
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod='%ld'",
|
||||
" WHERE ToUsrCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as seen");
|
||||
|
@ -1981,8 +1981,8 @@ void Ntf_ChangeNotifyEvents (void)
|
|||
|
||||
/***** Store preferences about notify events *****/
|
||||
sprintf (Query,"UPDATE usr_data"
|
||||
" SET NotifNtfEvents='%u',EmailNtfEvents='%u'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -2051,7 +2051,7 @@ static unsigned Ntf_GetNumberOfAllMyUnseenNtfs (void)
|
|||
|
||||
/***** Get number of places with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM notif"
|
||||
" WHERE ToUsrCod='%ld' AND (Status & %u)=0",
|
||||
" WHERE ToUsrCod=%ld AND (Status & %u)=0",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
|
||||
return DB_QueryCOUNT (Query,"can not get number of unseen notifications");
|
||||
}
|
||||
|
@ -2066,8 +2066,8 @@ static unsigned Ntf_GetNumberOfMyNewUnseenNtfs (void)
|
|||
|
||||
/***** Get number of places with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM notif"
|
||||
" WHERE ToUsrCod='%ld' AND (Status & %u)=0"
|
||||
" AND TimeNotif>FROM_UNIXTIME('%ld')",
|
||||
" WHERE ToUsrCod=%ld AND (Status & %u)=0"
|
||||
" AND TimeNotif>FROM_UNIXTIME(%ld)",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED),
|
||||
Gbl.Usrs.Me.UsrLast.LastAccNotif);
|
||||
|
@ -2084,7 +2084,7 @@ void Ntf_RemoveUsrNtfs (long ToUsrCod)
|
|||
|
||||
/***** Delete notifications of a user ******/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM notif"
|
||||
" WHERE ToUsrCod='%ld'",
|
||||
" WHERE ToUsrCod=%ld",
|
||||
ToUsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove notifications of a user");
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned Nu
|
|||
char Query[128 + Ses_BYTES_SESSION_ID];
|
||||
|
||||
/***** Save last page of received/sent messages *****/
|
||||
sprintf (Query,"UPDATE sessions SET %s='%u' WHERE SessionId='%s'",
|
||||
sprintf (Query,"UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
||||
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
||||
"LastPageMsgSnt",
|
||||
NumPage,Gbl.Session.Id);
|
||||
|
|
|
@ -112,7 +112,7 @@ bool Pwd_CheckPendingPassword (void)
|
|||
|
||||
/***** Get pending password from database *****/
|
||||
sprintf (Query,"SELECT PendingPassword FROM pending_passwd"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get pending password"))
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
|
|||
|
||||
/***** Update my current password in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Password='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.PendingPassword,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your password");
|
||||
|
@ -473,7 +473,7 @@ void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD +
|
|||
sprintf (Query,"REPLACE INTO pending_passwd"
|
||||
" (UsrCod,PendingPassword,DateAndTime)"
|
||||
" VALUES"
|
||||
" ('%ld','%s',NOW())",
|
||||
" (%ld,'%s',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PendingPassword);
|
||||
DB_QueryREPLACE (Query,"can not create pending password");
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ static unsigned Pwd_GetNumOtherUsrsWhoUseThisPassword (const char *EncryptedPass
|
|||
/* Query database */
|
||||
if (UsrCod > 0)
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE Password='%s' AND UsrCod<>'%ld'",
|
||||
" WHERE Password='%s' AND UsrCod<>%ld",
|
||||
EncryptedPassword,UsrCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
|
|
36
swad_photo.c
36
swad_photo.c
|
@ -882,7 +882,7 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
|||
|
||||
/***** Get number of clicks without photo from database *****/
|
||||
sprintf (Query,"SELECT NumClicks FROM clicks_without_photo"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get number of clicks without photo");
|
||||
|
||||
|
@ -896,7 +896,7 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
|||
/* Update number of clicks */
|
||||
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||
{
|
||||
sprintf (Query,"UPDATE clicks_without_photo SET NumClicks=NumClicks+1 WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE clicks_without_photo SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update number of clicks without photo");
|
||||
NumClicks++;
|
||||
|
@ -908,7 +908,7 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
|||
sprintf (Query,"INSERT INTO clicks_without_photo"
|
||||
" (UsrCod,NumClicks)"
|
||||
" VALUES"
|
||||
" ('%ld',1)",
|
||||
" (%ld,1)",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not create number of clicks without photo");
|
||||
NumClicks = 1;
|
||||
|
@ -929,7 +929,7 @@ void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
|||
{
|
||||
char Query[512];
|
||||
|
||||
sprintf (Query,"DELETE FROM clicks_without_photo WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM clicks_without_photo WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a user from the list of users without photo");
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ static void Pho_ClearPhotoName (long UsrCod)
|
|||
|
||||
/***** Clear photo name in user's data *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Photo=''"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not clear the name of a user's photo");
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
|||
|
||||
/***** Update photo name in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Photo='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a user's photo");
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ void Pho_ChangePhotoVisibility (void)
|
|||
|
||||
/***** Store public/private photo in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET PhotoVisibility='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about photo visibility");
|
||||
|
@ -1334,7 +1334,7 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
|
|||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND degrees.DegCod NOT IN"
|
||||
" (SELECT DISTINCT DegCod FROM sta_degrees)"
|
||||
" LIMIT 1",
|
||||
|
@ -1364,7 +1364,7 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
|
|||
" WHERE sta_degrees.TimeAvgPhoto<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')"
|
||||
" AND sta_degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY sta_degrees.TimeAvgPhoto LIMIT 1",
|
||||
Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO,
|
||||
(unsigned) Rol_STUDENT);
|
||||
|
@ -1415,7 +1415,7 @@ static long Pho_GetTimeAvgPhotoWasComputed (long DegCod)
|
|||
|
||||
/***** Get last time an average photo was computed from database *****/
|
||||
sprintf (Query,"SELECT MIN(UNIX_TIMESTAMP(TimeAvgPhoto))"
|
||||
" FROM sta_degrees WHERE DegCod='%ld'",
|
||||
" FROM sta_degrees WHERE DegCod=%ld",
|
||||
DegCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get last time an average photo was computed");
|
||||
|
||||
|
@ -1451,7 +1451,7 @@ static long Pho_GetTimeToComputeAvgPhoto (long DegCod)
|
|||
|
||||
/***** Get time to compute average photo from database *****/
|
||||
sprintf (Query,"SELECT TimeToComputeAvgPhoto FROM sta_degrees"
|
||||
" WHERE DegCod='%ld'",DegCod);
|
||||
" WHERE DegCod=%ld",DegCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get time to compute average photo");
|
||||
|
||||
/***** Count number of rows in result *****/
|
||||
|
@ -1976,7 +1976,7 @@ static void Pho_GetMaxStdsPerDegree (void)
|
|||
sprintf (Query,"SELECT MAX(NumStds),MAX(NumStdsWithPhoto),"
|
||||
"MAX(NumStdsWithPhoto/NumStds)"
|
||||
" FROM sta_degrees"
|
||||
" WHERE Sex='all' AND NumStds>'0'");
|
||||
" WHERE Sex='all' AND NumStds>0");
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get maximum number of students in a degree");
|
||||
|
||||
/***** Count number of rows in result *****/
|
||||
|
@ -2215,7 +2215,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
|
|||
sprintf (Query,"SELECT degrees.DegCod"
|
||||
" FROM degrees,sta_degrees"
|
||||
" WHERE sta_degrees.Sex='all'"
|
||||
" AND sta_degrees.NumStds>'0'"
|
||||
" AND sta_degrees.NumStds>0"
|
||||
" AND degrees.DegCod=sta_degrees.DegCod"
|
||||
" ORDER BY sta_degrees.NumStds DESC,sta_degrees.NumStdsWithPhoto DESC,degrees.ShortName");
|
||||
break;
|
||||
|
@ -2223,7 +2223,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
|
|||
sprintf (Query,"SELECT degrees.DegCod"
|
||||
" FROM degrees,sta_degrees"
|
||||
" WHERE sta_degrees.Sex='all'"
|
||||
" AND sta_degrees.NumStds>'0'"
|
||||
" AND sta_degrees.NumStds>0"
|
||||
" AND degrees.DegCod=sta_degrees.DegCod"
|
||||
" ORDER BY sta_degrees.NumStdsWithPhoto DESC,sta_degrees.NumStds DESC,degrees.ShortName");
|
||||
break;
|
||||
|
@ -2231,7 +2231,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
|
|||
sprintf (Query,"SELECT degrees.DegCod"
|
||||
" FROM degrees,sta_degrees"
|
||||
" WHERE sta_degrees.Sex='all'"
|
||||
" AND sta_degrees.NumStds>'0'"
|
||||
" AND sta_degrees.NumStds>0"
|
||||
" AND degrees.DegCod=sta_degrees.DegCod"
|
||||
" ORDER BY sta_degrees.NumStdsWithPhoto/sta_degrees.NumStds DESC,degrees.ShortName");
|
||||
break;
|
||||
|
@ -2239,7 +2239,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
|
|||
sprintf (Query,"SELECT degrees.DegCod"
|
||||
" FROM degrees,sta_degrees"
|
||||
" WHERE sta_degrees.Sex='all'"
|
||||
" AND sta_degrees.NumStds>'0'"
|
||||
" AND sta_degrees.NumStds>0"
|
||||
" AND degrees.DegCod=sta_degrees.DegCod"
|
||||
" ORDER BY degrees.ShortName");
|
||||
break;
|
||||
|
@ -2260,7 +2260,7 @@ static void Pho_GetNumStdsInDegree (long DegCod,Usr_Sex_t Sex,int *NumStds,int *
|
|||
|
||||
/***** Get the number of students in a degree from database *****/
|
||||
sprintf (Query,"SELECT NumStds,NumStdsWithPhoto FROM sta_degrees"
|
||||
" WHERE DegCod='%ld' AND Sex='%s'",
|
||||
" WHERE DegCod=%ld AND Sex='%s'",
|
||||
DegCod,Usr_StringsSexDB[Sex]);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the number of students in a degree");
|
||||
|
||||
|
@ -2291,7 +2291,7 @@ static void Pho_UpdateDegStats (long DegCod,Usr_Sex_t Sex,unsigned NumStds,unsig
|
|||
sprintf (Query,"REPLACE INTO sta_degrees"
|
||||
" (DegCod,Sex,NumStds,NumStdsWithPhoto,TimeAvgPhoto,TimeToComputeAvgPhoto)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%u','%u',NOW(),'%ld')",
|
||||
" (%ld,'%s',%u,%u,NOW(),%ld)",
|
||||
DegCod,Usr_StringsSexDB[Sex],NumStds,NumStdsWithPhoto,TimeToComputeAvgPhotoInMicroseconds);
|
||||
DB_QueryREPLACE (Query,"can not save stats of a degree");
|
||||
}
|
||||
|
|
22
swad_place.c
22
swad_place.c
|
@ -277,16 +277,16 @@ void Plc_GetListPlaces (void)
|
|||
}
|
||||
sprintf (Query,"(SELECT places.PlcCod,places.ShortName,places.FullName,COUNT(*) AS NumCtrs"
|
||||
" FROM places,centres"
|
||||
" WHERE places.InsCod='%ld'"
|
||||
" WHERE places.InsCod=%ld"
|
||||
" AND places.PlcCod=centres.PlcCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" GROUP BY places.PlcCod)"
|
||||
" UNION "
|
||||
"(SELECT PlcCod,ShortName,FullName,0 AS NumCtrs"
|
||||
" FROM places"
|
||||
" WHERE InsCod='%ld'"
|
||||
" WHERE InsCod=%ld"
|
||||
" AND PlcCod NOT IN"
|
||||
" (SELECT DISTINCT PlcCod FROM centres WHERE InsCod='%ld'))"
|
||||
" (SELECT DISTINCT PlcCod FROM centres WHERE InsCod=%ld))"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -376,14 +376,14 @@ void Plc_GetDataOfPlaceByCod (struct Place *Plc)
|
|||
/***** Get data of a place from database *****/
|
||||
sprintf (Query,"(SELECT places.ShortName,places.FullName,COUNT(*)"
|
||||
" FROM places,centres"
|
||||
" WHERE places.PlcCod='%ld'"
|
||||
" WHERE places.PlcCod=%ld"
|
||||
" AND places.PlcCod=centres.PlcCod"
|
||||
" AND centres.PlcCod='%ld'"
|
||||
" AND centres.PlcCod=%ld"
|
||||
" GROUP BY places.PlcCod)"
|
||||
" UNION "
|
||||
"(SELECT ShortName,FullName,0"
|
||||
" FROM places"
|
||||
" WHERE PlcCod='%ld'"
|
||||
" WHERE PlcCod=%ld"
|
||||
" AND PlcCod NOT IN"
|
||||
" (SELECT DISTINCT PlcCod FROM centres))",
|
||||
Plc->PlcCod,
|
||||
|
@ -552,7 +552,7 @@ void Plc_RemovePlace (void)
|
|||
else // Place has no centres ==> remove it
|
||||
{
|
||||
/***** Remove place *****/
|
||||
sprintf (Query,"DELETE FROM places WHERE PlcCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM places WHERE PlcCod=%ld",
|
||||
Plc.PlcCod);
|
||||
DB_QueryDELETE (Query,"can not remove a place");
|
||||
|
||||
|
@ -683,7 +683,7 @@ static bool Plc_CheckIfPlaceNameExists (const char *FieldName,const char *Name,l
|
|||
|
||||
/***** Get number of places with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM places"
|
||||
" WHERE InsCod='%ld' AND %s='%s' AND PlcCod<>'%ld'",
|
||||
" WHERE InsCod=%ld AND %s='%s' AND PlcCod<>%ld",
|
||||
Gbl.CurrentIns.Ins.InsCod,FieldName,Name,PlcCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a place already existed") != 0);
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *N
|
|||
char Query[128 + Plc_MAX_BYTES_PLACE_FULL_NAME];
|
||||
|
||||
/***** Update place changing old name by new name */
|
||||
sprintf (Query,"UPDATE places SET %s='%s' WHERE PlcCod='%ld'",
|
||||
sprintf (Query,"UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
||||
FieldName,NewPlcName,PlcCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a place");
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ static void Plc_CreatePlace (struct Place *Plc)
|
|||
sprintf (Query,"INSERT INTO places"
|
||||
" (InsCod,ShortName,FullName)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s')",
|
||||
" (%ld,'%s','%s')",
|
||||
Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName);
|
||||
DB_QueryINSERT (Query,"can not create place");
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ bool Plg_GetDataOfPluginByCod (struct Plugin *Plg)
|
|||
/***** Get data of a plugin from database *****/
|
||||
sprintf (Query,"SELECT Name,Description,Logo,AppKey,URL,IP"
|
||||
" FROM plugins"
|
||||
" WHERE PlgCod='%ld'",
|
||||
" WHERE PlgCod=%ld",
|
||||
Plg->PlgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a plugin");
|
||||
|
||||
|
@ -503,7 +503,7 @@ void Plg_RemovePlugin (void)
|
|||
Plg_GetDataOfPluginByCod (&Plg);
|
||||
|
||||
/***** Remove plugin *****/
|
||||
sprintf (Query,"DELETE FROM plugins WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM plugins WHERE PlgCod=%ld",
|
||||
Plg.PlgCod);
|
||||
DB_QueryDELETE (Query,"can not remove a plugin");
|
||||
|
||||
|
@ -565,7 +565,7 @@ void Plg_RenamePlugin (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE plugins SET Name='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
|
||||
NewPlgName,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of a plugin");
|
||||
|
||||
|
@ -599,7 +599,7 @@ static bool Plg_CheckIfPluginNameExists (const char *Name,long PlgCod)
|
|||
|
||||
/***** Get number of plugins with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM plugins"
|
||||
" WHERE Name='%s' AND PlgCod<>'%ld'",
|
||||
" WHERE Name='%s' AND PlgCod<>%ld",
|
||||
Name,PlgCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if the name of a plugin already existed") != 0);
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ void Plg_ChangePlgDescription (void)
|
|||
if (NewDescription[0])
|
||||
{
|
||||
/* Update the table changing old description by new description */
|
||||
sprintf (Query,"UPDATE plugins SET Description='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
|
||||
NewDescription,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the description of a plugin");
|
||||
|
||||
|
@ -677,7 +677,7 @@ void Plg_ChangePlgLogo (void)
|
|||
if (NewLogo[0])
|
||||
{
|
||||
/* Update the table changing old logo by new logo */
|
||||
sprintf (Query,"UPDATE plugins SET Logo='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
|
||||
NewLogo,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the logo of a plugin");
|
||||
|
||||
|
@ -721,7 +721,7 @@ void Plg_ChangePlgAppKey (void)
|
|||
if (NewAppKey[0])
|
||||
{
|
||||
/* Update the table changing old application key by new application key */
|
||||
sprintf (Query,"UPDATE plugins SET AppKey='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
|
||||
NewAppKey,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the application key of a plugin");
|
||||
|
||||
|
@ -765,7 +765,7 @@ void Plg_ChangePlgURL (void)
|
|||
if (NewURL[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
sprintf (Query,"UPDATE plugins SET URL='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
|
||||
NewURL,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the URL of a plugin");
|
||||
|
||||
|
@ -809,7 +809,7 @@ void Plg_ChangePlgIP (void)
|
|||
if (NewIP[0])
|
||||
{
|
||||
/* Update the table changing old IP by new IP */
|
||||
sprintf (Query,"UPDATE plugins SET IP='%s' WHERE PlgCod='%ld'",
|
||||
sprintf (Query,"UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
|
||||
NewIP,Plg->PlgCod);
|
||||
DB_QueryUPDATE (Query,"can not update the IP address of a plugin");
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ void Pre_SetPrefsFromIP (void)
|
|||
sprintf (Query,"REPLACE INTO IP_prefs"
|
||||
" (IP,UsrCod,LastChange,FirstDayOfWeek,Theme,IconSet,Menu,SideCols)"
|
||||
" VALUES"
|
||||
" ('%s','%ld',NOW(),'%u','%s','%s','%u','%u')",
|
||||
" ('%s',%ld,NOW(),%u,'%s','%s',%u,%u)",
|
||||
Gbl.IP,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
The_ThemeId[Gbl.Prefs.Theme],
|
||||
|
@ -204,8 +204,8 @@ void Pre_SetPrefsFromIP (void)
|
|||
/***** If a user is logged, update its preferences in database for all its IP's *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
sprintf (Query,"UPDATE IP_prefs SET FirstDayOfWeek='%u',Theme='%s',IconSet='%s',Menu='%u',SideCols='%u'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE IP_prefs SET FirstDayOfWeek=%u,Theme='%s',IconSet='%s',Menu=%u,SideCols=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
The_ThemeId[Gbl.Prefs.Theme],
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet],
|
||||
|
@ -340,7 +340,7 @@ void Pre_UpdateMyLanguageToCurrentLanguage (void)
|
|||
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
|
||||
|
||||
/***** Update my language in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Language='%s' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your language");
|
||||
|
@ -490,8 +490,8 @@ static void Pre_UpdateSideColsOnUsrDataTable (void)
|
|||
{
|
||||
char Query[512];
|
||||
|
||||
sprintf (Query,"UPDATE usr_data SET SideCols='%u'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET SideCols=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about side columns");
|
||||
}
|
||||
|
|
122
swad_profile.c
122
swad_profile.c
|
@ -357,7 +357,7 @@ void Prf_ChangeProfileVisibility (void)
|
|||
|
||||
/***** Store public/private photo in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET ProfileVisibility='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about public profile visibility");
|
||||
|
@ -650,7 +650,7 @@ void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures)
|
|||
sprintf (Query,"SELECT UNIX_TIMESTAMP(FirstClickTime),"
|
||||
"DATEDIFF(NOW(),FirstClickTime)+1,"
|
||||
"NumClicks,NumFileViews,NumForPst,NumMsgSnt"
|
||||
" FROM usr_figures WHERE UsrCod='%ld'",
|
||||
" FROM usr_figures WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
if ((NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get user's figures")))
|
||||
{
|
||||
|
@ -704,9 +704,9 @@ static unsigned long Prf_GetRankingFigure (long UsrCod,const char *FieldName)
|
|||
/***** Select number of rows with figure
|
||||
greater than the figure of this user *****/
|
||||
sprintf (Query,"SELECT COUNT(*)+1 FROM usr_figures"
|
||||
" WHERE UsrCod<>'%ld'" // Really not necessary here
|
||||
" WHERE UsrCod<>%ld" // Really not necessary here
|
||||
" AND %s>"
|
||||
"(SELECT %s FROM usr_figures WHERE UsrCod='%ld')",
|
||||
"(SELECT %s FROM usr_figures WHERE UsrCod=%ld)",
|
||||
UsrCod,FieldName,FieldName,UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get ranking using a figure");
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ static unsigned long Prf_GetNumUsrsWithFigure (const char *FieldName)
|
|||
char Query[128];
|
||||
|
||||
/***** Select number of rows with values already calculated *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_figures WHERE %s>='0'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_figures WHERE %s>=0",
|
||||
FieldName);
|
||||
return DB_QueryCOUNT (Query,"can not get number of users with a figure");
|
||||
}
|
||||
|
@ -739,16 +739,16 @@ static unsigned long Prf_GetRankingNumClicksPerDay (long UsrCod)
|
|||
" (SELECT NumClicks/(DATEDIFF(NOW(),FirstClickTime)+1)"
|
||||
" AS NumClicksPerDay"
|
||||
" FROM usr_figures"
|
||||
" WHERE UsrCod<>'%ld'" // Necessary because the following comparison is not exact in floating point
|
||||
" AND NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>'0')"
|
||||
" WHERE UsrCod<>%ld" // Necessary because the following comparison is not exact in floating point
|
||||
" AND NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>0)"
|
||||
" AS TableNumClicksPerDay"
|
||||
" WHERE NumClicksPerDay>"
|
||||
"(SELECT NumClicks/(DATEDIFF(NOW(),FirstClickTime)+1)"
|
||||
" FROM usr_figures"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" AND NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>'0')",
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>0)",
|
||||
UsrCod,UsrCod);
|
||||
return DB_QueryCOUNT (Query,"can not get ranking using number of clicks per day");
|
||||
}
|
||||
|
@ -763,8 +763,8 @@ static unsigned long Prf_GetNumUsrsWithNumClicksPerDay (void)
|
|||
|
||||
/***** Select number of rows with values already calculated *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_figures"
|
||||
" WHERE NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>'0'");
|
||||
" WHERE NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>0");
|
||||
return DB_QueryCOUNT (Query,"can not get number of users with number of clicks per day");
|
||||
}
|
||||
|
||||
|
@ -870,7 +870,7 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Get first click from log table *****/
|
||||
sprintf (Query,"SELECT UNIX_TIMESTAMP("
|
||||
"(SELECT MIN(ClickTime) FROM log_full WHERE UsrCod='%ld')"
|
||||
"(SELECT MIN(ClickTime) FROM log_full WHERE UsrCod=%ld)"
|
||||
")",
|
||||
UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's first click"))
|
||||
|
@ -889,8 +889,8 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
|||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_figures"
|
||||
" SET FirstClickTime=FROM_UNIXTIME('%ld')"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" SET FirstClickTime=FROM_UNIXTIME(%ld)"
|
||||
" WHERE UsrCod=%ld",
|
||||
(long) UsrFigures.FirstClickTimeUTC,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update user's figures");
|
||||
}
|
||||
|
@ -914,15 +914,15 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
|||
Prf_ResetUsrFigures (&UsrFigures);
|
||||
|
||||
/***** Get number of clicks from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM log_full WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM log_full WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
UsrFigures.NumClicks = (long) DB_QueryCOUNT (Query,"can not get number of clicks");
|
||||
|
||||
/***** Update number of clicks in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_figures SET NumClicks='%ld'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_figures SET NumClicks=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumClicks,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update user's figures");
|
||||
}
|
||||
|
@ -951,8 +951,8 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
|||
/***** Update number of file views in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_figures SET NumFileViews='%ld'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_figures SET NumFileViews=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumFileViews,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update user's figures");
|
||||
}
|
||||
|
@ -981,8 +981,8 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
|||
/***** Update number of forum posts in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_figures SET NumForPst='%ld'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_figures SET NumForPst=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumForPst,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update user's figures");
|
||||
}
|
||||
|
@ -1011,8 +1011,8 @@ static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
|
|||
/***** Update number of messages sent in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_figures SET NumMsgSnt='%ld'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_figures SET NumMsgSnt=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumMsgSnt,UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update user's figures");
|
||||
}
|
||||
|
@ -1071,14 +1071,14 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
|
|||
Str_Copy (SubQueryFirstClickTime,"NOW()",
|
||||
Prf_MAX_BYTES_SUBQUERY_FIRST_CLICK_TIME);
|
||||
else
|
||||
sprintf (SubQueryFirstClickTime,"FROM_UNIXTIME('%ld')",
|
||||
sprintf (SubQueryFirstClickTime,"FROM_UNIXTIME(%ld)",
|
||||
(long) UsrFigures->FirstClickTimeUTC); // 0 ==> unknown first click time or user never logged
|
||||
|
||||
/***** Create user's figures *****/
|
||||
sprintf (Query,"INSERT INTO usr_figures"
|
||||
" (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
|
||||
" VALUES"
|
||||
" ('%ld',%s,'%ld','%ld','%ld','%ld')",
|
||||
" (%ld,%s,%ld,%ld,%ld,%ld)",
|
||||
UsrCod,
|
||||
SubQueryFirstClickTime,
|
||||
UsrFigures->NumClicks, // -1L ==> unknown number of clicks
|
||||
|
@ -1097,7 +1097,7 @@ void Prf_RemoveUsrFigures (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove user's figures *****/
|
||||
sprintf (Query,"DELETE FROM usr_figures WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_figures WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not delete user's figures");
|
||||
}
|
||||
|
@ -1110,7 +1110,7 @@ static bool Prf_CheckIfUsrFiguresExists (long UsrCod)
|
|||
{
|
||||
char Query[128];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_figures WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_figures WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get user's first click") != 0);
|
||||
}
|
||||
|
@ -1126,7 +1126,7 @@ void Prf_IncrementNumClicksUsr (long UsrCod)
|
|||
/***** Increment number of clicks *****/
|
||||
// If NumClicks < 0 ==> not yet calculated, so do nothing
|
||||
sprintf (Query,"UPDATE IGNORE usr_figures SET NumClicks=NumClicks+1"
|
||||
" WHERE UsrCod='%ld' AND NumClicks>=0",
|
||||
" WHERE UsrCod=%ld AND NumClicks>=0",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not increment user's clicks");
|
||||
}
|
||||
|
@ -1142,7 +1142,7 @@ void Prf_IncrementNumFileViewsUsr (long UsrCod)
|
|||
/***** Increment number of file views *****/
|
||||
// If NumFileViews < 0 ==> not yet calculated, so do nothing
|
||||
sprintf (Query,"UPDATE IGNORE usr_figures SET NumFileViews=NumFileViews+1"
|
||||
" WHERE UsrCod='%ld' AND NumFileViews>=0",
|
||||
" WHERE UsrCod=%ld AND NumFileViews>=0",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not increment user's file views");
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ void Prf_IncrementNumForPstUsr (long UsrCod)
|
|||
/***** Increment number of forum posts *****/
|
||||
// If NumForPst < 0 ==> not yet calculated, so do nothing
|
||||
sprintf (Query,"UPDATE IGNORE usr_figures SET NumForPst=NumForPst+1"
|
||||
" WHERE UsrCod='%ld' AND NumForPst>=0",
|
||||
" WHERE UsrCod=%ld AND NumForPst>=0",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not increment user's forum posts");
|
||||
}
|
||||
|
@ -1174,7 +1174,7 @@ void Prf_IncrementNumMsgSntUsr (long UsrCod)
|
|||
/***** Increment number of messages sent *****/
|
||||
// If NumMsgSnt < 0 ==> not yet calculated, so do nothing
|
||||
sprintf (Query,"UPDATE IGNORE usr_figures SET NumMsgSnt=NumMsgSnt+1"
|
||||
" WHERE UsrCod='%ld' AND NumMsgSnt>=0",
|
||||
" WHERE UsrCod=%ld AND NumMsgSnt>=0",
|
||||
UsrCod);
|
||||
DB_QueryINSERT (Query,"can not increment user's messages sent");
|
||||
}
|
||||
|
@ -1213,7 +1213,7 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT UsrCod,%s"
|
||||
" FROM usr_figures"
|
||||
" WHERE %s>='0'"
|
||||
" WHERE %s>=0"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY %s DESC,UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1222,13 +1222,13 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT DISTINCTROW usr_figures.UsrCod,usr_figures.%s"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.%s>='0'"
|
||||
" AND usr_figures.%s>=0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1238,12 +1238,12 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT DISTINCTROW usr_figures.UsrCod,usr_figures.%s"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.%s>='0'"
|
||||
" AND usr_figures.%s>=0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1253,11 +1253,11 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT DISTINCTROW usr_figures.UsrCod,usr_figures.%s"
|
||||
" FROM degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.%s>='0'"
|
||||
" AND usr_figures.%s>=0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1267,10 +1267,10 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT DISTINCTROW usr_figures.UsrCod,usr_figures.%s"
|
||||
" FROM courses,crs_usr,usr_figures"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.%s>='0'"
|
||||
" AND usr_figures.%s>=0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1280,9 +1280,9 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT DISTINCTROW usr_figures.UsrCod,usr_figures.%s"
|
||||
" FROM crs_usr,usr_figures"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.%s>='0'"
|
||||
" AND usr_figures.%s>=0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100",
|
||||
FieldName,
|
||||
|
@ -1381,8 +1381,8 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
sprintf (Query,"SELECT UsrCod,"
|
||||
"NumClicks/(DATEDIFF(NOW(),FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM usr_figures"
|
||||
" WHERE NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>'0'"
|
||||
" WHERE NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(FirstClickTime)>0"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,UsrCod LIMIT 100");
|
||||
break;
|
||||
|
@ -1391,14 +1391,14 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>'0'"
|
||||
" AND usr_figures.NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
|
@ -1408,13 +1408,13 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>'0'"
|
||||
" AND usr_figures.NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
|
@ -1424,12 +1424,12 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM degrees,courses,crs_usr,usr_figures"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>'0'"
|
||||
" AND usr_figures.NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
@ -1439,11 +1439,11 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM courses,crs_usr,usr_figures"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>'0'"
|
||||
" AND usr_figures.NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -1453,10 +1453,10 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM crs_usr,usr_figures"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.UsrCod=usr_figures.UsrCod"
|
||||
" AND usr_figures.NumClicks>'0'"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>'0'"
|
||||
" AND usr_figures.NumClicks>0"
|
||||
" AND UNIX_TIMESTAMP(usr_figures.FirstClickTime)>0"
|
||||
" AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)"
|
||||
" ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
|
|
@ -211,7 +211,7 @@ void Rec_GetListRecordFieldsInCurrentCrs (void)
|
|||
/***** Get fields of cards of a course from database *****/
|
||||
sprintf (Query,"SELECT FieldCod,FieldName,NumLines,Visibility"
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod='%ld' ORDER BY FieldName",
|
||||
" WHERE CrsCod=%ld ORDER BY FieldName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
Gbl.CurrentCrs.Records.LstFields.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get fields of cards of a course");
|
||||
|
||||
|
@ -538,7 +538,7 @@ unsigned long Rec_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res)
|
|||
/***** Get fields of cards of current course from database *****/
|
||||
sprintf (Query,"SELECT FieldCod,FieldName,Visibility"
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod='%ld' ORDER BY FieldName",
|
||||
" WHERE CrsCod=%ld ORDER BY FieldName",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,
|
||||
"can not get fields of cards of a course");
|
||||
|
@ -557,7 +557,7 @@ void Rec_CreateRecordField (void)
|
|||
sprintf (Query,"INSERT INTO crs_record_fields"
|
||||
" (CrsCod,FieldName,NumLines,Visibility)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%u','%u')",
|
||||
" (%ld,'%s',%u,%u)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Records.Field.Name,
|
||||
Gbl.CurrentCrs.Records.Field.NumLines,
|
||||
|
@ -608,7 +608,7 @@ unsigned Rec_CountNumRecordsInCurrCrsWithField (long FieldCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of cards with a given field in a course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_records WHERE FieldCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_records WHERE FieldCod=%ld",
|
||||
FieldCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of cards with a given field not empty in a course");
|
||||
}
|
||||
|
@ -669,12 +669,12 @@ void Rec_RemoveFieldFromDB (void)
|
|||
&Gbl.CurrentCrs.Records.Field.Visibility);
|
||||
|
||||
/***** Remove field from all records *****/
|
||||
sprintf (Query,"DELETE FROM crs_records WHERE FieldCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_records WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryDELETE (Query,"can not remove field from all students' records");
|
||||
|
||||
/***** Remove the field *****/
|
||||
sprintf (Query,"DELETE FROM crs_record_fields WHERE FieldCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryDELETE (Query,"can not remove field of record");
|
||||
|
||||
|
@ -702,7 +702,7 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD
|
|||
|
||||
/***** Get a field of a record in a course from database *****/
|
||||
sprintf (Query,"SELECT FieldName,NumLines,Visibility FROM crs_record_fields"
|
||||
" WHERE CrsCod='%ld' AND FieldCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,FieldCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get a field of a record in a course");
|
||||
|
||||
|
@ -797,7 +797,7 @@ void Rec_RenameField (void)
|
|||
{
|
||||
/* Update the table of fields changing then old name by the new one */
|
||||
sprintf (Query,"UPDATE crs_record_fields SET FieldName='%s'"
|
||||
" WHERE FieldCod='%ld'",
|
||||
" WHERE FieldCod=%ld",
|
||||
NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE (Query,"can not update name of field of record");
|
||||
|
||||
|
@ -858,8 +858,8 @@ void Rec_ChangeLinesField (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
||||
sprintf (Query,"UPDATE crs_record_fields SET NumLines='%u'"
|
||||
" WHERE FieldCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_record_fields SET NumLines=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of lines of a field of record");
|
||||
|
||||
|
@ -911,8 +911,8 @@ void Rec_ChangeVisibilityField (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old visibility by the new *****/
|
||||
sprintf (Query,"UPDATE crs_record_fields SET Visibility='%u'"
|
||||
" WHERE FieldCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_record_fields SET Visibility=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
(unsigned) NewVisibility,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE (Query,"can not update the visibility of a field of record");
|
||||
|
||||
|
@ -1773,7 +1773,7 @@ unsigned long Rec_GetFieldFromCrsRecord (long UsrCod,long FieldCod,MYSQL_RES **m
|
|||
|
||||
/***** Get the text of a field of a record from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM crs_records"
|
||||
" WHERE FieldCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE FieldCod=%ld AND UsrCod=%ld",
|
||||
FieldCod,UsrCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,"can not get the text of a field of a record.");
|
||||
}
|
||||
|
@ -1825,7 +1825,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
{
|
||||
/***** Update text of the field of record course *****/
|
||||
sprintf (Query,"UPDATE crs_records SET Txt='%s'"
|
||||
" WHERE UsrCod='%ld' AND FieldCod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text,
|
||||
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
DB_QueryUPDATE (Query,"can not update field of record");
|
||||
|
@ -1834,7 +1834,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
{
|
||||
/***** Remove text of the field of record course *****/
|
||||
sprintf (Query,"DELETE FROM crs_records"
|
||||
" WHERE UsrCod='%ld' AND FieldCod='%ld'",
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
DB_QueryDELETE (Query,"can not remove field of record");
|
||||
}
|
||||
|
@ -1845,7 +1845,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
sprintf (Query,"INSERT INTO crs_records"
|
||||
" (FieldCod,UsrCod,Txt)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%s')",
|
||||
" (%ld,%ld,'%s')",
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod,
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text);
|
||||
|
@ -1865,8 +1865,8 @@ void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs,Cns_QuietOrV
|
|||
|
||||
/***** Remove text of the field of record course *****/
|
||||
sprintf (Query,"DELETE FROM crs_records"
|
||||
" WHERE UsrCod='%ld' AND FieldCod IN"
|
||||
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod='%ld')",
|
||||
" WHERE UsrCod=%ld AND FieldCod IN"
|
||||
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
|
||||
UsrCod,Crs->CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's record in a course");
|
||||
|
||||
|
@ -1889,7 +1889,7 @@ void Rec_RemoveFieldsCrsRecordAll (long UsrCod,Cns_QuietOrVerbose_t QuietOrVerbo
|
|||
char Query[128];
|
||||
|
||||
/***** Remove text of the field of record course *****/
|
||||
sprintf (Query,"DELETE FROM crs_records WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's records in all courses");
|
||||
|
||||
/***** Write mensaje *****/
|
||||
|
@ -4100,7 +4100,7 @@ void Rec_UpdateMyOffice (void)
|
|||
Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
|
||||
|
||||
/***** Update office *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Office='%s' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update office");
|
||||
|
@ -4121,7 +4121,7 @@ void Rec_UpdateMyOfficePhone (void)
|
|||
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
|
||||
|
||||
/***** Update office phone *****/
|
||||
sprintf (Query,"UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update office phone");
|
||||
|
|
|
@ -413,7 +413,7 @@ static void Rep_CreateNewReportEntryIntoDB (const struct Rep_Report *Report)
|
|||
" (UsrCod,ReportTimeUTC,"
|
||||
"UniqueDirL,UniqueDirR,Filename,Permalink)"
|
||||
" VALUES"
|
||||
" ('%ld','%04d-%02d-%02d %02d:%02d:%02d',"
|
||||
" (%ld,'%04d-%02d-%02d %02d:%02d:%02d',"
|
||||
"'%c%c','%s','%s','%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
1900 + Report->tm_CurrentTime.tm_year, // year
|
||||
|
@ -778,7 +778,7 @@ static void Rep_WriteSectionHitsPerAction (struct Rep_Report *Report)
|
|||
|
||||
/***** Make the query *****/
|
||||
sprintf (Query,"SELECT SQL_NO_CACHE ActCod,COUNT(*) AS N FROM log_full"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME('%ld') AND UsrCod='%ld'"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME(%ld) AND UsrCod=%ld"
|
||||
" GROUP BY ActCod ORDER BY N DESC LIMIT %u",
|
||||
(long) Report->UsrFigures.FirstClickTimeUTC,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Rep_MAX_ACTIONS);
|
||||
|
@ -916,14 +916,14 @@ static void Rep_GetMaxHitsPerYear (struct Rep_Report *Report)
|
|||
sprintf (Query,"SELECT MAX(N) FROM ("
|
||||
// Clicks without course selected ---------------------------
|
||||
"SELECT "
|
||||
"'-1' AS CrsCod,"
|
||||
"-1 AS CrsCod,"
|
||||
"YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'UTC')) AS Year,"
|
||||
"'%u' AS Role,"
|
||||
"%u AS Role,"
|
||||
"COUNT(*) AS N"
|
||||
" FROM log_full"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME('%ld')"
|
||||
" AND UsrCod='%ld'"
|
||||
" AND CrsCod<='0'"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME(%ld)"
|
||||
" AND UsrCod=%ld"
|
||||
" AND CrsCod<=0"
|
||||
" GROUP BY Year"
|
||||
// ----------------------------------------------------------
|
||||
" UNION "
|
||||
|
@ -934,11 +934,11 @@ static void Rep_GetMaxHitsPerYear (struct Rep_Report *Report)
|
|||
"Role,"
|
||||
"COUNT(*) AS N"
|
||||
" FROM log_full"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME('%ld')"
|
||||
" AND UsrCod='%ld'"
|
||||
" AND Role>='%u'" // Student
|
||||
" AND Role<='%u'" // Teacher
|
||||
" AND CrsCod>'0'"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME(%ld)"
|
||||
" AND UsrCod=%ld"
|
||||
" AND Role>=%u" // Student
|
||||
" AND Role<=%u" // Teacher
|
||||
" AND CrsCod>0"
|
||||
" GROUP BY CrsCod,Year,Role"
|
||||
// ----------------------------------------------------------
|
||||
") AS hits_per_crs_year",
|
||||
|
@ -1003,8 +1003,8 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
|
|||
" (crs_usr.CrsCod=log_full.CrsCod"
|
||||
" AND crs_usr.UsrCod=log_full.UsrCod"
|
||||
" AND crs_usr.Role=log_full.Role)"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.CrsCod"
|
||||
" ORDER BY N DESC,log_full.CrsCod DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role);
|
||||
|
@ -1085,9 +1085,9 @@ static void Rep_GetAndWriteMyHistoricCrss (Rol_Role_t Role,
|
|||
/***** Get historic courses of a user from log *****/
|
||||
sprintf (Query,"SELECT CrsCod,COUNT(*) AS N"
|
||||
" FROM log_full"
|
||||
" WHERE UsrCod='%ld' AND Role='%u' AND CrsCod>'0'"
|
||||
" WHERE UsrCod=%ld AND Role=%u AND CrsCod>0"
|
||||
" GROUP BY CrsCod"
|
||||
" HAVING N>'%u'"
|
||||
" HAVING N>%u"
|
||||
" ORDER BY N DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role,
|
||||
Rep_MIN_CLICKS_CRS);
|
||||
|
@ -1209,18 +1209,18 @@ static void Rep_ShowMyHitsPerYear (bool AnyCourse,long CrsCod,Rol_Role_t Role,
|
|||
if (AnyCourse)
|
||||
SubQueryCrs[0] = '\0';
|
||||
else
|
||||
sprintf (SubQueryCrs," AND CrsCod='%ld'",CrsCod);
|
||||
sprintf (SubQueryCrs," AND CrsCod=%ld",CrsCod);
|
||||
|
||||
if (Role == Rol_UNKNOWN) // Here Rol_UNKNOWN means any role
|
||||
SubQueryRol[0] = '\0';
|
||||
else
|
||||
sprintf (SubQueryRol," AND Role='%u'",(unsigned) Role);
|
||||
sprintf (SubQueryRol," AND Role=%u",(unsigned) Role);
|
||||
|
||||
sprintf (Query,"SELECT SQL_NO_CACHE "
|
||||
"YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'UTC')) AS Year,"
|
||||
"COUNT(*) FROM log_full"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME('%ld')"
|
||||
" AND UsrCod='%ld'%s%s"
|
||||
" WHERE ClickTime>=FROM_UNIXTIME(%ld)"
|
||||
" AND UsrCod=%ld%s%s"
|
||||
" GROUP BY Year DESC",
|
||||
(long) Report->UsrFigures.FirstClickTimeUTC,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -1380,7 +1380,7 @@ static void Rep_RemoveUsrReportsFiles (long UsrCod)
|
|||
|
||||
/***** Get directories for the reports *****/
|
||||
sprintf (Query,"SELECT UniqueDirL,UniqueDirR FROM usr_report"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
NumReports = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get user's usage reports");
|
||||
|
||||
|
@ -1411,6 +1411,6 @@ static void Rep_RemoveUsrReportsFromDB (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Insert a new user's usage report into database *****/
|
||||
sprintf (Query,"DELETE FROM usr_report WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM usr_report WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's usage reports");
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ Rol_Role_t Rol_GetRoleInCrs (long CrsCod,long UsrCod)
|
|||
/***** Get rol of a user in a course from database.
|
||||
The result of the query will have one row or none *****/
|
||||
sprintf (Query,"SELECT Role FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the role of a user in a course") == 1) // User belongs to the course
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
|
|||
if (UsrDat->Roles < 0) // Not yet filled
|
||||
{
|
||||
/***** Get distinct roles in all courses of the user from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT(Role) FROM crs_usr WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT DISTINCT(Role) FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
NumRoles = (unsigned) DB_QuerySELECT (Query,&mysql_res,
|
||||
"can not get the roles of a user"
|
||||
|
@ -440,7 +440,7 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod)
|
|||
|
||||
/***** Get requested role from database *****/
|
||||
sprintf (Query,"SELECT Role FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get requested role"))
|
||||
{
|
||||
|
|
110
swad_search.c
110
swad_search.c
|
@ -564,23 +564,23 @@ static void Sch_SearchInDB (void)
|
|||
RangeQuery[0] = '\0';
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (RangeQuery," AND countries.CtyCod='%ld'",
|
||||
sprintf (RangeQuery," AND countries.CtyCod=%ld",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (RangeQuery," AND institutions.InsCod='%ld'",
|
||||
sprintf (RangeQuery," AND institutions.InsCod=%ld",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (RangeQuery," AND centres.CtrCod='%ld'",
|
||||
sprintf (RangeQuery," AND centres.CtrCod=%ld",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (RangeQuery," AND degrees.DegCod='%ld'",
|
||||
sprintf (RangeQuery," AND degrees.DegCod=%ld",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (RangeQuery," AND courses.CrsCod='%ld'",
|
||||
sprintf (RangeQuery," AND courses.CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
}
|
||||
|
@ -871,13 +871,13 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"SELECT files.FilCod," // Institution
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"'-1' AS CtrCod,'' AS CtrShortName,"
|
||||
"'-1' AS DegCod,'' AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS CtrCod,'' AS CtrShortName,"
|
||||
"-1 AS DegCod,'' AS DegShortName,"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
|
@ -886,12 +886,12 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"'-1' AS DegCod,'' AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS DegCod,'' AS DegShortName,"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
|
@ -902,11 +902,11 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"'-1','' AS CrsShortName,"
|
||||
"'-1'"
|
||||
"-1,'' AS CrsShortName,"
|
||||
"-1"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -919,10 +919,10 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"courses.CrsCod,courses.ShortName AS CrsShortName,"
|
||||
"'-1'"
|
||||
"-1"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -988,9 +988,9 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
" (FilCod INT NOT NULL,UNIQUE INDEX(FilCod))"
|
||||
" ENGINE=MEMORY"
|
||||
" SELECT files.FilCod FROM crs_usr,files"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')",
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_ADMI_DOCUM_CRS,
|
||||
(unsigned) Brw_ADMI_TEACH_CRS,
|
||||
|
@ -1003,9 +1003,9 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
" (FilCod INT NOT NULL,UNIQUE INDEX(FilCod))"
|
||||
" ENGINE=MEMORY"
|
||||
" SELECT files.FilCod FROM crs_grp_usr,files"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND crs_grp_usr.GrpCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')",
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_ADMI_DOCUM_GRP,
|
||||
(unsigned) Brw_ADMI_TEACH_GRP,
|
||||
|
@ -1025,10 +1025,10 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"courses.CrsCod,courses.ShortName AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_crs) AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -1045,7 +1045,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"crs_grp.GrpCod"
|
||||
" FROM files,crs_grp,crs_grp_types,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_grp) AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp_types.CrsCod=courses.CrsCod"
|
||||
|
@ -1111,13 +1111,13 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"SELECT files.FilCod," // Institution
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"'-1' AS CtrCod,'' AS CtrShortName,"
|
||||
"'-1' AS DegCod,'' AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS CtrCod,'' AS CtrShortName,"
|
||||
"-1 AS DegCod,'' AS DegShortName,"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
|
@ -1126,12 +1126,12 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"'-1' AS DegCod,'' AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS DegCod,'' AS DegShortName,"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
|
@ -1142,11 +1142,11 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"institutions.InsCod,institutions.ShortName AS InsShortName,"
|
||||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -1159,10 +1159,10 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"centres.CtrCod,centres.ShortName AS CtrShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"courses.CrsCod,courses.ShortName AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -1178,8 +1178,8 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"courses.CrsCod,courses.ShortName AS CrsShortName,"
|
||||
"crs_grp.GrpCod"
|
||||
" FROM files,crs_grp,crs_grp_types,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp_types.CrsCod=courses.CrsCod"
|
||||
|
@ -1191,14 +1191,14 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
" UNION "
|
||||
"SELECT files.FilCod," // Briefcase
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"'-1' AS InsCod,'' AS InsShortName,"
|
||||
"'-1' AS CtrCod,'' AS CtrShortName,"
|
||||
"'-1' AS DegCod,'' AS DegShortName,"
|
||||
"'-1' AS CrsCod,'' AS CrsShortName,"
|
||||
"'-1' AS GrpCod"
|
||||
"-1 AS InsCod,'' AS InsShortName,"
|
||||
"-1 AS CtrCod,'' AS CtrShortName,"
|
||||
"-1 AS DegCod,'' AS DegShortName,"
|
||||
"-1 AS CrsCod,'' AS CrsShortName,"
|
||||
"-1 AS GrpCod"
|
||||
" FROM files"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.FileBrowser='%u'"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser=%u"
|
||||
") AS selected_files"
|
||||
" WHERE PathFromRoot<>''"
|
||||
" ORDER BY InsShortName,CtrShortName,DegShortName,CrsShortName,PathFromRoot",
|
||||
|
@ -1351,7 +1351,7 @@ static void Sch_SaveLastSearchIntoSession (void)
|
|||
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
|
||||
|
||||
/***** Save last search in session *****/
|
||||
sprintf (Query,"UPDATE sessions SET WhatToSearch='%u',SearchStr='%s'"
|
||||
sprintf (Query,"UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'"
|
||||
" WHERE SessionId='%s'",
|
||||
(unsigned) Gbl.Search.WhatToSearch,
|
||||
Gbl.Search.Str,
|
||||
|
@ -1361,7 +1361,7 @@ static void Sch_SaveLastSearchIntoSession (void)
|
|||
/***** Update my last type of search *****/
|
||||
// WhatToSearch is stored in usr_last for next time I log in
|
||||
// In other existing sessions distinct to this, WhatToSearch will remain unchanged
|
||||
sprintf (Query,"UPDATE usr_last SET WhatToSearch='%u' WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_last SET WhatToSearch=%u WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Search.WhatToSearch,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update type of search in user's last data");
|
||||
|
|
|
@ -167,8 +167,8 @@ void Ses_InsertSessionInDB (void)
|
|||
" (SessionId,UsrCod,Password,Role,"
|
||||
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
|
||||
" VALUES"
|
||||
" ('%s','%ld','%s','%u',"
|
||||
"'%ld','%ld','%ld','%ld','%ld',NOW(),NOW(),'%u')",
|
||||
" ('%s',%ld,'%s',%u,"
|
||||
"%ld,%ld,%ld,%ld,%ld,NOW(),NOW(),%u)",
|
||||
Gbl.Session.Id,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Me.UsrDat.Password,
|
||||
|
@ -193,8 +193,8 @@ void Ses_UpdateSessionDataInDB (void)
|
|||
Ses_BYTES_SESSION_ID];
|
||||
|
||||
/***** Update session in database *****/
|
||||
sprintf (Query,"UPDATE sessions SET UsrCod='%ld',Password='%s',Role='%u',"
|
||||
"CtyCod='%ld',InsCod='%ld',CtrCod='%ld',DegCod='%ld',CrsCod='%ld',"
|
||||
sprintf (Query,"UPDATE sessions SET UsrCod=%ld,Password='%s',Role=%u,"
|
||||
"CtyCod=%ld,InsCod=%ld,CtrCod=%ld,DegCod=%ld,CrsCod=%ld,"
|
||||
"LastTime=NOW(),LastRefresh=NOW()"
|
||||
" WHERE SessionId='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -376,7 +376,7 @@ void Ses_InsertHiddenParInDB (Act_Action_t Action,const char *ParamName,const ch
|
|||
sprintf (Query,"INSERT INTO hidden_params"
|
||||
" (SessionId,Action,ParamName,ParamValue)"
|
||||
" VALUES"
|
||||
" ('%s','%d','%s','%s')",
|
||||
" ('%s',%d,'%s','%s')",
|
||||
Gbl.Session.Id,(int) Action,
|
||||
ParamName,
|
||||
LengthParamValue ? ParamValue :
|
||||
|
@ -432,7 +432,7 @@ static bool Ses_CheckIfHiddenParIsAlreadyInDB (Act_Action_t Action,const char *P
|
|||
|
||||
/***** Get a hidden parameter from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM hidden_params"
|
||||
" WHERE SessionId='%s' AND Action='%d' AND ParamName='%s'",
|
||||
" WHERE SessionId='%s' AND Action=%d AND ParamName='%s'",
|
||||
Gbl.Session.Id,(int) Action,ParamName);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a hidden parameter is already in database") != 0);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ unsigned Ses_GetHiddenParFromDB (Act_Action_t Action,const char *ParamName,char
|
|||
{
|
||||
/***** Get a hidden parameter from database *****/
|
||||
sprintf (Query,"SELECT ParamValue FROM hidden_params"
|
||||
" WHERE SessionId='%s' AND Action='%d' AND ParamName='%s'",
|
||||
" WHERE SessionId='%s' AND Action=%d AND ParamName='%s'",
|
||||
Gbl.Session.Id,(int) Action,ParamName);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get a hidden parameter");
|
||||
|
||||
|
|
180
swad_social.c
180
swad_social.c
|
@ -551,7 +551,7 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
|
|||
switch (TimelineUsrOrGbl)
|
||||
{
|
||||
case Soc_TIMELINE_USR: // Show the timeline of a user
|
||||
sprintf (SubQueryPublishers,"PublisherCod='%ld' AND ",
|
||||
sprintf (SubQueryPublishers,"PublisherCod=%ld AND ",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
break;
|
||||
case Soc_TIMELINE_GBL: // Show the global timeline
|
||||
|
@ -560,10 +560,10 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
|
|||
case Soc_FOLLOWED: // Show the timeline of the users I follow
|
||||
sprintf (Query,"CREATE TEMPORARY TABLE publishers "
|
||||
"(UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
|
||||
" SELECT '%ld' AS UsrCod"
|
||||
" SELECT %ld AS UsrCod"
|
||||
" UNION"
|
||||
" SELECT FollowedCod AS UsrCod"
|
||||
" FROM usr_follow WHERE FollowerCod='%ld'",
|
||||
" FROM usr_follow WHERE FollowerCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (mysql_query (&Gbl.mysql,Query))
|
||||
|
@ -680,16 +680,16 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
|
|||
switch (TimelineUsrOrGbl)
|
||||
{
|
||||
case Soc_TIMELINE_USR: // Show the timeline of a user
|
||||
sprintf (SubQueryRangeBottom,"PubCod>'%ld' AND ",RangePubsToGet.Bottom);
|
||||
sprintf (SubQueryRangeBottom,"PubCod>%ld AND ",RangePubsToGet.Bottom);
|
||||
break;
|
||||
case Soc_TIMELINE_GBL: // Show the global timeline
|
||||
switch (Gbl.Social.WhichUsrs)
|
||||
{
|
||||
case Soc_FOLLOWED: // Show the timeline of the users I follow
|
||||
sprintf (SubQueryRangeBottom,"social_pubs.PubCod>'%ld' AND ",RangePubsToGet.Bottom);
|
||||
sprintf (SubQueryRangeBottom,"social_pubs.PubCod>%ld AND ",RangePubsToGet.Bottom);
|
||||
break;
|
||||
case Soc_ALL_USRS: // Show the timeline of all users
|
||||
sprintf (SubQueryRangeBottom,"PubCod>'%ld' AND ",RangePubsToGet.Bottom);
|
||||
sprintf (SubQueryRangeBottom,"PubCod>%ld AND ",RangePubsToGet.Bottom);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -701,16 +701,16 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
|
|||
switch (TimelineUsrOrGbl)
|
||||
{
|
||||
case Soc_TIMELINE_USR: // Show the timeline of a user
|
||||
sprintf (SubQueryRangeTop,"PubCod<'%ld' AND ",RangePubsToGet.Top);
|
||||
sprintf (SubQueryRangeTop,"PubCod<%ld AND ",RangePubsToGet.Top);
|
||||
break;
|
||||
case Soc_TIMELINE_GBL: // Show the global timeline
|
||||
switch (Gbl.Social.WhichUsrs)
|
||||
{
|
||||
case Soc_FOLLOWED: // Show the timeline of the users I follow
|
||||
sprintf (SubQueryRangeTop,"social_pubs.PubCod<'%ld' AND ",RangePubsToGet.Top);
|
||||
sprintf (SubQueryRangeTop,"social_pubs.PubCod<%ld AND ",RangePubsToGet.Top);
|
||||
break;
|
||||
case Soc_ALL_USRS: // Show the timeline of all users
|
||||
sprintf (SubQueryRangeTop,"PubCod<'%ld' AND ",RangePubsToGet.Top);
|
||||
sprintf (SubQueryRangeTop,"PubCod<%ld AND ",RangePubsToGet.Top);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -764,15 +764,15 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
|
|||
|
||||
if (PubCod > 0)
|
||||
{
|
||||
sprintf (Query,"INSERT INTO pub_codes SET PubCod='%ld'",PubCod);
|
||||
sprintf (Query,"INSERT INTO pub_codes SET PubCod=%ld",PubCod);
|
||||
DB_QueryINSERT (Query,"can not store publishing code");
|
||||
RangePubsToGet.Top = PubCod; // Narrow the range for the next iteration
|
||||
|
||||
/* Get social note code (row[1]) */
|
||||
NotCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
sprintf (Query,"INSERT INTO not_codes SET NotCod='%ld'",NotCod);
|
||||
sprintf (Query,"INSERT INTO not_codes SET NotCod=%ld",NotCod);
|
||||
DB_QueryINSERT (Query,"can not store note code");
|
||||
sprintf (Query,"INSERT INTO current_timeline SET NotCod='%ld'",NotCod);
|
||||
sprintf (Query,"INSERT INTO current_timeline SET NotCod=%ld",NotCod);
|
||||
DB_QueryINSERT (Query,"can not store note code");
|
||||
}
|
||||
else // Nothing got ==> abort loop
|
||||
|
@ -850,7 +850,7 @@ static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod)
|
|||
char Query[128 + Ses_BYTES_SESSION_ID];
|
||||
|
||||
/***** Update last publishing code *****/
|
||||
sprintf (Query,"UPDATE sessions SET FirstPubCod='%ld' WHERE SessionId='%s'",
|
||||
sprintf (Query,"UPDATE sessions SET FirstPubCod=%ld WHERE SessionId='%s'",
|
||||
FirstPubCod,Gbl.Session.Id);
|
||||
DB_QueryUPDATE (Query,"can not update first publishing code into session");
|
||||
}
|
||||
|
@ -1655,7 +1655,7 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
|
|||
|
||||
/***** Get social post from database *****/
|
||||
sprintf (Query,"SELECT Content,ImageName,ImageTitle,ImageURL"
|
||||
" FROM social_posts WHERE PstCod='%ld'",
|
||||
" FROM social_posts WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post");
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
|
|||
sprintf (Query,"INSERT INTO social_notes"
|
||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||
" VALUES"
|
||||
" ('%u','%ld','%ld','%ld','N',NOW())",
|
||||
" (%u,%ld,%ld,%ld,'N',NOW())",
|
||||
(unsigned) NoteType,Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
|
||||
SocPub->NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
|
||||
|
||||
|
@ -1963,7 +1963,7 @@ void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod)
|
|||
|
||||
/***** Mark the social note as unavailable *****/
|
||||
sprintf (Query,"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NotCod='%ld'",
|
||||
" WHERE NotCod=%ld",
|
||||
NotCod);
|
||||
DB_QueryUPDATE (Query,"can not mark social note as unavailable");
|
||||
}
|
||||
|
@ -1974,7 +1974,7 @@ void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType
|
|||
|
||||
/***** Mark the social note as unavailable *****/
|
||||
sprintf (Query,"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NoteType='%u' AND Cod='%ld'",
|
||||
" WHERE NoteType=%u AND Cod=%ld",
|
||||
(unsigned) NoteType,Cod);
|
||||
DB_QueryUPDATE (Query,"can not mark social note as unavailable");
|
||||
}
|
||||
|
@ -2095,9 +2095,9 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
|
|||
return;
|
||||
}
|
||||
sprintf (Query,"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NoteType='%u' AND Cod IN"
|
||||
" WHERE NoteType=%u AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%' AND Public='Y')", // Only public files
|
||||
(unsigned) NoteType,
|
||||
(unsigned) FileBrowser,Cod,
|
||||
|
@ -2122,7 +2122,7 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
|
|||
sprintf (Query,"INSERT INTO social_pubs"
|
||||
" (NotCod,PublisherCod,PubType,TimePublish)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u',NOW())",
|
||||
" (%ld,%ld,%u,NOW())",
|
||||
SocPub->NotCod,
|
||||
SocPub->PublisherCod,
|
||||
(unsigned) SocPub->PubType);
|
||||
|
@ -2433,7 +2433,7 @@ static unsigned long Soc_GetNumCommentsInSocialNote (long NotCod)
|
|||
char Query[128];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_pubs"
|
||||
" WHERE NotCod='%ld' AND PubType='%u'",
|
||||
" WHERE NotCod=%ld AND PubType=%u",
|
||||
NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
return DB_QueryCOUNT (Query,"can not get number of comments in a social note");
|
||||
}
|
||||
|
@ -2461,8 +2461,8 @@ static void Soc_WriteCommentsInSocialNote (const struct SocialNote *SocNot)
|
|||
"social_comments.ImageTitle,"
|
||||
"social_comments.ImageURL"
|
||||
" FROM social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod='%ld'"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
||||
" ORDER BY social_pubs.PubCod",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
|
@ -3018,7 +3018,7 @@ static long Soc_ReceiveComment (void)
|
|||
sprintf (Query,"INSERT INTO social_comments"
|
||||
" (PubCod,Content,ImageName,ImageTitle,ImageURL)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%s','%s','%s')",
|
||||
" (%ld,'%s','%s','%s','%s')",
|
||||
SocPub.PubCod,
|
||||
Content,
|
||||
Image.Name,
|
||||
|
@ -3190,7 +3190,7 @@ static long Soc_FavSocialNote (void)
|
|||
sprintf (Query,"INSERT IGNORE INTO social_notes_fav"
|
||||
" (NotCod,UsrCod,TimeFav)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW())",
|
||||
" (%ld,%ld,NOW())",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not favourite social note");
|
||||
|
@ -3278,7 +3278,7 @@ static long Soc_FavSocialComment (void)
|
|||
sprintf (Query,"INSERT IGNORE INTO social_comments_fav"
|
||||
" (PubCod,UsrCod,TimeFav)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW())",
|
||||
" (%ld,%ld,NOW())",
|
||||
SocCom.PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not favourite social comment");
|
||||
|
@ -3399,9 +3399,9 @@ static long Soc_UnshareSocialNote (void)
|
|||
{
|
||||
/***** Delete social publishing from database *****/
|
||||
sprintf (Query,"DELETE FROM social_pubs"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND PublisherCod='%ld'"
|
||||
" AND PubType='%u'",
|
||||
" WHERE NotCod=%ld"
|
||||
" AND PublisherCod=%ld"
|
||||
" AND PubType=%u",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Soc_PUB_SHARED_NOTE);
|
||||
|
@ -3487,7 +3487,7 @@ static long Soc_UnfavSocialNote (void)
|
|||
{
|
||||
/***** Delete the mark as favourite from database *****/
|
||||
sprintf (Query,"DELETE FROM social_notes_fav"
|
||||
" WHERE NotCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||
SocNot.NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not unfavourite social note");
|
||||
|
@ -3573,7 +3573,7 @@ static long Soc_UnfavSocialComment (void)
|
|||
{
|
||||
/***** Delete the mark as favourite from database *****/
|
||||
sprintf (Query,"DELETE FROM social_comments_fav"
|
||||
" WHERE PubCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||
SocCom.PubCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not unfavourite social comment");
|
||||
|
@ -3745,7 +3745,7 @@ static void Soc_RemoveImgFileFromSocialPost (long PstCod)
|
|||
MYSQL_ROW row;
|
||||
|
||||
/***** Get name of image associated to a social post from database *****/
|
||||
sprintf (Query,"SELECT ImageName FROM social_posts WHERE PstCod='%ld'",
|
||||
sprintf (Query,"SELECT ImageName FROM social_posts WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get image"))
|
||||
{
|
||||
|
@ -3787,7 +3787,7 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
|||
|
||||
/* Get comments of this social note */
|
||||
sprintf (Query,"SELECT PubCod FROM social_pubs"
|
||||
" WHERE NotCod='%ld' AND PubType ='%u'",
|
||||
" WHERE NotCod=%ld AND PubType=%u",
|
||||
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
NumComments = DB_QuerySELECT (Query,&mysql_res,"can not get social comments");
|
||||
|
||||
|
@ -3816,35 +3816,35 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
|||
/* Remove favs for all comments in this note */
|
||||
sprintf (Query,"DELETE FROM social_comments_fav"
|
||||
" USING social_pubs,social_comments_fav"
|
||||
" WHERE social_pubs.NotCod='%ld'"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" 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 (Query,"can not remove favs for social note");
|
||||
|
||||
/* Remove favs for this note */
|
||||
sprintf (Query,"DELETE FROM social_notes_fav WHERE NotCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_notes_fav WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
DB_QueryDELETE (Query,"can not remove favs for social note");
|
||||
|
||||
/***** Remove content of the comments of this social note *****/
|
||||
sprintf (Query,"DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod='%ld'"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" 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 (Query,"can not remove social comments");
|
||||
|
||||
/***** Remove all the social publishings of this note *****/
|
||||
sprintf (Query,"DELETE FROM social_pubs WHERE NotCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_pubs WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
DB_QueryDELETE (Query,"can not remove a social publishing");
|
||||
|
||||
/***** Remove social note *****/
|
||||
sprintf (Query,"DELETE FROM social_notes"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND UsrCod='%ld'", // Extra check: I am the author
|
||||
" WHERE NotCod=%ld"
|
||||
" AND UsrCod=%ld", // Extra check: I am the author
|
||||
SocNot->NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a social note");
|
||||
|
@ -3853,7 +3853,7 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
|||
{
|
||||
/***** Remove social post *****/
|
||||
sprintf (Query,"DELETE FROM social_posts"
|
||||
" WHERE PstCod='%ld'",
|
||||
" WHERE PstCod=%ld",
|
||||
SocNot->Cod);
|
||||
DB_QueryDELETE (Query,"can not remove a social post");
|
||||
}
|
||||
|
@ -3874,7 +3874,7 @@ static long Soc_GetNotCodOfSocialPublishing (long PubCod)
|
|||
long NotCod = -1L;
|
||||
|
||||
/***** Get code of social note from database *****/
|
||||
sprintf (Query,"SELECT NotCod FROM social_pubs WHERE PubCod='%ld'",
|
||||
sprintf (Query,"SELECT NotCod FROM social_pubs WHERE PubCod=%ld",
|
||||
PubCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get code of social note") == 1) // Result should have a unique row
|
||||
{
|
||||
|
@ -3902,7 +3902,7 @@ static long Soc_GetPubCodOfOriginalSocialNote (long NotCod)
|
|||
|
||||
/***** Get code of social publishing of the original note *****/
|
||||
sprintf (Query,"SELECT PubCod FROM social_pubs"
|
||||
" WHERE NotCod='%ld' AND PubType='%u'",
|
||||
" WHERE NotCod=%ld AND PubType=%u",
|
||||
NotCod,(unsigned) Soc_PUB_ORIGINAL_NOTE);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get code of social publishing") == 1) // Result should have a unique row
|
||||
{
|
||||
|
@ -4073,7 +4073,7 @@ static void Soc_RemoveImgFileFromSocialComment (long PubCod)
|
|||
MYSQL_ROW row;
|
||||
|
||||
/***** Get name of image associated to a social post from database *****/
|
||||
sprintf (Query,"SELECT ImageName FROM social_comments WHERE PubCod='%ld'",
|
||||
sprintf (Query,"SELECT ImageName FROM social_comments WHERE PubCod=%ld",
|
||||
PubCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get image"))
|
||||
{
|
||||
|
@ -4102,20 +4102,20 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom)
|
|||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_MENTION,SocCom->PubCod);
|
||||
|
||||
/***** Remove favs for this comment *****/
|
||||
sprintf (Query,"DELETE FROM social_comments_fav WHERE PubCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_comments_fav WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
DB_QueryDELETE (Query,"can not remove favs for social comment");
|
||||
|
||||
/***** Remove content of this social comment *****/
|
||||
sprintf (Query,"DELETE FROM social_comments WHERE PubCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_comments WHERE PubCod=%ld",
|
||||
SocCom->PubCod);
|
||||
DB_QueryDELETE (Query,"can not remove a social comment");
|
||||
|
||||
/***** Remove this social comment *****/
|
||||
sprintf (Query,"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
|
||||
" 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);
|
||||
|
@ -4135,15 +4135,15 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
|
||||
/***** Remove favs for comments *****/
|
||||
/* Remove all favs made by this user in any social comment */
|
||||
sprintf (Query,"DELETE FROM social_comments_fav WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_comments_fav WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove favs");
|
||||
|
||||
/* Remove all favs for all comments of this user */
|
||||
sprintf (Query,"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'"
|
||||
" 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 (Query,"can not remove favs");
|
||||
|
@ -4151,23 +4151,23 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
/* Remove all favs for all comments in all the social notes of the user */
|
||||
sprintf (Query,"DELETE FROM social_comments_fav"
|
||||
" USING social_notes,social_pubs,social_comments_fav"
|
||||
" WHERE social_notes.UsrCod='%ld'" // Author of the note
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE (Query,"can not remove social comments");
|
||||
|
||||
/***** Remove favs for notes *****/
|
||||
/* Remove all favs made by this user in any social note */
|
||||
sprintf (Query,"DELETE FROM social_notes_fav WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_notes_fav WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove favs");
|
||||
|
||||
/* Remove all favs for all notes of this user */
|
||||
sprintf (Query,"DELETE FROM social_notes_fav"
|
||||
" USING social_notes,social_notes_fav"
|
||||
" WHERE social_notes.UsrCod='%ld'" // Author of the note
|
||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
||||
" AND social_notes.NotCod=social_notes_fav.NotCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove favs");
|
||||
|
@ -4176,9 +4176,9 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
/* Remove content of all the comments in all the social notes of the user */
|
||||
sprintf (Query,"DELETE FROM social_comments"
|
||||
" USING social_notes,social_pubs,social_comments"
|
||||
" WHERE social_notes.UsrCod='%ld'"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE (Query,"can not remove social comments");
|
||||
|
@ -4186,17 +4186,17 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
/* Remove all the comments from any user in any social note of the user */
|
||||
sprintf (Query,"DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod='%ld'"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
||||
" AND social_pubs.PubType='%u'",
|
||||
" AND social_pubs.PubType=%u",
|
||||
UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
DB_QueryDELETE (Query,"can not remove social comments");
|
||||
|
||||
/* Remove content of all the comments of the user in any social note */
|
||||
sprintf (Query,"DELETE FROM social_comments"
|
||||
" USING social_pubs,social_comments"
|
||||
" WHERE social_pubs.PublisherCod='%ld'"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" 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 (Query,"can not remove social comments");
|
||||
|
@ -4205,25 +4205,25 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
|||
sprintf (Query,"DELETE FROM social_posts"
|
||||
" WHERE PstCod IN"
|
||||
" (SELECT Cod FROM social_notes"
|
||||
" WHERE UsrCod='%ld' AND NoteType='%u')",
|
||||
" WHERE UsrCod=%ld AND NoteType=%u)",
|
||||
UsrCod,(unsigned) Soc_NOTE_SOCIAL_POST);
|
||||
DB_QueryDELETE (Query,"can not remove social posts");
|
||||
|
||||
/***** Remove all the social publishings of any user authored by the user *****/
|
||||
sprintf (Query,"DELETE FROM social_pubs"
|
||||
" USING social_notes,social_pubs"
|
||||
" WHERE social_notes.UsrCod='%ld'"
|
||||
" WHERE social_notes.UsrCod=%ld"
|
||||
" AND social_notes.NotCod=social_pubs.NotCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove social publishings");
|
||||
|
||||
/***** Remove all the social publishings of the user *****/
|
||||
sprintf (Query,"DELETE FROM social_pubs WHERE PublisherCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_pubs WHERE PublisherCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove social publishings");
|
||||
|
||||
/***** Remove all the social notes of the user *****/
|
||||
sprintf (Query,"DELETE FROM social_notes WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM social_notes WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove social notes");
|
||||
}
|
||||
|
@ -4237,7 +4237,7 @@ static bool Soc_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod)
|
|||
char Query[256];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_pubs"
|
||||
" WHERE NotCod='%ld' AND PublisherCod='%ld' AND PubType='%u'",
|
||||
" WHERE NotCod=%ld AND PublisherCod=%ld AND PubType=%u",
|
||||
NotCod,UsrCod,(unsigned) Soc_PUB_SHARED_NOTE);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user has shared a social note") != 0);
|
||||
}
|
||||
|
@ -4251,7 +4251,7 @@ static bool Soc_CheckIfNoteIsFavedByUsr (long NotCod,long UsrCod)
|
|||
char Query[256];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_notes_fav"
|
||||
" WHERE NotCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||
NotCod,UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user has favourited a social note") != 0);
|
||||
}
|
||||
|
@ -4265,7 +4265,7 @@ static bool Soc_CheckIfCommIsFavedByUsr (long PubCod,long UsrCod)
|
|||
char Query[256];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_comments_fav"
|
||||
" WHERE PubCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||
PubCod,UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user has favourited a social comment") != 0);
|
||||
}
|
||||
|
@ -4280,9 +4280,9 @@ static unsigned Soc_UpdateNumTimesANoteHasBeenShared (struct SocialNote *SocNot)
|
|||
|
||||
/***** Get number of times (users) this note has been shared *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_pubs"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND PublisherCod<>'%ld'"
|
||||
" AND PubType='%u'",
|
||||
" WHERE NotCod=%ld"
|
||||
" AND PublisherCod<>%ld"
|
||||
" AND PubType=%u",
|
||||
SocNot->NotCod,
|
||||
SocNot->UsrCod, // The author
|
||||
(unsigned) Soc_PUB_SHARED_NOTE);
|
||||
|
@ -4299,8 +4299,8 @@ static unsigned Soc_GetNumTimesANoteHasBeenFav (struct SocialNote *SocNot)
|
|||
|
||||
/***** Get number of times (users) this note has been favourited *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_notes_fav"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND UsrCod<>'%ld'", // Extra check
|
||||
" WHERE NotCod=%ld"
|
||||
" AND UsrCod<>%ld", // Extra check
|
||||
SocNot->NotCod,
|
||||
SocNot->UsrCod); // The author
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of times a note has been favourited");
|
||||
|
@ -4316,8 +4316,8 @@ static unsigned Soc_GetNumTimesACommHasBeenFav (struct SocialComment *SocCom)
|
|||
|
||||
/***** Get number of times (users) this comment has been favourited *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_comments_fav"
|
||||
" WHERE PubCod='%ld'"
|
||||
" AND UsrCod<>'%ld'", // Extra check
|
||||
" WHERE PubCod=%ld"
|
||||
" AND UsrCod<>%ld", // Extra check
|
||||
SocCom->PubCod,
|
||||
SocCom->UsrCod); // The author
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of times a comment has been favourited");
|
||||
|
@ -4333,9 +4333,9 @@ static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot
|
|||
|
||||
/***** Get users who have shared this note *****/
|
||||
sprintf (Query,"SELECT PublisherCod FROM social_pubs"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND PublisherCod<>'%ld'"
|
||||
" AND PubType='%u'"
|
||||
" WHERE NotCod=%ld"
|
||||
" AND PublisherCod<>%ld"
|
||||
" AND PubType=%u"
|
||||
" ORDER BY PubCod LIMIT %u",
|
||||
SocNot->NotCod,
|
||||
SocNot->UsrCod,
|
||||
|
@ -4354,8 +4354,8 @@ static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *S
|
|||
|
||||
/***** Get users who have marked this note as favourite *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM social_notes_fav"
|
||||
" WHERE NotCod='%ld'"
|
||||
" AND UsrCod<>'%ld'" // Extra check
|
||||
" WHERE NotCod=%ld"
|
||||
" AND UsrCod<>%ld" // Extra check
|
||||
" ORDER BY FavCod LIMIT %u",
|
||||
SocNot->NotCod,
|
||||
SocNot->UsrCod,
|
||||
|
@ -4373,8 +4373,8 @@ static void Soc_ShowUsrsWhoHaveMarkedSocialCommAsFav (const struct SocialComment
|
|||
|
||||
/***** Get users who have marked this comment as favourite *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM social_comments_fav"
|
||||
" WHERE PubCod='%ld'"
|
||||
" AND UsrCod<>'%ld'" // Extra check
|
||||
" WHERE PubCod=%ld"
|
||||
" AND UsrCod<>%ld" // Extra check
|
||||
" ORDER BY FavCod LIMIT %u",
|
||||
SocCom->PubCod,
|
||||
SocCom->UsrCod,
|
||||
|
@ -4470,7 +4470,7 @@ static void Soc_GetDataOfSocialNotByCod (struct SocialNote *SocNot)
|
|||
/***** Get data of social note from database *****/
|
||||
sprintf (Query,"SELECT NotCod,NoteType,Cod,UsrCod,HieCod,Unavailable,UNIX_TIMESTAMP(TimeNote)"
|
||||
" FROM social_notes"
|
||||
" WHERE NotCod='%ld'",
|
||||
" WHERE NotCod=%ld",
|
||||
SocNot->NotCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social note"))
|
||||
{
|
||||
|
@ -4511,8 +4511,8 @@ static void Soc_GetDataOfSocialComByCod (struct SocialComment *SocCom)
|
|||
"social_comments.ImageTitle,"
|
||||
"social_comments.ImageURL"
|
||||
" FROM social_pubs,social_comments"
|
||||
" WHERE social_pubs.PubCod='%ld'"
|
||||
" AND social_pubs.PubType='%u'"
|
||||
" WHERE social_pubs.PubCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
||||
SocCom->PubCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social comment"))
|
||||
|
@ -4763,7 +4763,7 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/***** Get summary and content from social post from database *****/
|
||||
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)"
|
||||
" FROM social_pubs WHERE PubCod='%ld'",
|
||||
" FROM social_pubs WHERE PubCod=%ld",
|
||||
PubCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social publishing") == 1) // Result should have a unique row
|
||||
{
|
||||
|
@ -4791,7 +4791,7 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/***** Get content of social post from database *****/
|
||||
// TODO: What happens if content is empty and an image is attached?
|
||||
sprintf (Query,"SELECT Content FROM social_posts"
|
||||
" WHERE PstCod='%ld'",
|
||||
" WHERE PstCod=%ld",
|
||||
SocNot.Cod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post") == 1) // Result should have a unique row
|
||||
{
|
||||
|
@ -4830,7 +4830,7 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/***** Get content of social post from database *****/
|
||||
// TODO: What happens if content is empty and an image is attached?
|
||||
sprintf (Query,"SELECT Content FROM social_comments"
|
||||
" WHERE PubCod='%ld'",
|
||||
" WHERE PubCod=%ld",
|
||||
SocPub.PubCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the content of a comment to a social note") == 1) // Result should have a unique row
|
||||
{
|
||||
|
|
624
swad_statistic.c
624
swad_statistic.c
File diff suppressed because it is too large
Load Diff
150
swad_survey.c
150
swad_survey.c
|
@ -874,7 +874,7 @@ void Svy_GetListSurveys (void)
|
|||
Scope++)
|
||||
if (ScopesAllowed & 1 << Scope)
|
||||
{
|
||||
sprintf (SubQuery[Scope],"%s(Scope='%s' AND Cod='%ld'%s)",
|
||||
sprintf (SubQuery[Scope],"%s(Scope='%s' AND Cod=%ld%s)",
|
||||
SubQueryFilled ? " OR " :
|
||||
"",
|
||||
Sco_ScopeDB[Scope],Cods[Scope],
|
||||
|
@ -890,7 +890,7 @@ void Svy_GetListSurveys (void)
|
|||
{
|
||||
if (Gbl.CurrentCrs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS)
|
||||
sprintf (SubQuery[Sco_SCOPE_CRS],"%s("
|
||||
"Scope='%s' AND Cod='%ld'%s"
|
||||
"Scope='%s' AND Cod=%ld%s"
|
||||
" AND "
|
||||
"(SvyCod NOT IN"
|
||||
" (SELECT SvyCod FROM svy_grp)"
|
||||
|
@ -898,7 +898,7 @@ void Svy_GetListSurveys (void)
|
|||
" SvyCod IN"
|
||||
" (SELECT svy_grp.SvyCod"
|
||||
" FROM svy_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod))"
|
||||
")",
|
||||
SubQueryFilled ? " OR " :
|
||||
|
@ -908,7 +908,7 @@ void Svy_GetListSurveys (void)
|
|||
" AND Hidden='N'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
else // Gbl.CurrentCrs.Grps.WhichGrps == Grp_ALL_GROUPS
|
||||
sprintf (SubQuery[Sco_SCOPE_CRS],"%s(Scope='%s' AND Cod='%ld'%s)",
|
||||
sprintf (SubQuery[Sco_SCOPE_CRS],"%s(Scope='%s' AND Cod=%ld%s)",
|
||||
SubQueryFilled ? " OR " :
|
||||
"",
|
||||
Sco_ScopeDB[Sco_SCOPE_CRS],Cods[Sco_SCOPE_CRS],
|
||||
|
@ -1161,7 +1161,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
|
|||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"Title"
|
||||
" FROM surveys"
|
||||
" WHERE SvyCod='%ld'",
|
||||
" WHERE SvyCod=%ld",
|
||||
Svy->SvyCod);
|
||||
|
||||
/***** Get data of survey from database *****/
|
||||
|
@ -1375,7 +1375,7 @@ static void Svy_GetSurveyTxtFromDB (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]
|
|||
unsigned long NumRows;
|
||||
|
||||
/***** Get text of survey from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM surveys WHERE SvyCod='%ld'",SvyCod);
|
||||
sprintf (Query,"SELECT Txt FROM surveys WHERE SvyCod=%ld",SvyCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get survey text");
|
||||
|
||||
/***** The result of the query must have one row or none *****/
|
||||
|
@ -1413,7 +1413,7 @@ void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT Title,Txt FROM surveys WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"SELECT Title,Txt FROM surveys WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
|
@ -1523,20 +1523,20 @@ void Svy_RemoveSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not remove this survey.");
|
||||
|
||||
/***** Remove all the users in this survey *****/
|
||||
sprintf (Query,"DELETE FROM svy_users WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_users WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove users who are answered a survey");
|
||||
|
||||
/***** Remove all the answers in this survey *****/
|
||||
sprintf (Query,"DELETE FROM svy_answers USING svy_questions,svy_answers"
|
||||
" WHERE svy_questions.SvyCod='%ld'"
|
||||
" WHERE svy_questions.SvyCod=%ld"
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
Svy.SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove answers of a survey");
|
||||
|
||||
/***** Remove all the questions in this survey *****/
|
||||
sprintf (Query,"DELETE FROM svy_questions"
|
||||
" WHERE SvyCod='%ld'",
|
||||
" WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove questions of a survey");
|
||||
|
||||
|
@ -1544,7 +1544,7 @@ void Svy_RemoveSurvey (void)
|
|||
Svy_RemoveAllTheGrpsAssociatedToAndSurvey (Svy.SvyCod);
|
||||
|
||||
/***** Remove survey *****/
|
||||
sprintf (Query,"DELETE FROM surveys WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM surveys WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove survey");
|
||||
|
||||
|
@ -1632,13 +1632,13 @@ void Svy_ResetSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not reset this survey.");
|
||||
|
||||
/***** Remove all the users in this survey *****/
|
||||
sprintf (Query,"DELETE FROM svy_users WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_users WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove users who are answered a survey");
|
||||
|
||||
/***** Reset all the answers in this survey *****/
|
||||
sprintf (Query,"UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs='0'"
|
||||
" WHERE svy_questions.SvyCod='%ld'"
|
||||
sprintf (Query,"UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs=0"
|
||||
" WHERE svy_questions.SvyCod=%ld"
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
Svy.SvyCod);
|
||||
DB_QueryUPDATE (Query,"can not reset answers of a survey");
|
||||
|
@ -1673,7 +1673,7 @@ void Svy_HideSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not hide this survey.");
|
||||
|
||||
/***** Hide survey *****/
|
||||
sprintf (Query,"UPDATE surveys SET Hidden='Y' WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"UPDATE surveys SET Hidden='Y' WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryUPDATE (Query,"can not hide survey");
|
||||
|
||||
|
@ -1707,7 +1707,7 @@ void Svy_UnhideSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not unhide this survey.");
|
||||
|
||||
/***** Show survey *****/
|
||||
sprintf (Query,"UPDATE surveys SET Hidden='N' WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"UPDATE surveys SET Hidden='N' WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
DB_QueryUPDATE (Query,"can not show survey");
|
||||
|
||||
|
@ -1731,8 +1731,8 @@ static bool Svy_CheckIfSimilarSurveyExists (struct Survey *Svy)
|
|||
|
||||
/***** Get number of surveys with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM surveys"
|
||||
" WHERE Scope='%s' AND Cod='%ld'"
|
||||
" AND Title='%s' AND SvyCod<>'%ld'",
|
||||
" WHERE Scope='%s' AND Cod=%ld"
|
||||
" AND Title='%s' AND SvyCod<>%ld",
|
||||
Sco_ScopeDB[Svy->Scope],Svy->Cod,
|
||||
Svy->Title,Svy->SvyCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get similar surveys") != 0);
|
||||
|
@ -2201,8 +2201,8 @@ static void Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
|
|||
char Query[256];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE surveys SET NumNotif=NumNotif+'%u'"
|
||||
" WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"UPDATE surveys SET NumNotif=NumNotif+%u"
|
||||
" WHERE SvyCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,SvyCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of notifications of a survey");
|
||||
}
|
||||
|
@ -2223,8 +2223,8 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt)
|
|||
sprintf (Query,"INSERT INTO surveys"
|
||||
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
|
||||
" VALUES"
|
||||
" ('%s','%ld','N','%u','%ld',"
|
||||
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
" ('%s',%ld,'N',%u,%ld,"
|
||||
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||
"'%s','%s')",
|
||||
Sco_ScopeDB[Svy->Scope],Svy->Cod,
|
||||
Svy->Roles,
|
||||
|
@ -2259,11 +2259,11 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt)
|
|||
|
||||
/***** Update the data of the survey *****/
|
||||
sprintf (Query,"UPDATE surveys"
|
||||
" SET Scope='%s',Cod='%ld',Roles='%u',"
|
||||
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',Txt='%s'"
|
||||
" WHERE SvyCod='%ld'",
|
||||
" WHERE SvyCod=%ld",
|
||||
Sco_ScopeDB[Svy->Scope],Svy->Cod,
|
||||
Svy->Roles,
|
||||
Svy->TimeUTC[Svy_START_TIME],
|
||||
|
@ -2294,7 +2294,7 @@ static bool Svy_CheckIfSvyIsAssociatedToGrps (long SvyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get if a survey is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_grp WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_grp WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a survey is associated to groups") != 0);
|
||||
}
|
||||
|
@ -2309,7 +2309,7 @@ bool Svy_CheckIfSvyIsAssociatedToGrp (long SvyCod,long GrpCod)
|
|||
|
||||
/***** Get if a survey is associated to a group from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_grp"
|
||||
" WHERE SvyCod='%ld' AND GrpCod='%ld'",
|
||||
" WHERE SvyCod=%ld AND GrpCod=%ld",
|
||||
SvyCod,GrpCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a survey is associated to a group") != 0);
|
||||
}
|
||||
|
@ -2323,7 +2323,7 @@ static void Svy_RemoveAllTheGrpsAssociatedToAndSurvey (long SvyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove groups of the survey *****/
|
||||
sprintf (Query,"DELETE FROM svy_grp WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_grp WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
DB_QueryDELETE (Query,"can not remove the groups associated to a survey");
|
||||
}
|
||||
|
@ -2337,7 +2337,7 @@ void Svy_RemoveGroup (long GrpCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove group from all the surveys *****/
|
||||
sprintf (Query,"DELETE FROM svy_grp WHERE GrpCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_grp WHERE GrpCod=%ld",
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove group"
|
||||
" from the associations between surveys and groups");
|
||||
|
@ -2353,7 +2353,7 @@ void Svy_RemoveGroupsOfType (long GrpTypCod)
|
|||
|
||||
/***** Remove group from all the surveys *****/
|
||||
sprintf (Query,"DELETE FROM svy_grp USING crs_grp,svy_grp"
|
||||
" WHERE crs_grp.GrpTypCod='%ld'"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=svy_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE (Query,"can not remove groups of a type"
|
||||
|
@ -2378,7 +2378,7 @@ static void Svy_CreateGrps (long SvyCod)
|
|||
sprintf (Query,"INSERT INTO svy_grp"
|
||||
" (SvyCod,GrpCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
SvyCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||
DB_QueryINSERT (Query,"can not associate a group to a survey");
|
||||
}
|
||||
|
@ -2403,7 +2403,7 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Survey *Svy)
|
|||
/***** Get groups associated to a survey from database *****/
|
||||
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
|
||||
" FROM svy_grp,crs_grp,crs_grp_types"
|
||||
" WHERE svy_grp.SvyCod='%ld'"
|
||||
" WHERE svy_grp.SvyCod=%ld"
|
||||
" AND svy_grp.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
|
@ -2464,7 +2464,7 @@ void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod)
|
|||
/***** Remove all the users in course surveys *****/
|
||||
sprintf (Query,"DELETE FROM svy_users"
|
||||
" USING surveys,svy_users"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod='%ld'"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod=%ld"
|
||||
" AND surveys.SvyCod=svy_users.SvyCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove users"
|
||||
|
@ -2473,7 +2473,7 @@ void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod)
|
|||
/***** Remove all the answers in course surveys *****/
|
||||
sprintf (Query,"DELETE FROM svy_answers"
|
||||
" USING surveys,svy_questions,svy_answers"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod='%ld'"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod=%ld"
|
||||
" AND surveys.SvyCod=svy_questions.SvyCod"
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
|
@ -2482,7 +2482,7 @@ void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod)
|
|||
/***** Remove all the questions in course surveys *****/
|
||||
sprintf (Query,"DELETE FROM svy_questions"
|
||||
" USING surveys,svy_questions"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod='%ld'"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod=%ld"
|
||||
" AND surveys.SvyCod=svy_questions.SvyCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove questions of surveys in a place on the hierarchy");
|
||||
|
@ -2490,7 +2490,7 @@ void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod)
|
|||
/***** Remove groups *****/
|
||||
sprintf (Query,"DELETE FROM svy_grp"
|
||||
" USING surveys,svy_grp"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod='%ld'"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod=%ld"
|
||||
" AND surveys.SvyCod=svy_grp.SvyCod",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove all the groups"
|
||||
|
@ -2498,7 +2498,7 @@ void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod)
|
|||
|
||||
/***** Remove course surveys *****/
|
||||
sprintf (Query,"DELETE FROM surveys"
|
||||
" WHERE Scope='%s' AND Cod='%ld'",
|
||||
" WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Scope],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove all the surveys in a place on the hierarchy");
|
||||
}
|
||||
|
@ -2513,10 +2513,10 @@ static bool Svy_CheckIfICanDoThisSurveyBasedOnGrps (long SvyCod)
|
|||
|
||||
/***** Get if I can do a survey from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM surveys"
|
||||
" WHERE SvyCod='%ld'"
|
||||
" WHERE SvyCod=%ld"
|
||||
" AND (SvyCod NOT IN (SELECT SvyCod FROM svy_grp) OR"
|
||||
" SvyCod IN (SELECT svy_grp.SvyCod FROM svy_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod))",
|
||||
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if I can do a survey") != 0);
|
||||
|
@ -2531,7 +2531,7 @@ static unsigned Svy_GetNumQstsSvy (long SvyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get data of questions from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_questions WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_questions WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of questions of a survey");
|
||||
}
|
||||
|
@ -2599,7 +2599,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
|||
/***** Get the type of answer and the stem from the database *****/
|
||||
/* Get the question from database */
|
||||
sprintf (Query,"SELECT QstInd,AnsType,Stem FROM svy_questions"
|
||||
" WHERE QstCod='%ld' AND SvyCod='%ld'",
|
||||
" WHERE QstCod=%ld AND SvyCod=%ld",
|
||||
SvyQst->QstCod,SvyCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get a question");
|
||||
|
||||
|
@ -2803,7 +2803,7 @@ static void Svy_RemAnswersOfAQuestion (long QstCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove answers *****/
|
||||
sprintf (Query,"DELETE FROM svy_answers WHERE QstCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_answers WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
DB_QueryDELETE (Query,"can not remove the answers of a question");
|
||||
}
|
||||
|
@ -2835,7 +2835,7 @@ static bool Svy_CheckIfAnswerExists (long QstCod,unsigned AnsInd)
|
|||
|
||||
/***** Get answers of a question from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_answers"
|
||||
" WHERE QstCod='%ld' AND AnsInd='%u'",
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
QstCod,AnsInd);
|
||||
return (DB_QueryCOUNT (Query,"can not check if an answer exists") != 0);
|
||||
}
|
||||
|
@ -2851,7 +2851,7 @@ static unsigned Svy_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res)
|
|||
|
||||
/***** Get answers of a question from database *****/
|
||||
sprintf (Query,"SELECT AnsInd,NumUsrs,Answer FROM svy_answers"
|
||||
" WHERE QstCod='%ld' ORDER BY AnsInd",
|
||||
" WHERE QstCod=%ld ORDER BY AnsInd",
|
||||
QstCod);
|
||||
NumRows = DB_QuerySELECT (Query,mysql_res,"can not get answers of a question");
|
||||
|
||||
|
@ -3010,7 +3010,7 @@ void Svy_ReceiveQst (void)
|
|||
sprintf (Query,"INSERT INTO svy_questions"
|
||||
" (SvyCod,QstInd,AnsType,Stem)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%s','%s')",
|
||||
" (%ld,%u,'%s','%s')",
|
||||
SvyCod,SvyQst.QstInd,Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
|
||||
SvyQst.QstCod = DB_QueryINSERTandReturnCode (Query,"can not create question");
|
||||
}
|
||||
|
@ -3018,7 +3018,7 @@ void Svy_ReceiveQst (void)
|
|||
{
|
||||
/* Update question */
|
||||
sprintf (Query,"UPDATE svy_questions SET Stem='%s',AnsType='%s'"
|
||||
" WHERE QstCod='%ld' AND SvyCod='%ld'",
|
||||
" WHERE QstCod=%ld AND SvyCod=%ld",
|
||||
Txt,Svy_StrAnswerTypesDB[SvyQst.AnswerType],
|
||||
SvyQst.QstCod,SvyCod);
|
||||
DB_QueryUPDATE (Query,"can not update question");
|
||||
|
@ -3034,7 +3034,7 @@ void Svy_ReceiveQst (void)
|
|||
{
|
||||
/* Update answer text */
|
||||
sprintf (Query,"UPDATE svy_answers SET Answer='%s'"
|
||||
" WHERE QstCod='%ld' AND AnsInd='%u'",
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
SvyQst.AnsChoice[NumAns].Text,SvyQst.QstCod,NumAns);
|
||||
DB_QueryUPDATE (Query,"can not update answer");
|
||||
}
|
||||
|
@ -3042,7 +3042,7 @@ void Svy_ReceiveQst (void)
|
|||
{
|
||||
/* Delete answer from database */
|
||||
sprintf (Query,"DELETE FROM svy_answers"
|
||||
" WHERE QstCod='%ld' AND AnsInd='%u'",
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
SvyQst.QstCod,NumAns);
|
||||
DB_QueryDELETE (Query,"can not delete answer");
|
||||
}
|
||||
|
@ -3055,7 +3055,7 @@ void Svy_ReceiveQst (void)
|
|||
sprintf (Query,"INSERT INTO svy_answers"
|
||||
" (QstCod,AnsInd,NumUsrs,Answer)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','0','%s')",
|
||||
" (%ld,%u,0,'%s')",
|
||||
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
|
||||
DB_QueryINSERT (Query,"can not create answer");
|
||||
}
|
||||
|
@ -3085,7 +3085,7 @@ static unsigned Svy_GetQstIndFromQstCod (long QstCod)
|
|||
unsigned QstInd = 0;
|
||||
|
||||
/***** Get number of surveys with a field value from database *****/
|
||||
sprintf (Query,"SELECT QstInd FROM svy_questions WHERE QstCod='%ld'",
|
||||
sprintf (Query,"SELECT QstInd FROM svy_questions WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get question index");
|
||||
|
||||
|
@ -3117,7 +3117,7 @@ static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod)
|
|||
unsigned QstInd = 0;
|
||||
|
||||
/***** Get number of surveys with a field value from database *****/
|
||||
sprintf (Query,"SELECT MAX(QstInd) FROM svy_questions WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"SELECT MAX(QstInd) FROM svy_questions WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get last question index");
|
||||
|
||||
|
@ -3163,7 +3163,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
|
|||
|
||||
/***** Get data of questions from database *****/
|
||||
sprintf (Query,"SELECT QstCod,QstInd,AnsType,Stem"
|
||||
" FROM svy_questions WHERE SvyCod='%ld' ORDER BY QstInd",
|
||||
" FROM svy_questions WHERE SvyCod=%ld ORDER BY QstInd",
|
||||
Svy->SvyCod);
|
||||
NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get data of a question");
|
||||
|
||||
|
@ -3577,7 +3577,7 @@ void Svy_RemoveQst (void)
|
|||
Svy_RemAnswersOfAQuestion (SvyQst.QstCod);
|
||||
|
||||
/* Remove the question itself */
|
||||
sprintf (Query,"DELETE FROM svy_questions WHERE QstCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM svy_questions WHERE QstCod=%ld",
|
||||
SvyQst.QstCod);
|
||||
DB_QueryDELETE (Query,"can not remove a question");
|
||||
if (!mysql_affected_rows (&Gbl.mysql))
|
||||
|
@ -3585,7 +3585,7 @@ void Svy_RemoveQst (void)
|
|||
|
||||
/* Change index of questions greater than this */
|
||||
sprintf (Query,"UPDATE svy_questions SET QstInd=QstInd-1"
|
||||
" WHERE SvyCod='%ld' AND QstInd>'%u'",
|
||||
" WHERE SvyCod=%ld AND QstInd>%u",
|
||||
SvyCod,SvyQst.QstInd);
|
||||
DB_QueryUPDATE (Query,"can not update indexes of questions");
|
||||
|
||||
|
@ -3649,7 +3649,7 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
|||
|
||||
/***** Get questions of this survey from database *****/
|
||||
sprintf (Query,"SELECT QstCod FROM svy_questions"
|
||||
" WHERE SvyCod='%ld' ORDER BY QstCod",
|
||||
" WHERE SvyCod=%ld ORDER BY QstCod",
|
||||
SvyCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get questions of a survey");
|
||||
|
||||
|
@ -3702,7 +3702,7 @@ static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
|
|||
|
||||
/***** Increase number of users who have selected the answer AnsInd in the question QstCod *****/
|
||||
sprintf (Query,"UPDATE svy_answers SET NumUsrs=NumUsrs+1"
|
||||
" WHERE QstCod='%ld' AND AnsInd='%u'",
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
QstCod,AnsInd);
|
||||
DB_QueryINSERT (Query,"can not register your answer to the survey");
|
||||
}
|
||||
|
@ -3718,7 +3718,7 @@ static void Svy_RegisterIHaveAnsweredSvy (long SvyCod)
|
|||
sprintf (Query,"INSERT INTO svy_users"
|
||||
" (SvyCod,UsrCod)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld')",
|
||||
" (%ld,%ld)",
|
||||
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not register that you have answered the survey");
|
||||
}
|
||||
|
@ -3733,7 +3733,7 @@ static bool Svy_CheckIfIHaveAnsweredSvy (long SvyCod)
|
|||
|
||||
/***** Get number of surveys with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_users"
|
||||
" WHERE SvyCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE SvyCod=%ld AND UsrCod=%ld",
|
||||
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if you have answered a survey") != 0);
|
||||
}
|
||||
|
@ -3747,7 +3747,7 @@ static unsigned Svy_GetNumUsrsWhoHaveAnsweredSvy (long SvyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get number of surveys with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_users WHERE SvyCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM svy_users WHERE SvyCod=%ld",
|
||||
SvyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of users who have answered a survey");
|
||||
}
|
||||
|
@ -3778,7 +3778,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT surveys.Cod)"
|
||||
" FROM institutions,centres,degrees,courses,surveys"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -3790,7 +3790,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT surveys.Cod)"
|
||||
" FROM centres,degrees,courses,surveys"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
|
@ -3801,7 +3801,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT surveys.Cod)"
|
||||
" FROM degrees,courses,surveys"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'",
|
||||
|
@ -3811,7 +3811,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT surveys.Cod)"
|
||||
" FROM courses,surveys"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -3820,7 +3820,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope)
|
|||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT Cod)"
|
||||
" FROM surveys"
|
||||
" WHERE Scope='%s' AND Cod='%ld'",
|
||||
" WHERE Scope='%s' AND Cod=%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_CRS],
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -3867,7 +3867,7 @@ unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
|
||||
" FROM institutions,centres,degrees,courses,surveys"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -3879,7 +3879,7 @@ unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
|
||||
" FROM centres,degrees,courses,surveys"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
|
@ -3890,7 +3890,7 @@ unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
|
||||
" FROM degrees,courses,surveys"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'",
|
||||
|
@ -3900,7 +3900,7 @@ unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
|
||||
" FROM courses,surveys"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -3910,7 +3910,7 @@ unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM surveys"
|
||||
" WHERE surveys.Scope='%s'"
|
||||
" AND CrsCod='%ld'",
|
||||
" AND CrsCod=%ld",
|
||||
Sco_ScopeDB[Sco_SCOPE_CRS],
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
|
@ -3968,7 +3968,7 @@ float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM institutions,centres,degrees,courses,surveys,svy_questions"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -3983,7 +3983,7 @@ float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM centres,degrees,courses,surveys,svy_questions"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
|
@ -3997,7 +3997,7 @@ float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM degrees,courses,surveys,svy_questions"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'"
|
||||
|
@ -4010,7 +4010,7 @@ float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM courses,surveys,svy_questions"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=surveys.Cod"
|
||||
" AND surveys.Scope='%s'"
|
||||
" AND surveys.SvyCod=svy_questions.SvyCod"
|
||||
|
@ -4022,7 +4022,7 @@ float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM surveys,svy_questions"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod='%ld'"
|
||||
" WHERE surveys.Scope='%s' AND surveys.Cod=%ld"
|
||||
" AND surveys.SvyCod=svy_questions.SvyCod"
|
||||
" GROUP BY svy_questions.SvyCod) AS NumQstsTable",
|
||||
Sco_ScopeDB[Sco_SCOPE_CRS],Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
|
218
swad_test.c
218
swad_test.c
|
@ -650,7 +650,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
|
|||
sprintf (Query,"SELECT UNIX_TIMESTAMP(LastAccTst+INTERVAL (NumQstsLastTst*%lu) SECOND)-UNIX_TIMESTAMP(),"
|
||||
"UNIX_TIMESTAMP(LastAccTst+INTERVAL (NumQstsLastTst*%lu) SECOND)"
|
||||
" FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Test.Config.MinTimeNxtTstPerQst,
|
||||
Gbl.Test.Config.MinTimeNxtTstPerQst,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -704,7 +704,7 @@ static void Tst_SetTstStatus (unsigned NumTst,Tst_Status_t TstStatus)
|
|||
sprintf (Query,"REPLACE INTO tst_status"
|
||||
" (SessionId,CrsCod,NumTst,Status)"
|
||||
" VALUES"
|
||||
" ('%s','%ld','%u','%u')",
|
||||
" ('%s',%ld,%u,%u)",
|
||||
Gbl.Session.Id,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
NumTst,(unsigned) TstStatus);
|
||||
DB_QueryREPLACE (Query,"can not update status of test");
|
||||
|
@ -725,7 +725,7 @@ static Tst_Status_t Tst_GetTstStatus (unsigned NumTst)
|
|||
|
||||
/***** Get status of test from database *****/
|
||||
sprintf (Query,"SELECT Status FROM tst_status"
|
||||
" WHERE SessionId='%s' AND CrsCod='%ld' AND NumTst='%u'",
|
||||
" WHERE SessionId='%s' AND CrsCod=%ld AND NumTst=%u",
|
||||
Gbl.Session.Id,Gbl.CurrentCrs.Crs.CrsCod,NumTst);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get status of test");
|
||||
|
||||
|
@ -761,7 +761,7 @@ static unsigned Tst_GetNumAccessesTst (void)
|
|||
{
|
||||
/***** Get number of hits to test from database *****/
|
||||
sprintf (Query,"SELECT NumAccTst FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get number of hits to test");
|
||||
|
||||
|
@ -837,7 +837,7 @@ static void Tst_ShowTstTagsPresentInATestResult (long TstCod)
|
|||
sprintf (Query,"SELECT tst_tags.TagTxt FROM"
|
||||
" (SELECT DISTINCT(tst_question_tags.TagCod)"
|
||||
" FROM tst_question_tags,tst_exam_questions"
|
||||
" WHERE tst_exam_questions.TstCod='%ld'"
|
||||
" WHERE tst_exam_questions.TstCod=%ld"
|
||||
" AND tst_exam_questions.QstCod=tst_question_tags.QstCod)"
|
||||
" AS TagsCods,tst_tags"
|
||||
" WHERE TagsCods.TagCod=tst_tags.TagCod"
|
||||
|
@ -1193,12 +1193,12 @@ static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotB
|
|||
sprintf (Query,"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1,"
|
||||
"Score=Score+(%lf)"
|
||||
" WHERE QstCod='%ld'",
|
||||
" WHERE QstCod=%ld",
|
||||
ScoreThisQst,QstCod);
|
||||
else // The answer is blank
|
||||
sprintf (Query,"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1"
|
||||
" WHERE QstCod='%ld'",
|
||||
" WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
DB_QueryUPDATE (Query,"can not update the score of a question");
|
||||
|
@ -1213,8 +1213,8 @@ static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst)
|
|||
char Query[256];
|
||||
|
||||
/***** Update my number of accesses to test in this course *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET NumAccTst='%u'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr SET NumAccTst=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
NumAccessesTst,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of accesses to test");
|
||||
|
@ -1229,8 +1229,8 @@ static void Tst_UpdateLastAccTst (void)
|
|||
char Query[256];
|
||||
|
||||
/***** Update date-time and number of questions of this test *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst='%u'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Test.NumQsts,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -1506,7 +1506,7 @@ void Tst_RenameTag (void)
|
|||
sprintf (Query,"CREATE TEMPORARY TABLE tst_question_tags_tmp"
|
||||
" ENGINE=MEMORY"
|
||||
" SELECT QstCod FROM tst_question_tags"
|
||||
" WHERE TagCod='%ld'",
|
||||
" WHERE TagCod=%ld",
|
||||
ExistingTagCod);
|
||||
if (mysql_query (&Gbl.mysql,Query))
|
||||
DB_ExitOnMySQLError ("can not create temporary table");
|
||||
|
@ -1514,7 +1514,7 @@ void Tst_RenameTag (void)
|
|||
/* Remove old tag in questions where it would be repeated */
|
||||
// New tag existed for a question ==> delete old tag
|
||||
sprintf (Query,"DELETE FROM tst_question_tags"
|
||||
" WHERE TagCod='%ld'"
|
||||
" WHERE TagCod=%ld"
|
||||
" AND QstCod IN"
|
||||
" (SELECT QstCod FROM tst_question_tags_tmp)",
|
||||
OldTagCod);
|
||||
|
@ -1523,8 +1523,8 @@ void Tst_RenameTag (void)
|
|||
/* Change old tag to new tag in questions where it would not be repeated */
|
||||
// New tag did not exist for a question ==> change old tag to new tag
|
||||
sprintf (Query,"UPDATE tst_question_tags"
|
||||
" SET TagCod='%ld'"
|
||||
" WHERE TagCod='%ld'"
|
||||
" SET TagCod=%ld"
|
||||
" WHERE TagCod=%ld"
|
||||
" AND QstCod NOT IN"
|
||||
" (SELECT QstCod FROM tst_question_tags_tmp)",
|
||||
ExistingTagCod,
|
||||
|
@ -1538,7 +1538,7 @@ void Tst_RenameTag (void)
|
|||
|
||||
/***** Delete old tag from tst_tags
|
||||
because it is not longer used *****/
|
||||
sprintf (Query,"DELETE FROM tst_tags WHERE TagCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_tags WHERE TagCod=%ld",
|
||||
OldTagCod);
|
||||
DB_QueryDELETE (Query,"can not remove old tag");
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ void Tst_RenameTag (void)
|
|||
{
|
||||
/***** Simple update replacing each instance of the old tag by the new tag *****/
|
||||
sprintf (Query,"UPDATE tst_tags SET TagTxt='%s',ChangeTime=NOW()"
|
||||
" WHERE tst_tags.CrsCod='%ld'"
|
||||
" WHERE tst_tags.CrsCod=%ld"
|
||||
" AND tst_tags.TagTxt='%s'",
|
||||
NewTagTxt,Gbl.CurrentCrs.Crs.CrsCod,OldTagTxt);
|
||||
DB_QueryUPDATE (Query,"can not update tag");
|
||||
|
@ -1573,7 +1573,7 @@ static bool Tst_CheckIfCurrentCrsHasTestTags (void)
|
|||
char Query[128];
|
||||
|
||||
/***** Get available tags from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM tst_tags WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM tst_tags WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if course has tags") != 0);
|
||||
}
|
||||
|
@ -1589,7 +1589,7 @@ static unsigned long Tst_GetAllTagsFromCurrentCrs (MYSQL_RES **mysql_res)
|
|||
|
||||
/***** Get available tags from database *****/
|
||||
sprintf (Query,"SELECT TagCod,TagTxt,TagHidden FROM tst_tags"
|
||||
" WHERE CrsCod='%ld' ORDER BY TagTxt",
|
||||
" WHERE CrsCod=%ld ORDER BY TagTxt",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,"can not get available tags");
|
||||
}
|
||||
|
@ -1605,7 +1605,7 @@ static unsigned long Tst_GetEnabledTagsFromThisCrs (MYSQL_RES **mysql_res)
|
|||
|
||||
/***** Get available not hidden tags from database *****/
|
||||
sprintf (Query,"SELECT TagCod,TagTxt FROM tst_tags"
|
||||
" WHERE CrsCod='%ld' AND TagHidden='N' ORDER BY TagTxt",
|
||||
" WHERE CrsCod=%ld AND TagHidden='N' ORDER BY TagTxt",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,"can not get available enabled tags");
|
||||
}
|
||||
|
@ -1978,7 +1978,7 @@ static void Tst_GetConfigTstFromDB (void)
|
|||
|
||||
/***** Get configuration of test for current course from database *****/
|
||||
sprintf (Query,"SELECT Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback"
|
||||
" FROM tst_config WHERE CrsCod='%ld'",
|
||||
" FROM tst_config WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get configuration of test");
|
||||
|
||||
|
@ -2077,7 +2077,7 @@ bool Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown (void)
|
|||
Tst_Pluggable_t Pluggable;
|
||||
|
||||
/***** Get pluggability of tests for current course from database *****/
|
||||
sprintf (Query,"SELECT Pluggable FROM tst_config WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT Pluggable FROM tst_config WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get configuration of test");
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ void Tst_ReceiveConfigTst (void)
|
|||
sprintf (Query,"REPLACE INTO tst_config"
|
||||
" (CrsCod,Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback)"
|
||||
" VALUES"
|
||||
" ('%ld','%s','%u','%u','%u','%lu','%s')",
|
||||
" (%ld,'%s',%u,%u,%u,'%lu','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Tst_PluggableDB[Gbl.Test.Config.Pluggable],
|
||||
Gbl.Test.Config.Min,Gbl.Test.Config.Def,Gbl.Test.Config.Max,
|
||||
|
@ -2556,15 +2556,15 @@ static unsigned long Tst_GetQuestionsForTest (MYSQL_RES **mysql_res)
|
|||
"tst_questions.NumHits,tst_questions.NumHitsNotBlank,"
|
||||
"tst_questions.Score"
|
||||
" FROM tst_questions,tst_question_tags,tst_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod"
|
||||
" FROM tst_tags,tst_question_tags"
|
||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagHidden='Y'"
|
||||
" WHERE tst_tags.CrsCod=%ld AND tst_tags.TagHidden='Y'"
|
||||
" AND tst_tags.TagCod=tst_question_tags.TagCod)"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'",
|
||||
" AND tst_tags.CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -2684,7 +2684,7 @@ static bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res)
|
|||
"ImageName,ImageTitle,ImageURL,"
|
||||
"NumHits,NumHitsNotBlank,Score"
|
||||
" FROM tst_questions"
|
||||
" WHERE QstCod='%ld'",
|
||||
" WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
return (DB_QuerySELECT (Query,mysql_res,"can not get data of a question") == 1);
|
||||
}
|
||||
|
@ -3005,7 +3005,7 @@ unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle)
|
|||
/***** Get answers of a question from database *****/
|
||||
sprintf (Query,"SELECT AnsInd,Answer,Feedback,"
|
||||
"ImageName,ImageTitle,ImageURL,Correct"
|
||||
" FROM tst_answers WHERE QstCod='%ld' ORDER BY %s",
|
||||
" FROM tst_answers WHERE QstCod=%ld ORDER BY %s",
|
||||
QstCod,
|
||||
Shuffle ? "RAND(NOW())" :
|
||||
"AnsInd");
|
||||
|
@ -4214,9 +4214,9 @@ unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res)
|
|||
|
||||
/***** Get the tags of a question from database *****/
|
||||
sprintf (Query,"SELECT tst_tags.TagTxt FROM tst_question_tags,tst_tags"
|
||||
" WHERE tst_question_tags.QstCod='%ld'"
|
||||
" WHERE tst_question_tags.QstCod=%ld"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'"
|
||||
" AND tst_tags.CrsCod=%ld"
|
||||
" ORDER BY tst_question_tags.TagInd",
|
||||
QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
return DB_QuerySELECT (Query,mysql_res,"can not get the tags of a question");
|
||||
|
@ -5064,7 +5064,7 @@ static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
sprintf (Query,"SELECT AnsType,Shuffle,Stem,Feedback,"
|
||||
"ImageName,ImageTitle,ImageURL"
|
||||
" FROM tst_questions"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get a question");
|
||||
|
||||
|
@ -5195,11 +5195,11 @@ static void Tst_GetImageFromDB (int NumOpt,struct Image *Image)
|
|||
if (NumOpt < 0)
|
||||
// Get image associated to stem
|
||||
sprintf (Query,"SELECT ImageName,ImageTitle,ImageURL FROM tst_questions"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod); // Get image associated to answer
|
||||
else
|
||||
sprintf (Query,"SELECT ImageName,ImageTitle,ImageURL FROM tst_answers"
|
||||
" WHERE QstCod='%ld' AND AnsInd='%u'",
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
Gbl.Test.QstCod,(unsigned) NumOpt);
|
||||
|
||||
/***** Query database *****/
|
||||
|
@ -5764,7 +5764,7 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
|
|||
|
||||
/***** Get tag code from database *****/
|
||||
sprintf (Query,"SELECT TagCod FROM tst_tags"
|
||||
" WHERE CrsCod='%ld' AND TagTxt='%s'",
|
||||
" WHERE CrsCod=%ld AND TagTxt='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get tag");
|
||||
|
||||
|
@ -5805,7 +5805,7 @@ static long Tst_CreateNewTag (long CrsCod,const char *TagTxt)
|
|||
sprintf (Query,"INSERT INTO tst_tags"
|
||||
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
|
||||
" VALUES"
|
||||
" ('%ld',NOW(),'%s','N')",
|
||||
" (%ld,NOW(),'%s','N')",
|
||||
CrsCod,TagTxt);
|
||||
return DB_QueryINSERTandReturnCode (Query,"can not create new tag");
|
||||
}
|
||||
|
@ -5820,7 +5820,7 @@ static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden)
|
|||
|
||||
/***** Insert new tag into tst_tags table *****/
|
||||
sprintf (Query,"UPDATE tst_tags SET TagHidden='%c',ChangeTime=NOW()"
|
||||
" WHERE TagCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE TagCod=%ld AND CrsCod=%ld",
|
||||
TagHidden ? 'Y' :
|
||||
'N',
|
||||
TagCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -5934,7 +5934,7 @@ void Tst_RemoveQst (void)
|
|||
|
||||
/* Remove the question itself */
|
||||
sprintf (Query,"DELETE FROM tst_questions"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove a question");
|
||||
|
||||
|
@ -5975,7 +5975,7 @@ void Tst_ChangeShuffleQst (void)
|
|||
/***** Remove the question from all the tables *****/
|
||||
/* Update the question changing the current shuffle */
|
||||
sprintf (Query,"UPDATE tst_questions SET Shuffle='%c'"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Shuffle ? 'Y' :
|
||||
'N',
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -6049,9 +6049,9 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
|||
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
|
||||
"NumHits,Score)"
|
||||
" VALUES"
|
||||
" ('%ld',NOW(),'%s','%c',"
|
||||
" (%ld,NOW(),'%s','%c',"
|
||||
"'%s','%s','%s','%s','%s',"
|
||||
"'0','0')",
|
||||
"0,0)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
|
||||
Gbl.Test.Shuffle ? 'Y' :
|
||||
|
@ -6075,7 +6075,7 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
|||
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
||||
"Stem='%s',Feedback='%s',"
|
||||
"ImageName='%s',ImageTitle='%s',ImageURL='%s'"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
|
||||
Gbl.Test.Shuffle ? 'Y' :
|
||||
'N',
|
||||
|
@ -6126,7 +6126,7 @@ static void Tst_InsertTagsIntoDB (void)
|
|||
sprintf (Query,"INSERT INTO tst_question_tags"
|
||||
" (QstCod,TagCod,TagInd)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u')",
|
||||
" (%ld,%ld,%u)",
|
||||
Gbl.Test.QstCod,TagCod,TagIdx);
|
||||
DB_QueryINSERT (Query,"can not create tag");
|
||||
|
||||
|
@ -6160,7 +6160,7 @@ static void Tst_InsertAnswersIntoDB (void)
|
|||
" (QstCod,AnsInd,Answer,Feedback,"
|
||||
"ImageName,ImageTitle,ImageURL,Correct)"
|
||||
" VALUES"
|
||||
" (%ld,0,'%ld','','','','','Y')",
|
||||
" (%ld,0,%ld,'','','','','Y')",
|
||||
Gbl.Test.QstCod,
|
||||
Gbl.Test.Answer.Integer);
|
||||
DB_QueryINSERT (Query,"can not create answer");
|
||||
|
@ -6204,7 +6204,7 @@ static void Tst_InsertAnswersIntoDB (void)
|
|||
" (QstCod,AnsInd,Answer,Feedback,"
|
||||
"ImageName,ImageTitle,ImageURL,Correct)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%s','%s','%s','%s','%s','%c')",
|
||||
" (%ld,%u,'%s','%s','%s','%s','%s','%c')",
|
||||
Gbl.Test.QstCod,NumOpt,
|
||||
Gbl.Test.Answer.Options[NumOpt].Text,
|
||||
Gbl.Test.Answer.Options[NumOpt].Feedback ? Gbl.Test.Answer.Options[NumOpt].Feedback : "",
|
||||
|
@ -6237,7 +6237,7 @@ static void Tst_RemAnsFromQst (void)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove answers *****/
|
||||
sprintf (Query,"DELETE FROM tst_answers WHERE QstCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_answers WHERE QstCod=%ld",
|
||||
Gbl.Test.QstCod);
|
||||
DB_QueryDELETE (Query,"can not remove the answers of a question");
|
||||
}
|
||||
|
@ -6251,7 +6251,7 @@ static void Tst_RemTagsFromQst (void)
|
|||
char Query[128];
|
||||
|
||||
/***** Remove tags *****/
|
||||
sprintf (Query,"DELETE FROM tst_question_tags WHERE QstCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_question_tags WHERE QstCod=%ld",
|
||||
Gbl.Test.QstCod);
|
||||
DB_QueryDELETE (Query,"can not remove the tags of a question");
|
||||
}
|
||||
|
@ -6266,10 +6266,10 @@ static void Tst_RemoveUnusedTagsFromCurrentCrs (void)
|
|||
|
||||
/***** Remove unused tags from tst_tags *****/
|
||||
sprintf (Query,"DELETE FROM tst_tags"
|
||||
" WHERE CrsCod='%ld' AND TagCod NOT IN"
|
||||
" WHERE CrsCod=%ld AND TagCod NOT IN"
|
||||
" (SELECT DISTINCT tst_question_tags.TagCod"
|
||||
" FROM tst_questions,tst_question_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
@ -6288,7 +6288,7 @@ static void Tst_RemoveImgFileFromStemOfQst (long CrsCod,long QstCod)
|
|||
|
||||
/***** Get names of images associated to stems of test questions from database *****/
|
||||
sprintf (Query,"SELECT ImageName FROM tst_questions"
|
||||
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
QstCod,CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get image"))
|
||||
{
|
||||
|
@ -6317,7 +6317,7 @@ static void Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (long CrsCod)
|
|||
unsigned NumImg;
|
||||
|
||||
/***** Get names of images associated to stems of test questions from database *****/
|
||||
sprintf (Query,"SELECT ImageName FROM tst_questions WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT ImageName FROM tst_questions WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
|
||||
|
||||
|
@ -6350,11 +6350,11 @@ static void Tst_RemoveImgFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsI
|
|||
/***** Get names of images associated to answers of test questions from database *****/
|
||||
sprintf (Query,"SELECT tst_answers.ImageName"
|
||||
" FROM tst_questions,tst_answers"
|
||||
" WHERE tst_questions.CrsCod='%ld'" // Extra check
|
||||
" AND tst_questions.QstCod='%ld'" // Extra check
|
||||
" WHERE tst_questions.CrsCod=%ld" // Extra check
|
||||
" AND tst_questions.QstCod=%ld" // Extra check
|
||||
" AND tst_questions.QstCod=tst_answers.QstCod"
|
||||
" AND tst_answers.QstCod='%ld'"
|
||||
" AND tst_answers.AnsInd='%u'",
|
||||
" AND tst_answers.QstCod=%ld"
|
||||
" AND tst_answers.AnsInd=%u",
|
||||
CrsCod,QstCod,QstCod,AnsInd);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get images"))
|
||||
{
|
||||
|
@ -6384,10 +6384,10 @@ static void Tst_RemoveAllImgFilesFromAnsOfQst (long CrsCod,long QstCod)
|
|||
/***** Get names of images associated to answers of test questions from database *****/
|
||||
sprintf (Query,"SELECT tst_answers.ImageName"
|
||||
" FROM tst_questions,tst_answers"
|
||||
" WHERE tst_questions.CrsCod='%ld'" // Extra check
|
||||
" AND tst_questions.QstCod='%ld'" // Extra check
|
||||
" WHERE tst_questions.CrsCod=%ld" // Extra check
|
||||
" AND tst_questions.QstCod=%ld" // Extra check
|
||||
" AND tst_questions.QstCod=tst_answers.QstCod"
|
||||
" AND tst_answers.QstCod='%ld'",
|
||||
" AND tst_answers.QstCod=%ld",
|
||||
CrsCod,QstCod,QstCod);
|
||||
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
|
||||
|
||||
|
@ -6423,7 +6423,7 @@ static void Tst_RemoveAllImgFilesFromAnsOfAllQstsInCrs (long CrsCod)
|
|||
/***** Get names of images associated to answers of test questions from database *****/
|
||||
sprintf (Query,"SELECT tst_answers.ImageName"
|
||||
" FROM tst_questions,tst_answers"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod=tst_answers.QstCod",
|
||||
CrsCod);
|
||||
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
|
||||
|
@ -6502,7 +6502,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6511,7 +6511,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6524,7 +6524,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM centres,degrees,courses,tst_questions"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
|
@ -6532,7 +6532,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM centres,degrees,courses,tst_questions"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -6544,14 +6544,14 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM degrees,courses,tst_questions"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM degrees,courses,tst_questions"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'",
|
||||
|
@ -6562,13 +6562,13 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM courses,tst_questions"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM courses,tst_questions"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -6578,12 +6578,12 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM tst_questions"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
|
||||
" FROM tst_questions"
|
||||
" WHERE CrsCod='%ld' AND AnsType='%s'",
|
||||
" WHERE CrsCod=%ld AND AnsType='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Tst_StrAnswerTypesDB[AnsType]);
|
||||
break;
|
||||
|
@ -6650,7 +6650,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6659,7 +6659,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6672,7 +6672,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM centres,degrees,courses,tst_questions"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
|
@ -6680,7 +6680,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM centres,degrees,courses,tst_questions"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -6692,14 +6692,14 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM degrees,courses,tst_questions"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM degrees,courses,tst_questions"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'",
|
||||
|
@ -6710,13 +6710,13 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNTDISTINCT (tst_questions.CrsCod)"
|
||||
" FROM courses,tst_questions"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM courses,tst_questions"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -6726,12 +6726,12 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM tst_questions"
|
||||
" WHERE CrsCod='%ld'",
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM tst_questions"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND AnsType='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Tst_StrAnswerTypesDB[AnsType]);
|
||||
|
@ -6789,7 +6789,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions,tst_config"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6801,7 +6801,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,tst_questions,tst_config"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -6817,7 +6817,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM centres,degrees,courses,tst_questions,tst_config"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -6828,7 +6828,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM centres,degrees,courses,tst_questions,tst_config"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -6843,7 +6843,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM degrees,courses,tst_questions,tst_config"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
|
@ -6853,7 +6853,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM degrees,courses,tst_questions,tst_config"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'"
|
||||
|
@ -6867,7 +6867,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM courses,tst_questions,tst_config"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
|
@ -6876,7 +6876,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM courses,tst_questions,tst_config"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='%s'"
|
||||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
|
@ -6889,7 +6889,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
if (AnsType == Tst_ANS_ALL)
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM tst_questions,tst_config"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -6897,7 +6897,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
|
|||
else
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM tst_questions,tst_config"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.AnsType='%s'"
|
||||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
|
@ -7050,7 +7050,7 @@ static long Tst_CreateTestResultInDB (void)
|
|||
sprintf (Query,"INSERT INTO tst_exams"
|
||||
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%c',NOW(),'%u')",
|
||||
" (%ld,%ld,'%c',NOW(),%u)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Test.AllowTeachers ? 'Y' :
|
||||
|
@ -7071,8 +7071,8 @@ static void Tst_StoreScoreOfTestResultInDB (long TstCod,
|
|||
/***** Update score in test result *****/
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
sprintf (Query,"UPDATE tst_exams"
|
||||
" SET NumQstsNotBlank='%u',Score='%lf'"
|
||||
" WHERE TstCod='%ld'",
|
||||
" SET NumQstsNotBlank=%u,Score='%lf'"
|
||||
" WHERE TstCod=%ld",
|
||||
NumQstsNotBlank,Score,
|
||||
TstCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
|
@ -7242,9 +7242,9 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
|
|||
"UNIX_TIMESTAMP(TstTime),"
|
||||
"NumQsts,NumQstsNotBlank,Score"
|
||||
" FROM tst_exams"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'"
|
||||
" AND TstTime>=FROM_UNIXTIME('%ld')"
|
||||
" AND TstTime<=FROM_UNIXTIME('%ld')"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld"
|
||||
" AND TstTime>=FROM_UNIXTIME(%ld)"
|
||||
" AND TstTime<=FROM_UNIXTIME(%ld)"
|
||||
" ORDER BY TstCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
UsrDat->UsrCod,
|
||||
|
@ -7863,7 +7863,7 @@ static void Tst_GetTestResultDataByTstCod (long TstCod,time_t *TstTimeUTC,
|
|||
"UNIX_TIMESTAMP(TstTime),"
|
||||
"NumQsts,NumQstsNotBlank,Score"
|
||||
" FROM tst_exams"
|
||||
" WHERE TstCod='%ld' AND CrsCod='%ld'",
|
||||
" WHERE TstCod=%ld AND CrsCod=%ld",
|
||||
TstCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of a test result of a user") == 1)
|
||||
|
@ -7920,7 +7920,7 @@ static void Tst_StoreOneTestResultQstInDB (long TstCod,long QstCod,unsigned NumQ
|
|||
sprintf (Query,"INSERT INTO tst_exam_questions"
|
||||
" (TstCod,QstCod,QstInd,Score,Indexes,Answers)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%u','%lf','%s','%s')",
|
||||
" (%ld,%ld,%u,'%lf','%s','%s')",
|
||||
TstCod,QstCod,
|
||||
NumQst, // 0, 1, 2, 3...
|
||||
Score,
|
||||
|
@ -7943,7 +7943,7 @@ static void Tst_GetTestResultQuestionsFromDB (long TstCod)
|
|||
|
||||
/***** Get questions of a test result from database *****/
|
||||
sprintf (Query,"SELECT QstCod,Indexes,Answers FROM tst_exam_questions"
|
||||
" WHERE TstCod='%ld' ORDER BY QstInd",
|
||||
" WHERE TstCod=%ld ORDER BY QstInd",
|
||||
TstCod);
|
||||
Gbl.Test.NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get questions of a test result");
|
||||
|
||||
|
@ -7987,13 +7987,13 @@ void Tst_RemoveTestResultsMadeByUsrInAllCrss (long UsrCod)
|
|||
/***** Remove test results made by the specified user *****/
|
||||
sprintf (Query,"DELETE FROM tst_exam_questions"
|
||||
" USING tst_exams,tst_exam_questions"
|
||||
" WHERE tst_exams.UsrCod='%ld'"
|
||||
" WHERE tst_exams.UsrCod=%ld"
|
||||
" AND tst_exams.TstCod=tst_exam_questions.TstCod",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made by a user");
|
||||
|
||||
sprintf (Query,"DELETE FROM tst_exams"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made by a user");
|
||||
}
|
||||
|
@ -8009,13 +8009,13 @@ void Tst_RemoveTestResultsMadeByUsrInCrs (long UsrCod,long CrsCod)
|
|||
/***** Remove test results made by the specified user *****/
|
||||
sprintf (Query,"DELETE FROM tst_exam_questions"
|
||||
" USING tst_exams,tst_exam_questions"
|
||||
" WHERE tst_exams.CrsCod='%ld' AND tst_exams.UsrCod='%ld'"
|
||||
" WHERE tst_exams.CrsCod=%ld AND tst_exams.UsrCod=%ld"
|
||||
" AND tst_exams.TstCod=tst_exam_questions.TstCod",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made by a user in a course");
|
||||
|
||||
sprintf (Query,"DELETE FROM tst_exams"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made by a user in a course");
|
||||
}
|
||||
|
@ -8031,13 +8031,13 @@ void Tst_RemoveCrsTestResults (long CrsCod)
|
|||
/***** Remove questions of test results made in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_exam_questions"
|
||||
" USING tst_exams,tst_exam_questions"
|
||||
" WHERE tst_exams.CrsCod='%ld'"
|
||||
" WHERE tst_exams.CrsCod=%ld"
|
||||
" AND tst_exams.TstCod=tst_exam_questions.TstCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made in a course");
|
||||
|
||||
/***** Remove test results made in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_exams WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_exams WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove test results made in a course");
|
||||
}
|
||||
|
@ -8051,11 +8051,11 @@ void Tst_RemoveCrsTests (long CrsCod)
|
|||
char Query[512];
|
||||
|
||||
/***** Remove tests status in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_status WHERE CrsCod='%ld'",CrsCod);
|
||||
sprintf (Query,"DELETE FROM tst_status WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove status of tests of a course");
|
||||
|
||||
/***** Remove test configuration of the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_config WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_config WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove configuration of tests of a course");
|
||||
|
||||
|
@ -8063,19 +8063,19 @@ void Tst_RemoveCrsTests (long CrsCod)
|
|||
and test tags in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_question_tags"
|
||||
" USING tst_questions,tst_question_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove tags associated to questions of tests of a course");
|
||||
|
||||
/***** Remove test tags in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_tags WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_tags WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove tags of test of a course");
|
||||
|
||||
/***** Remove test answers in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_answers USING tst_questions,tst_answers"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod=tst_answers.QstCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove answers of tests of a course");
|
||||
|
@ -8086,7 +8086,7 @@ void Tst_RemoveCrsTests (long CrsCod)
|
|||
Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (CrsCod);
|
||||
|
||||
/***** Remove test questions in the course *****/
|
||||
sprintf (Query,"DELETE FROM tst_questions WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM tst_questions WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove test questions of a course");
|
||||
}
|
||||
|
|
|
@ -726,7 +726,7 @@ static bool TsI_CheckIfQuestionExistsInDB (void)
|
|||
|
||||
/* Make database query */
|
||||
sprintf (QueryQst,"SELECT QstCod FROM tst_questions"
|
||||
" WHERE CrsCod='%ld' AND AnsType='%s' AND Stem='%s'",
|
||||
" WHERE CrsCod=%ld AND AnsType='%s' AND Stem='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
|
||||
Gbl.Test.Stem.Text);
|
||||
|
@ -749,7 +749,7 @@ static bool TsI_CheckIfQuestionExistsInDB (void)
|
|||
|
||||
/* Get answers from this question */
|
||||
sprintf (QueryAns,"SELECT Answer FROM tst_answers"
|
||||
" WHERE QstCod='%ld' ORDER BY AnsInd",
|
||||
" WHERE QstCod=%ld ORDER BY AnsInd",
|
||||
QstCod);
|
||||
NumOptsExistingQstInDB = (unsigned) DB_QuerySELECT (QueryAns,&mysql_res_ans,"can not get the answer of a question");
|
||||
|
||||
|
|
168
swad_text.c
168
swad_text.c
|
@ -73,10 +73,13 @@
|
|||
#include "swad_country.h"
|
||||
#include "swad_course.h"
|
||||
#include "swad_degree.h"
|
||||
#include "swad_degree_type.h"
|
||||
#include "swad_department.h"
|
||||
#include "swad_file_browser.h"
|
||||
#include "swad_forum.h"
|
||||
#include "swad_holiday.h"
|
||||
#include "swad_info.h"
|
||||
#include "swad_mail.h"
|
||||
#include "swad_menu.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_photo.h"
|
||||
|
@ -4301,7 +4304,7 @@ const char *Txt_centres =
|
|||
"centros";
|
||||
#endif
|
||||
|
||||
const char *Txt_CENTRES_HELP_ORDER[2] =
|
||||
const char *Txt_CENTRES_HELP_ORDER[Ctr_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar per centre"
|
||||
|
@ -4365,7 +4368,7 @@ const char *Txt_Centres_of_INSTITUTION_X = // Warning: it is very important to i
|
|||
"Centros de %s";
|
||||
#endif
|
||||
|
||||
const char *Txt_CENTRES_ORDER[2] =
|
||||
const char *Txt_CENTRES_ORDER[Ctr_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Centre"
|
||||
|
@ -5521,7 +5524,7 @@ const char *Txt_countries =
|
|||
"países";
|
||||
#endif
|
||||
|
||||
const char *Txt_COUNTRIES_HELP_ORDER[2] =
|
||||
const char *Txt_COUNTRIES_HELP_ORDER[Cty_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por país" // Necessita traduccio
|
||||
|
@ -5585,7 +5588,7 @@ const char *Txt_Countries_with_pending_institutions =
|
|||
"Países com instituções pendentes";
|
||||
#endif
|
||||
|
||||
const char *Txt_COUNTRIES_ORDER[2] =
|
||||
const char *Txt_COUNTRIES_ORDER[Cty_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"País"
|
||||
|
@ -7907,6 +7910,92 @@ const char *Txt_DEGREE_STATUS[Deg_NUM_STATUS_TXT] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por tipus de titulació"
|
||||
#elif L==2
|
||||
"Nach Art des Grades sortieren"
|
||||
#elif L==3
|
||||
"Sort by type of degree"
|
||||
#elif L==4
|
||||
"Ordenar por tipo de titulación"
|
||||
#elif L==5
|
||||
"Trier par type d'étude"
|
||||
#elif L==6
|
||||
"Ordenar por tipo de titulación" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Ordina per tipo di laurea"
|
||||
#elif L==8
|
||||
"Sortuj według rodzaju stopnia"
|
||||
#elif L==9
|
||||
"Classificar por tipo de titulação"
|
||||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Ordenar per nombre de titulacions"
|
||||
#elif L==2
|
||||
"Nach Anzahl der Studiengänge sortieren"
|
||||
#elif L==3
|
||||
"Sort by no. of degrees"
|
||||
#elif L==4
|
||||
"Ordenar por nº de titulaciones"
|
||||
#elif L==5
|
||||
"Trier par nombre d'études"
|
||||
#elif L==6
|
||||
"Ordenar por nº de titulaciones" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Ordina per numero di lauree"
|
||||
#elif L==8
|
||||
"Sortuj wedlug stopni"
|
||||
#elif L==9
|
||||
"Classificar por nº de titulaçoes"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Tipus de titulació"
|
||||
#elif L==2
|
||||
"Abschlussart"
|
||||
#elif L==3
|
||||
"Types of degree"
|
||||
#elif L==4
|
||||
"Tipos de titulación"
|
||||
#elif L==5
|
||||
"Types d'étude"
|
||||
#elif L==6
|
||||
"Arandurã lája"
|
||||
#elif L==7
|
||||
"Tipi di laurea"
|
||||
#elif L==8
|
||||
"Rodzaje stopni"
|
||||
#elif L==9
|
||||
"Tipos de titulação"
|
||||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Titulacions"
|
||||
#elif L==2
|
||||
"Studiengang"
|
||||
#elif L==3
|
||||
"Degrees"
|
||||
#elif L==4
|
||||
"Titulaciones"
|
||||
#elif L==5
|
||||
"Études"
|
||||
#elif L==6
|
||||
"Arandurã"
|
||||
#elif L==7
|
||||
"Lauree"
|
||||
#elif L==8
|
||||
"Stopnie"
|
||||
#elif L==9
|
||||
"Titulaçoes"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_DEGREE_With_courses =
|
||||
#if L==1
|
||||
"Amb assignatures";
|
||||
|
@ -8222,7 +8311,7 @@ const char *Txt_Departments_ABBREVIATION =
|
|||
"Depar.";
|
||||
#endif
|
||||
|
||||
const char *Txt_DEPARTMENTS_HELP_ORDER[2] =
|
||||
const char *Txt_DEPARTMENTS_HELP_ORDER[Dpt_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por departamento" // Necessita traduccio
|
||||
|
@ -8265,7 +8354,7 @@ const char *Txt_DEPARTMENTS_HELP_ORDER[2] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_DEPARTMENTS_ORDER[2] =
|
||||
const char *Txt_DEPARTMENTS_ORDER[Dpt_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Departament"
|
||||
|
@ -10623,7 +10712,7 @@ const char *Txt_Email_domains_allowed_for_notifications =
|
|||
"Email domains allowed for notifications"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_EMAIL_DOMAIN_HELP_ORDER[3] =
|
||||
const char *Txt_EMAIL_DOMAIN_HELP_ORDER[Mai_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por dominio de correo" // Necessita traduccio
|
||||
|
@ -10686,7 +10775,7 @@ const char *Txt_EMAIL_DOMAIN_HELP_ORDER[3] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_EMAIL_DOMAIN_ORDER[3] =
|
||||
const char *Txt_EMAIL_DOMAIN_ORDER[Mai_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Domini de correu"
|
||||
|
@ -13267,7 +13356,7 @@ const char *Txt_Forum_threads =
|
|||
"Threads de fórum";
|
||||
#endif
|
||||
|
||||
const char *Txt_FORUM_THREAD_HELP_ORDER[2] =
|
||||
const char *Txt_FORUM_THREAD_HELP_ORDER[For_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por fecha del primer mensaje" // Necessita traduccio
|
||||
|
@ -13310,7 +13399,7 @@ const char *Txt_FORUM_THREAD_HELP_ORDER[2] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_FORUM_THREAD_ORDER[2] =
|
||||
const char *Txt_FORUM_THREAD_ORDER[For_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Primer mensaje" // Necessita traduccio
|
||||
|
@ -14744,7 +14833,7 @@ const char *Txt_Holidays =
|
|||
"Férias";
|
||||
#endif
|
||||
|
||||
const char *Txt_HOLIDAYS_HELP_ORDER[2] =
|
||||
const char *Txt_HOLIDAYS_HELP_ORDER[Hld_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por lugar" // Necessita traduccio
|
||||
|
@ -14787,7 +14876,7 @@ const char *Txt_HOLIDAYS_HELP_ORDER[2] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_HOLIDAYS_ORDER[2] =
|
||||
const char *Txt_HOLIDAYS_ORDER[Hld_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Lloc"
|
||||
|
@ -16436,7 +16525,7 @@ const char *Txt_institutions =
|
|||
"instituções";
|
||||
#endif
|
||||
|
||||
const char *Txt_INSTITUTIONS_HELP_ORDER[2] =
|
||||
const char *Txt_INSTITUTIONS_HELP_ORDER[Ins_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por institución" // Necessita traduccio
|
||||
|
@ -16605,7 +16694,7 @@ const char *Txt_Institutions_of_COUNTRY_X = // Warning: it is very important to
|
|||
"Instituções de %s";
|
||||
#endif
|
||||
|
||||
const char *Txt_INSTITUTIONS_ORDER[2] =
|
||||
const char *Txt_INSTITUTIONS_ORDER[Ins_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Institució"
|
||||
|
@ -17461,49 +17550,6 @@ const char *Txt_Locations =
|
|||
"Localizações";
|
||||
#endif
|
||||
|
||||
const char *Txt_LOCATIONS_HELP_ORDER[2] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por fecha inicial" // Necessita traduccio
|
||||
#elif L==2
|
||||
"Sortieren nach Startdatum"
|
||||
#elif L==3
|
||||
"Sort by start date"
|
||||
#elif L==4
|
||||
"Ordenar por fecha inicial"
|
||||
#elif L==5
|
||||
"Trier par date initiale"
|
||||
#elif L==6
|
||||
"Ordenar por fecha inicial" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Ordina per data iniziale"
|
||||
#elif L==8
|
||||
"Sortuj wedlug daty rozpoczecia"
|
||||
#elif L==9
|
||||
"Classificar por data de início"
|
||||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Ordenar por fecha final" // Necessita traduccio
|
||||
#elif L==2
|
||||
"Sortieren nach Enddatum"
|
||||
#elif L==3
|
||||
"Sort by end date"
|
||||
#elif L==4
|
||||
"Ordenar por fecha final"
|
||||
#elif L==5
|
||||
"Trier par date finale"
|
||||
#elif L==6
|
||||
"Ordenar por fecha final" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Ordina per data finale"
|
||||
#elif L==8
|
||||
"Sortuj wedlug daty koncowa"
|
||||
#elif L==9
|
||||
"Classificar por data final"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_LOG_More_info =
|
||||
#if L==1
|
||||
"Observaciones"; // Necessita traduccio
|
||||
|
@ -29115,7 +29161,7 @@ const char *Txt_Places =
|
|||
"Localizaçoes";
|
||||
#endif
|
||||
|
||||
const char *Txt_PLACES_HELP_ORDER[2] =
|
||||
const char *Txt_PLACES_HELP_ORDER[Plc_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Ordenar por lugar" // Necessita traduccio
|
||||
|
@ -29138,7 +29184,7 @@ const char *Txt_PLACES_HELP_ORDER[2] =
|
|||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Ordenar por nº de titulaciones" // Necessita traduccio
|
||||
"Ordenar per nombre de titulacions"
|
||||
#elif L==2
|
||||
"Nach Anzahl der Studiengänge sortieren"
|
||||
#elif L==3
|
||||
|
@ -29158,7 +29204,7 @@ const char *Txt_PLACES_HELP_ORDER[2] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_PLACES_ORDER[2] =
|
||||
const char *Txt_PLACES_ORDER[Plc_NUM_ORDERS] =
|
||||
{
|
||||
#if L==1
|
||||
"Lloc"
|
||||
|
@ -49309,7 +49355,7 @@ const char *Txt_Types_of_degree =
|
|||
#elif L==7
|
||||
"Tipi di laurea";
|
||||
#elif L==8
|
||||
"Types of degree"; // Potrzebujesz tlumaczenie
|
||||
"Rodzaje stopni";
|
||||
#elif L==9
|
||||
"Tipos de titulação";
|
||||
#endif
|
||||
|
|
|
@ -294,7 +294,7 @@ void The_ChangeTheme (void)
|
|||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
sprintf (Query,"UPDATE usr_data SET Theme='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
The_ThemeId[Gbl.Prefs.Theme],Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about theme");
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
|
|||
unsigned Column;
|
||||
|
||||
/***** Remove former timetable *****/
|
||||
sprintf (Query,"DELETE FROM timetable_crs WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM timetable_crs WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove former timetable");
|
||||
|
||||
|
@ -485,7 +485,7 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
|
|||
sprintf (Query,"INSERT INTO timetable_crs"
|
||||
" (CrsCod,GrpCod,Day,Hour,Duration,ClassType,Place,GroupName)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%c','%u','%d','%s','%s','%s')",
|
||||
" (%ld,%ld,'%c',%u,%d,'%s','%s','%s')",
|
||||
CrsCod,
|
||||
TimeTable[Day][Hour].Columns[Column].GrpCod,
|
||||
TimeTableCharsDays[Day],
|
||||
|
@ -509,7 +509,7 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
|
|||
unsigned Hour,Day,Column;
|
||||
|
||||
/***** Remove former timetable *****/
|
||||
sprintf (Query,"DELETE FROM timetable_tut WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM timetable_tut WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove former timetable");
|
||||
|
||||
|
@ -529,7 +529,7 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
|
|||
sprintf (Query,"INSERT INTO timetable_tut"
|
||||
" (UsrCod,Day,Hour,Duration,Place)"
|
||||
" VALUES"
|
||||
" ('%ld','%c','%u','%d','%s')",
|
||||
" (%ld,'%c',%u,%d,'%s')",
|
||||
UsrCod,TimeTableCharsDays[Day],Hour,
|
||||
TimeTable[Day][Hour].Columns[Column].Duration,
|
||||
TimeTable[Day][Hour].Columns[Column].Place);
|
||||
|
@ -588,17 +588,21 @@ static void TT_CreatTimeTableFromDB (long UsrCod)
|
|||
sprintf (Query,"SELECT timetable_crs.Day,timetable_crs.Hour,timetable_crs.Duration,timetable_crs.Place,"
|
||||
"timetable_crs.ClassType,timetable_crs.GroupName,timetable_crs.GrpCod,timetable_crs.CrsCod"
|
||||
" FROM timetable_crs,crs_usr"
|
||||
" WHERE crs_usr.UsrCod='%ld' AND timetable_crs.GrpCod='-1' AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND timetable_crs.GrpCod=-1"
|
||||
" AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" UNION DISTINCT "
|
||||
"SELECT timetable_crs.Day,timetable_crs.Hour,timetable_crs.Duration,timetable_crs.Place,"
|
||||
"timetable_crs.ClassType,timetable_crs.GroupName,timetable_crs.GrpCod,timetable_crs.CrsCod"
|
||||
" FROM timetable_crs,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld' AND timetable_crs.GrpCod=crs_grp_usr.GrpCod"
|
||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||
" AND timetable_crs.GrpCod=crs_grp_usr.GrpCod"
|
||||
" UNION "
|
||||
"SELECT Day,Hour,Duration,Place,"
|
||||
"'tutorias' AS ClassType,'' AS GroupName,'-1' AS GrpCod,'-1' AS CrsCod"
|
||||
"'tutorias' AS ClassType,'' AS GroupName,"
|
||||
"-1 AS GrpCod,-1 AS CrsCod"
|
||||
" FROM timetable_tut"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY Day,Hour,ClassType,GroupName,GrpCod,Place,Duration DESC,CrsCod",
|
||||
UsrCod,UsrCod,UsrCod);
|
||||
break;
|
||||
|
@ -606,12 +610,14 @@ static void TT_CreatTimeTableFromDB (long UsrCod)
|
|||
sprintf (Query,"SELECT timetable_crs.Day,timetable_crs.Hour,timetable_crs.Duration,timetable_crs.Place,"
|
||||
"timetable_crs.ClassType,timetable_crs.GroupName,timetable_crs.GrpCod,timetable_crs.CrsCod"
|
||||
" FROM timetable_crs,crs_usr"
|
||||
" WHERE crs_usr.UsrCod='%ld' AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" UNION "
|
||||
"SELECT Day,Hour,Duration,Place,"
|
||||
"'tutorias' AS ClassType,'' AS GroupName,'-1' AS GrpCod,'-1' AS CrsCod"
|
||||
"'tutorias' AS ClassType,'' AS GroupName,"
|
||||
"-1 AS GrpCod,-1 AS CrsCod"
|
||||
" FROM timetable_tut"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY Day,Hour,ClassType,"
|
||||
"GroupName,GrpCod,Place,Duration DESC,CrsCod",
|
||||
UsrCod,UsrCod);
|
||||
|
@ -624,18 +630,22 @@ static void TT_CreatTimeTableFromDB (long UsrCod)
|
|||
Gbl.Action.Act == ActChgCrsTT) // If we are editing, all groups are shown
|
||||
sprintf (Query,"SELECT Day,Hour,Duration,Place,ClassType,GroupName,GrpCod"
|
||||
" FROM timetable_crs"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" ORDER BY Day,Hour,ClassType,GroupName,GrpCod,Place,Duration DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
else
|
||||
sprintf (Query,"SELECT timetable_crs.Day,timetable_crs.Hour,timetable_crs.Duration,timetable_crs.Place,timetable_crs.ClassType,timetable_crs.GroupName,timetable_crs.GrpCod"
|
||||
" FROM timetable_crs,crs_usr"
|
||||
" WHERE timetable_crs.CrsCod='%ld' AND timetable_crs.GrpCod='-1' AND crs_usr.UsrCod='%ld' AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" WHERE timetable_crs.CrsCod=%ld"
|
||||
" AND timetable_crs.GrpCod=-1 AND crs_usr.UsrCod=%ld"
|
||||
" AND timetable_crs.CrsCod=crs_usr.CrsCod"
|
||||
" UNION DISTINCT "
|
||||
"SELECT timetable_crs.Day,timetable_crs.Hour,timetable_crs.Duration,timetable_crs.Place,"
|
||||
"timetable_crs.ClassType,timetable_crs.GroupName,timetable_crs.GrpCod"
|
||||
" FROM timetable_crs,crs_grp_usr"
|
||||
" WHERE timetable_crs.CrsCod='%ld' AND crs_grp_usr.UsrCod='%ld' AND timetable_crs.GrpCod=crs_grp_usr.GrpCod"
|
||||
" WHERE timetable_crs.CrsCod=%ld"
|
||||
" AND crs_grp_usr.UsrCod=%ld"
|
||||
" AND timetable_crs.GrpCod=crs_grp_usr.GrpCod"
|
||||
" ORDER BY Day,Hour,ClassType,GroupName,GrpCod,Place,Duration DESC",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
|
@ -643,7 +653,7 @@ static void TT_CreatTimeTableFromDB (long UsrCod)
|
|||
case TT_TUTOR_TIMETABLE:
|
||||
sprintf (Query,"SELECT Day,Hour,Duration,Place"
|
||||
" FROM timetable_tut"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY Day,Hour,Place,Duration DESC",
|
||||
UsrCod);
|
||||
break;
|
||||
|
|
290
swad_user.c
290
swad_user.c
|
@ -422,7 +422,7 @@ void Usr_GetEncryptedUsrCodFromUsrCod (struct UsrData *UsrDat) // TODO: Remove t
|
|||
if (UsrDat->UsrCod > 0)
|
||||
{
|
||||
/***** Get encrypted user's code from database *****/
|
||||
sprintf (Query,"SELECT EncryptedUsrCod FROM usr_data WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT EncryptedUsrCod FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get encrypted user's code");
|
||||
|
||||
|
@ -468,7 +468,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,"
|
||||
"DATE_FORMAT(Birthday,'%%Y%%m%%d'),Comments,"
|
||||
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents"
|
||||
" FROM usr_data WHERE UsrCod='%ld'",
|
||||
" FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get user's data");
|
||||
|
||||
|
@ -647,7 +647,7 @@ static void Usr_GetMyLastData (void)
|
|||
|
||||
/***** Get user's data from database *****/
|
||||
sprintf (Query,"SELECT WhatToSearch,LastCrs,LastTab,UNIX_TIMESTAMP(LastAccNotif)"
|
||||
" FROM usr_last WHERE UsrCod='%ld'",
|
||||
" FROM usr_last WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get user's last data");
|
||||
|
||||
|
@ -763,7 +763,7 @@ bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod)
|
|||
{
|
||||
/***** Get if a user is administrator of a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='%s' AND Cod='%ld'",
|
||||
" WHERE UsrCod=%ld AND Scope='%s' AND Cod=%ld",
|
||||
UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user is administrator") != 0);
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ bool Usr_CheckIfUsrIsSuperuser (long UsrCod)
|
|||
{
|
||||
/***** Get if a user is superuser from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='%s'",
|
||||
" WHERE UsrCod=%ld AND Scope='%s'",
|
||||
UsrCod,Sco_ScopeDB[Sco_SCOPE_SYS]);
|
||||
Cached.UsrCod = UsrCod;
|
||||
Cached.IsSuperuser = (DB_QueryCOUNT (Query,"can not check if a user is superuser") != 0);
|
||||
|
@ -890,7 +890,7 @@ unsigned Usr_GetNumCrssOfUsr (long UsrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get the number of courses of a user from database ******/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user");
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod)
|
|||
|
||||
/***** Get the number of courses of a user not accepted from database ******/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE UsrCod='%ld' AND Accepted='N'",
|
||||
" WHERE UsrCod=%ld AND Accepted='N'",
|
||||
UsrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user");
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role)
|
|||
|
||||
/***** Get the number of courses of a user with a role from database ******/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE UsrCod='%ld' AND Role='%u'",
|
||||
" WHERE UsrCod=%ld AND Role=%u",
|
||||
UsrCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user with a role");
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ unsigned Usr_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role)
|
|||
|
||||
/***** Get the number of courses of a user with a role from database ******/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE UsrCod='%ld' AND Role='%u' AND Accepted='N'",
|
||||
" WHERE UsrCod=%ld AND Role=%u AND Accepted='N'",
|
||||
UsrCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user with a role");
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
|||
" (CrsCod INT NOT NULL,UNIQUE INDEX (CrsCod))"
|
||||
" ENGINE=MEMORY"
|
||||
" SELECT CrsCod FROM crs_usr"
|
||||
" WHERE UsrCod='%ld' AND Role='%u'",
|
||||
" WHERE UsrCod=%ld AND Role=%u",
|
||||
UsrCod,(unsigned) UsrRole);
|
||||
if (mysql_query (&Gbl.mysql,Query))
|
||||
DB_ExitOnMySQLError ("can not create temporary table");
|
||||
|
@ -971,7 +971,7 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
|||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM crs_usr,usr_courses_tmp"
|
||||
" WHERE crs_usr.CrsCod=usr_courses_tmp.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
(unsigned) OthersRole);
|
||||
NumUsrs = (unsigned) DB_QueryCOUNT (Query,"can not get the number of users");
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
|||
|
||||
/* Check if user shares any course with me */
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND CrsCod IN (SELECT CrsCod FROM my_courses_tmp)",
|
||||
UsrDat->UsrCod);
|
||||
Cached.UsrSharesAnyOfMyCrs = DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0;
|
||||
|
@ -1146,7 +1146,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
|||
sprintf (Query,"CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp "
|
||||
"(CrsCod INT NOT NULL,Role TINYINT NOT NULL,"
|
||||
"UNIQUE INDEX(CrsCod,Role)) ENGINE=MEMORY"
|
||||
" SELECT CrsCod,Role FROM crs_usr WHERE UsrCod='%ld'",
|
||||
" SELECT CrsCod,Role FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
if (mysql_query (&Gbl.mysql,Query))
|
||||
DB_ExitOnMySQLError ("can not create temporary table");
|
||||
|
@ -1384,7 +1384,7 @@ void Usr_GetMyCourses (void)
|
|||
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
|
||||
" SELECT crs_usr.CrsCod,crs_usr.Role,courses.DegCod"
|
||||
" FROM crs_usr,courses,degrees"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" ORDER BY degrees.ShortName,courses.ShortName",
|
||||
|
@ -1546,12 +1546,12 @@ bool Usr_CheckIfUsrBelongsToIns (long UsrCod,long InsCod)
|
|||
/***** Get is a user belongs to an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT centres.InsCod)"
|
||||
" FROM crs_usr,courses,degrees,centres"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Accepted='Y'"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'",
|
||||
" AND centres.InsCod=%ld",
|
||||
UsrCod,InsCod);
|
||||
Cached.UsrCod = UsrCod;
|
||||
Cached.InsCod = InsCod;
|
||||
|
@ -1594,11 +1594,11 @@ bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod)
|
|||
/***** Get is a user belongs to a centre from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT degrees.CtrCod)"
|
||||
" FROM crs_usr,courses,degrees"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Accepted='Y'" // Only if user accepted
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'",
|
||||
" AND degrees.CtrCod=%ld",
|
||||
UsrCod,CtrCod);
|
||||
Cached.UsrCod = UsrCod;
|
||||
Cached.CtrCod = CtrCod;
|
||||
|
@ -1641,10 +1641,10 @@ bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod)
|
|||
/***** Get is a user belongs to a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT courses.DegCod)"
|
||||
" FROM crs_usr,courses"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.Accepted='Y'" // Only if user accepted
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'",
|
||||
" AND courses.DegCod=%ld",
|
||||
UsrCod,DegCod);
|
||||
Cached.UsrCod = UsrCod;
|
||||
Cached.DegCod = DegCod;
|
||||
|
@ -1673,7 +1673,7 @@ bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod,
|
|||
SubQuery = (CountOnlyAcceptedCourses ? " AND crs_usr.Accepted='Y'" :
|
||||
"");
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'%s",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld%s",
|
||||
CrsCod,UsrCod,SubQuery);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user belongs to a course") != 0);
|
||||
}
|
||||
|
@ -1792,7 +1792,7 @@ unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res)
|
|||
/***** Get the institutions a user belongs to from database *****/
|
||||
sprintf (Query,"SELECT countries.CtyCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees,centres,institutions,countries"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -1817,19 +1817,19 @@ unsigned long Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res)
|
|||
if (CtyCod > 0)
|
||||
sprintf (Query,"SELECT institutions.InsCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees,centres,institutions"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" GROUP BY institutions.InsCod"
|
||||
" ORDER BY institutions.ShortName",
|
||||
UsrCod,CtyCod);
|
||||
else
|
||||
sprintf (Query,"SELECT institutions.InsCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees,centres,institutions"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -1853,17 +1853,17 @@ unsigned long Usr_GetCtrsFromUsr (long UsrCod,long InsCod,MYSQL_RES **mysql_res)
|
|||
if (InsCod > 0)
|
||||
sprintf (Query,"SELECT centres.CtrCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees,centres"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" GROUP BY centres.CtrCod ORDER BY centres.ShortName",
|
||||
UsrCod,InsCod);
|
||||
else
|
||||
sprintf (Query,"SELECT degrees.CtrCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees,centres"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
|
@ -1885,16 +1885,16 @@ unsigned long Usr_GetDegsFromUsr (long UsrCod,long CtrCod,MYSQL_RES **mysql_res)
|
|||
if (CtrCod > 0)
|
||||
sprintf (Query,"SELECT degrees.DegCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" GROUP BY degrees.DegCod ORDER BY degrees.ShortName",
|
||||
UsrCod,CtrCod);
|
||||
else
|
||||
sprintf (Query,"SELECT degrees.DegCod,MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,courses,degrees"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" GROUP BY degrees.DegCod ORDER BY degrees.ShortName",
|
||||
|
@ -1916,15 +1916,15 @@ unsigned long Usr_GetCrssFromUsr (long UsrCod,long DegCod,MYSQL_RES **mysql_res)
|
|||
if (DegCod > 0) // Courses in a degree
|
||||
sprintf (Query,"SELECT crs_usr.CrsCod,crs_usr.Role,courses.DegCod"
|
||||
" FROM crs_usr,courses"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND courses.DegCod=%ld"
|
||||
" ORDER BY courses.ShortName",
|
||||
UsrCod,DegCod);
|
||||
else // All the courses
|
||||
sprintf (Query,"SELECT crs_usr.CrsCod,crs_usr.Role,courses.DegCod"
|
||||
" FROM crs_usr,courses,degrees"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" ORDER BY degrees.ShortName,courses.ShortName",
|
||||
|
@ -2173,7 +2173,7 @@ static bool Usr_CheckIfMyBirthdayHasNotBeenCongratulated (void)
|
|||
char Query[128];
|
||||
|
||||
/***** Delete old birthdays *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM birthdays_today WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM birthdays_today WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if my birthday has been congratulated") == 0);
|
||||
}
|
||||
|
@ -2194,7 +2194,7 @@ static void Usr_InsertMyBirthday (void)
|
|||
sprintf (Query,"INSERT INTO birthdays_today"
|
||||
" (UsrCod,Today)"
|
||||
" VALUES"
|
||||
" ('%ld',CURDATE())",
|
||||
" (%ld,CURDATE())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryINSERT (Query,"can not insert birthday");
|
||||
}
|
||||
|
@ -3077,14 +3077,14 @@ void Usr_UpdateMyLastData (void)
|
|||
char Query[256];
|
||||
|
||||
/***** Check if it exists an entry for me *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_last WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_last WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not get last user's click"))
|
||||
{
|
||||
/***** Update my last accessed course, tab and time of click in database *****/
|
||||
// WhatToSearch, LastAccNotif remain unchanged
|
||||
sprintf (Query,"UPDATE usr_last SET LastCrs='%ld',LastTab='%u',LastTime=NOW()"
|
||||
" WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE usr_last SET LastCrs=%ld,LastTab=%u,LastTime=NOW()"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Gbl.Action.Tab,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -3106,7 +3106,7 @@ static void Usr_InsertMyLastData (void)
|
|||
sprintf (Query,"INSERT INTO usr_last"
|
||||
" (UsrCod,WhatToSearch,LastCrs,LastTab,LastTime,LastAccNotif)"
|
||||
" VALUES"
|
||||
" ('%ld','%u','%ld','%u',NOW(),FROM_UNIXTIME('%ld'))",
|
||||
" (%ld,%u,%ld,%u,NOW(),FROM_UNIXTIME(%ld))",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Sch_SEARCH_ALL,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -3657,7 +3657,7 @@ unsigned Usr_GetNumUsrsInCrs (Rol_Role_t Role,long CrsCod)
|
|||
|
||||
/***** Get the number of teachers in a course from database ******/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND Role='%u'",
|
||||
" WHERE CrsCod=%ld AND Role=%u",
|
||||
CrsCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in a course");
|
||||
}
|
||||
|
@ -3673,9 +3673,9 @@ unsigned Usr_GetNumUsrsInCrssOfDeg (Rol_Role_t Role,long DegCod)
|
|||
/***** Get the number of users in courses of a degree from database ******/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
DegCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of a degree");
|
||||
}
|
||||
|
@ -3693,7 +3693,7 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
|
|||
if (Role == Rol_UNKNOWN) // Any user
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod",
|
||||
CtrCod);
|
||||
|
@ -3702,10 +3702,10 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
|
|||
// It's a bad idea to get number of teachers or students for a big list of centres
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
CtrCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of a centre");
|
||||
}
|
||||
|
@ -3723,7 +3723,7 @@ unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
|
|||
if (Role == Rol_UNKNOWN) // Any user
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod",
|
||||
|
@ -3733,11 +3733,11 @@ unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
|
|||
// It's a bad idea to get number of teachers or students for a big list of institutions
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
InsCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of an institution");
|
||||
}
|
||||
|
@ -3755,7 +3755,7 @@ unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod)
|
|||
if (Role == Rol_UNKNOWN) // Any user
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -3766,12 +3766,12 @@ unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod)
|
|||
// It's a bad idea to get number of teachers or students for a big list of countries
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'",
|
||||
" AND crs_usr.Role=%u",
|
||||
CtyCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of a country");
|
||||
}
|
||||
|
@ -3790,7 +3790,7 @@ long Usr_GetRamdomStdFromCrs (long CrsCod)
|
|||
|
||||
/***** Get a random student from current course from database *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND Role='%u'"
|
||||
" WHERE CrsCod=%ld AND Role=%u"
|
||||
" ORDER BY RAND(NOW()) LIMIT 1",
|
||||
CrsCod,(unsigned) Rol_STUDENT);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from the current course"))
|
||||
|
@ -3820,9 +3820,9 @@ long Usr_GetRamdomStdFromGrp (long GrpCod)
|
|||
|
||||
/***** Get a random student from a group from database *****/
|
||||
sprintf (Query,"SELECT crs_grp_usr.UsrCod FROM crs_grp_usr,crs_usr"
|
||||
" WHERE crs_grp_usr.GrpCod='%ld'"
|
||||
" WHERE crs_grp_usr.GrpCod=%ld"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u' ORDER BY RAND(NOW()) LIMIT 1",
|
||||
" AND crs_usr.Role=%u ORDER BY RAND(NOW()) LIMIT 1",
|
||||
GrpCod,(unsigned) Rol_STUDENT);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from a group"))
|
||||
{
|
||||
|
@ -3849,8 +3849,8 @@ unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod)
|
|||
from the current institution in a department *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.InsCod='%ld' AND usr_data.DptCod='%ld'"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
||||
" WHERE usr_data.InsCod=%ld AND usr_data.DptCod=%ld"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role=%u",
|
||||
Gbl.CurrentIns.Ins.InsCod,DptCod,(unsigned) Rol_TEACHER);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a department");
|
||||
}
|
||||
|
@ -3864,7 +3864,7 @@ unsigned Usr_GetNumUsrsWhoClaimToBelongToCty (long CtyCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get the number of users in a country from database *****/
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE CtyCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE CtyCod=%ld",
|
||||
CtyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in a country");
|
||||
}
|
||||
|
@ -3878,7 +3878,7 @@ unsigned Usr_GetNumUsrsWhoClaimToBelongToIns (long InsCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get the number of users in an institution from database *****/
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE InsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE InsCod=%ld",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in an institution");
|
||||
}
|
||||
|
@ -3892,7 +3892,7 @@ unsigned Usr_GetNumUsrsWhoClaimToBelongToCtr (long CtrCod)
|
|||
char Query[128];
|
||||
|
||||
/***** Get the number of users in a centre from database *****/
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE CtrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(UsrCod) FROM usr_data WHERE CtrCod=%ld",
|
||||
CtrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in a centre");
|
||||
}
|
||||
|
@ -3908,8 +3908,8 @@ unsigned Usr_GetNumberOfTeachersInCentre (long CtrCod)
|
|||
/***** Get the number of teachers in a centre from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.CtrCod='%ld'"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
||||
" WHERE usr_data.CtrCod=%ld"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role=%u",
|
||||
CtrCod,(unsigned) Rol_TEACHER);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a centre");
|
||||
}
|
||||
|
@ -3970,18 +3970,18 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,
|
|||
/***** Create query for users in the course *****/
|
||||
if (Gbl.Action.Act == ActReqMsgUsr) // Selecting users to write a message
|
||||
sprintf (Query,"SELECT %s FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod NOT IN"
|
||||
" (SELECT ToUsrCod FROM msg_banned WHERE FromUsrCod='%ld')"
|
||||
" (SELECT ToUsrCod FROM msg_banned WHERE FromUsrCod=%ld)"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod", // Do not get banned users
|
||||
QueryFields,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Role,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
else
|
||||
sprintf (Query,"SELECT %s FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" WHERE crs_usr.CrsCod=%ld"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Role);
|
||||
|
@ -4140,7 +4140,7 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
|
@ -4154,12 +4154,12 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres,institutions"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
|
@ -4174,11 +4174,11 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
|
@ -4193,10 +4193,10 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
|
@ -4211,9 +4211,9 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND courses.DegCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
|
@ -4305,7 +4305,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
|
@ -4319,7 +4319,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
|
@ -4332,7 +4332,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
|
@ -4344,7 +4344,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
|
@ -4355,7 +4355,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
|
@ -4389,7 +4389,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4400,12 +4400,12 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4417,11 +4417,11 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4433,10 +4433,10 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4448,9 +4448,9 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4462,8 +4462,8 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
|
@ -4580,20 +4580,20 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
|
|||
"(SELECT admin.UsrCod FROM admin,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld')"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld')"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld')"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
|
@ -4610,18 +4610,18 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
|
|||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld')"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld')"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
|
@ -4639,15 +4639,15 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
|
|||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld')"
|
||||
" AND degrees.CtrCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
|
@ -4663,13 +4663,13 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
|
|||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod='%ld')"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
|
@ -4730,7 +4730,7 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
|
|||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT %s FROM usr_data"
|
||||
" WHERE (CtyCod='%ld' OR InsCtyCod='%ld')"
|
||||
" WHERE (CtyCod=%ld OR InsCtyCod=%ld)"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
|
@ -4739,7 +4739,7 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
|
|||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT %s FROM usr_data"
|
||||
" WHERE InsCod='%ld'"
|
||||
" WHERE InsCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
|
@ -4747,7 +4747,7 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
|
|||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT %s FROM usr_data"
|
||||
" WHERE CtrCod='%ld'"
|
||||
" WHERE CtrCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
|
@ -4800,9 +4800,9 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod)
|
|||
{
|
||||
/***** Get the students in a degree from database *****/
|
||||
sprintf (Query,"SELECT %s FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||
QueryFields,
|
||||
DegCod,(unsigned) Rol_STUDENT);
|
||||
|
@ -6832,7 +6832,7 @@ static void Usr_GetMyUsrListTypeFromDB (void)
|
|||
|
||||
/***** Get type of listing of users from database *****/
|
||||
sprintf (Query,"SELECT UsrListType FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get type of listing of users");
|
||||
|
||||
|
@ -6870,7 +6870,7 @@ static void Usr_UpdateMyUsrListTypeInDB (void)
|
|||
|
||||
/***** Update type of users listing *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET UsrListType='%s'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Usr_StringsUsrListTypeInDB[Gbl.Usrs.Me.ListType],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update type of listing");
|
||||
|
@ -6934,7 +6934,7 @@ static void Usr_GetMyColsClassPhotoFromDB (void)
|
|||
{
|
||||
/***** Get number of columns in class photo from database *****/
|
||||
sprintf (Query,"SELECT ColsClassPhoto FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get number of columns in class photo");
|
||||
|
||||
|
@ -6967,8 +6967,8 @@ static void Usr_UpdateMyColsClassPhotoInDB (void)
|
|||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0 && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
{
|
||||
/***** Update number of colums in class photo for current course *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET ColsClassPhoto='%u'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
sprintf (Query,"UPDATE crs_usr SET ColsClassPhoto=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Usrs.ClassPhoto.Cols,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update number of columns in class photo");
|
||||
|
@ -7039,7 +7039,7 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void)
|
|||
{
|
||||
/***** Get if listing of users must show photos from database *****/
|
||||
sprintf (Query,"SELECT ListWithPhotos FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not check if listing of users must show photos");
|
||||
|
||||
|
@ -7070,7 +7070,7 @@ static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void)
|
|||
{
|
||||
/***** Update number of colums in class photo for current course *****/
|
||||
sprintf (Query,"UPDATE crs_usr SET ListWithPhotos='%c'"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Usrs.Listing.WithPhotos ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -8093,7 +8093,7 @@ bool Usr_ChkIfUsrCodExists (long UsrCod)
|
|||
return false;
|
||||
|
||||
/***** Get if a user exists in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user exists") != 0);
|
||||
}
|
||||
|
@ -8199,7 +8199,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(CrsCod) AS NumCrss"
|
||||
" FROM crs_usr"
|
||||
" WHERE Role='%u' GROUP BY UsrCod) AS NumCrssTable",
|
||||
" WHERE Role=%u GROUP BY UsrCod) AS NumCrssTable",
|
||||
(unsigned) Role);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
|
@ -8207,7 +8207,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -8218,12 +8218,12 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8233,7 +8233,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -8243,11 +8243,11 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8257,7 +8257,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
|
@ -8266,10 +8266,10 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8279,7 +8279,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -8287,9 +8287,9 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8336,7 +8336,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(UsrCod) AS NumUsrs"
|
||||
" FROM crs_usr"
|
||||
" WHERE Role='%u' GROUP BY CrsCod) AS NumUsrsTable",
|
||||
" WHERE Role=%u GROUP BY CrsCod) AS NumUsrsTable",
|
||||
(unsigned) Role);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
|
@ -8344,7 +8344,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -8355,12 +8355,12 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8370,7 +8370,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -8380,11 +8380,11 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM centres,degrees,courses,crs_usr"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" WHERE centres.InsCod=%ld"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8394,7 +8394,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
|
@ -8403,10 +8403,10 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" WHERE degrees.CtrCod=%ld"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8416,7 +8416,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
@ -8424,9 +8424,9 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
(unsigned) Role);
|
||||
|
@ -8459,7 +8459,7 @@ bool Usr_CheckIfUsrBanned (long UsrCod)
|
|||
{
|
||||
char Query[128];
|
||||
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_banned WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_banned WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if user is banned") != 0);
|
||||
}
|
||||
|
@ -8472,7 +8472,7 @@ void Usr_RemoveUsrFromUsrBanned (long UsrCod)
|
|||
{
|
||||
char Query[128];
|
||||
|
||||
sprintf (Query,"DELETE FROM usr_banned WHERE UsrCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM usr_banned WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from users banned");
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ static int Svc_CheckCourseAndGroupCodes (long CrsCod,long GrpCod)
|
|||
"Course code must be a integer greater than 0");
|
||||
|
||||
/***** Query if course code already exists in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM courses WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM courses WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
if (DB_QueryCOUNT (Query,"can not get course") != 1)
|
||||
return soap_sender_fault (Gbl.soap,
|
||||
|
@ -427,7 +427,7 @@ static int Svc_CheckCourseAndGroupCodes (long CrsCod,long GrpCod)
|
|||
{
|
||||
/***** Query if group code already exists in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%ld' AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod AND crs_grp.GrpCod='%ld'",
|
||||
" WHERE crs_grp_types.CrsCod=%ld AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod AND crs_grp.GrpCod=%ld",
|
||||
CrsCod,GrpCod);
|
||||
if (DB_QueryCOUNT (Query,"can not get group") != 1)
|
||||
return soap_sender_fault (Gbl.soap,
|
||||
|
@ -468,7 +468,7 @@ static int Svc_GenerateNewWSKey (long UsrCod,
|
|||
sprintf (Query,"INSERT INTO ws_keys"
|
||||
" (WSKey,UsrCod,PlgCod,LastTime)"
|
||||
" VALUES"
|
||||
" ('%s','%ld','%ld',NOW())",
|
||||
" ('%s',%ld,%ld,NOW())",
|
||||
WSKey,UsrCod,Gbl.WebService.PlgCod);
|
||||
DB_QueryINSERT (Query,"can not insert new key");
|
||||
|
||||
|
@ -511,7 +511,7 @@ static int Svc_GetCurrentDegCodFromCurrentCrsCod (void)
|
|||
Gbl.CurrentDeg.Deg.DegCod = -1L;
|
||||
|
||||
/***** Check that key does not exist in database *****/
|
||||
sprintf (Query,"SELECT DegCod FROM courses WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT DegCod FROM courses WHERE CrsCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the degree of a course")) // Course found in table of courses
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
/***** Get some user's data *****/
|
||||
/* Query database */
|
||||
sprintf (Query,"SELECT Surname1,Surname2,FirstName,Photo,DATE_FORMAT(Birthday,'%%Y%%m%%d')"
|
||||
" FROM usr_data WHERE UsrCod='%ld'",
|
||||
" FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/* Check number of rows in result */
|
||||
|
@ -584,7 +584,7 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
{
|
||||
/* Get the role in the given course */
|
||||
sprintf (Query,"SELECT Role FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
CrsCod,UsrDat->UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's role")) // User belongs to course
|
||||
{
|
||||
|
@ -604,7 +604,7 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
{
|
||||
/* Get the maximum role in any course */
|
||||
sprintf (Query,"SELECT MAX(Role)"
|
||||
" FROM crs_usr WHERE UsrCod='%ld'",
|
||||
" FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's role") == 1)
|
||||
{
|
||||
|
@ -1199,7 +1199,7 @@ int swad__getCourses (struct soap *soap,
|
|||
|
||||
/***** Query my courses from database *****/
|
||||
sprintf (Query,"SELECT courses.CrsCod,courses.ShortName,courses.FullName,crs_usr.Role FROM crs_usr,courses"
|
||||
" WHERE crs_usr.UsrCod='%ld' AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" WHERE crs_usr.UsrCod=%ld AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" ORDER BY courses.FullName",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get user's courses");
|
||||
|
@ -1660,7 +1660,7 @@ int swad__getGroupTypes (struct soap *soap,
|
|||
/***** Query group types in a course from database *****/
|
||||
sprintf (Query,"SELECT GrpTypCod,GrpTypName,Mandatory,Multiple,UNIX_TIMESTAMP(OpenTime)"
|
||||
" FROM crs_grp_types"
|
||||
" WHERE CrsCod='%d'"
|
||||
" WHERE CrsCod=%d"
|
||||
" ORDER BY GrpTypName",
|
||||
courseCode);
|
||||
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get group types");
|
||||
|
@ -1770,7 +1770,7 @@ int swad__getGroups (struct soap *soap,
|
|||
"crs_grp.GrpCod,crs_grp.GrpName,"
|
||||
"crs_grp.MaxStudents,crs_grp.Open,crs_grp.FileZones"
|
||||
" FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%d'"
|
||||
" WHERE crs_grp_types.CrsCod=%d"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
courseCode);
|
||||
|
@ -1931,7 +1931,7 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
"crs_grp.GrpCod,crs_grp.GrpName,"
|
||||
"crs_grp.MaxStudents,crs_grp.Open,crs_grp.FileZones"
|
||||
" FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod='%d'"
|
||||
" WHERE crs_grp_types.CrsCod=%d"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
||||
courseCode);
|
||||
|
@ -2111,7 +2111,7 @@ int swad__getAttendanceEvents (struct soap *soap,
|
|||
"UNIX_TIMESTAMP(EndTime) AS ET,"
|
||||
"CommentTchVisible,Title,Txt"
|
||||
" FROM att_events"
|
||||
" WHERE CrsCod='%d'"
|
||||
" WHERE CrsCod=%d"
|
||||
" ORDER BY ST DESC,ET DESC,Title DESC",
|
||||
courseCode);
|
||||
getAttendanceEventsOut->eventsArray.__size =
|
||||
|
@ -2230,7 +2230,7 @@ static void Svc_GetListGrpsInAttendanceEventFromDB (long AttCod,char **ListGroup
|
|||
size_t Length;
|
||||
|
||||
/***** Get list of groups *****/
|
||||
sprintf (Query,"SELECT GrpCod FROM att_grp WHERE AttCod='%ld'",
|
||||
sprintf (Query,"SELECT GrpCod FROM att_grp WHERE AttCod=%ld",
|
||||
AttCod);
|
||||
if ((NumGrps = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get groups of an attendance event")) == 0)
|
||||
*ListGroups = NULL;
|
||||
|
@ -2533,15 +2533,15 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
// ...who have no entry in attendance list of users
|
||||
sprintf (SubQuery,"SELECT DISTINCT crs_grp_usr.UsrCod AS UsrCod,'N' AS Present"
|
||||
" FROM att_grp,crs_grp,crs_grp_types,crs_usr,crs_grp_usr"
|
||||
" WHERE att_grp.AttCod='%ld'"
|
||||
" WHERE att_grp.AttCod=%ld"
|
||||
" AND att_grp.GrpCod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=crs_grp_usr.UsrCod"
|
||||
" AND crs_grp_usr.GrpCod=att_grp.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod NOT IN"
|
||||
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
||||
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
|
||||
Att.AttCod,
|
||||
(unsigned) Rol_STUDENT,
|
||||
Att.AttCod);
|
||||
|
@ -2551,18 +2551,18 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
// ...who have no entry in attendance list of users
|
||||
sprintf (SubQuery,"SELECT crs_usr.UsrCod AS UsrCod,'N' AS Present"
|
||||
" FROM att_events,crs_usr"
|
||||
" WHERE att_events.AttCod='%ld'"
|
||||
" WHERE att_events.AttCod=%ld"
|
||||
" AND att_events.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod NOT IN"
|
||||
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
||||
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
|
||||
Att.AttCod,
|
||||
(unsigned) Rol_STUDENT,
|
||||
Att.AttCod);
|
||||
// Query: list of users in attendance list + rest of users (subquery)
|
||||
sprintf (Query,"SELECT u.UsrCod,u.Present FROM "
|
||||
"(SELECT UsrCod,Present"
|
||||
" FROM att_usr WHERE AttCod='%ld'"
|
||||
" FROM att_usr WHERE AttCod=%ld"
|
||||
" UNION %s) AS u,usr_data"
|
||||
" WHERE u.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName",
|
||||
|
@ -2730,7 +2730,7 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
|||
"Not enough memory",
|
||||
"Not enough memory to store list of users");
|
||||
sprintf (Query,"UPDATE att_usr SET Present='N'"
|
||||
" WHERE AttCod='%ld'",
|
||||
" WHERE AttCod=%ld",
|
||||
Att.AttCod);
|
||||
}
|
||||
|
||||
|
@ -2754,8 +2754,8 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
|||
/* Add this user to query used to mark not present users as absent */
|
||||
if (setOthersAsAbsent)
|
||||
{
|
||||
sprintf (SubQuery,sendAttendanceUsersOut->numUsers ? ",'%ld'" :
|
||||
" AND UsrCod NOT IN ('%ld'",
|
||||
sprintf (SubQuery,sendAttendanceUsersOut->numUsers ? ",%ld" :
|
||||
" AND UsrCod NOT IN (%ld",
|
||||
UsrCod);
|
||||
Str_Concat (Query,SubQuery,
|
||||
Length);
|
||||
|
@ -2847,7 +2847,7 @@ int swad__getNotifications (struct soap *soap,
|
|||
sprintf (Query,"SELECT NtfCod,NotifyEvent,UNIX_TIMESTAMP(TimeNotif),"
|
||||
"FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod,Status"
|
||||
" FROM notif"
|
||||
" WHERE ToUsrCod='%ld' AND TimeNotif>=FROM_UNIXTIME('%ld')"
|
||||
" WHERE ToUsrCod=%ld AND TimeNotif>=FROM_UNIXTIME(%ld)"
|
||||
" ORDER BY TimeNotif DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,beginTime);
|
||||
NumNotifications = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get user's notifications");
|
||||
|
@ -3035,7 +3035,7 @@ static int Svc_GetMyLanguage (void)
|
|||
|
||||
/***** Get user's language *****/
|
||||
sprintf (Query,"SELECT Language FROM usr_data"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's language") != 1)
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
|
@ -3113,7 +3113,7 @@ int swad__markNotificationsAsRead (struct soap *soap,
|
|||
{
|
||||
/***** Mark notification as read in the database *****/
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NtfCod='%ld' AND ToUsrCod='%ld'",
|
||||
" WHERE NtfCod=%ld AND ToUsrCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
(long) NtfCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not mark notification as read");
|
||||
|
@ -3177,10 +3177,10 @@ int swad__sendMessage (struct soap *soap,
|
|||
/***** Check if the original message was really received by me *****/
|
||||
sprintf (Query,"SELECT SUM(N) FROM"
|
||||
" (SELECT COUNT(*) AS N FROM msg_rcv"
|
||||
" WHERE UsrCod='%ld' AND MsgCod='%ld'"
|
||||
" WHERE UsrCod=%ld AND MsgCod=%ld"
|
||||
" UNION"
|
||||
" SELECT COUNT(*) AS N FROM msg_rcv_deleted"
|
||||
" WHERE UsrCod='%ld' AND MsgCod='%ld') AS T",
|
||||
" WHERE UsrCod=%ld AND MsgCod=%ld) AS T",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(long) messageCode,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(long) messageCode);
|
||||
if (!DB_QuerySELECT (Query,&mysql_res,"can not check original message"))
|
||||
|
@ -3205,10 +3205,10 @@ int swad__sendMessage (struct soap *soap,
|
|||
|
||||
/***** Get the recipient of the message *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM msg_snt"
|
||||
" WHERE MsgCod='%ld'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" UNION "
|
||||
"SELECT UsrCod FROM msg_snt_deleted"
|
||||
" WHERE MsgCod='%ld'",
|
||||
" WHERE MsgCod=%ld",
|
||||
(long) messageCode,(long) messageCode);
|
||||
if ((NumRows = DB_QuerySELECT (Query,&mysql_res,"can not check original message"))) // Message found in any of the two tables of sent messages
|
||||
{
|
||||
|
@ -3229,7 +3229,7 @@ int swad__sendMessage (struct soap *soap,
|
|||
/***** Build query for recipients from database *****/
|
||||
if (ReplyUsrCod > 0)
|
||||
sprintf (Query,"SELECT UsrCod FROM usr_data"
|
||||
" WHERE UsrCod='%ld'",
|
||||
" WHERE UsrCod=%ld",
|
||||
ReplyUsrCod);
|
||||
else
|
||||
Query[0] = '\0';
|
||||
|
@ -3365,7 +3365,7 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
|||
sprintf (Query,"INSERT INTO msg_snt"
|
||||
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
||||
" VALUES"
|
||||
" ('%ld','-1','%ld','N',NOW())",
|
||||
" (%ld,-1,%ld,'N',NOW())",
|
||||
NewMsgCod,SenderUsrCod);
|
||||
DB_QueryINSERT (Query,"can not create message");
|
||||
|
||||
|
@ -3376,7 +3376,7 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
|||
sprintf (Query,"INSERT INTO msg_rcv"
|
||||
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld','%c','N','N','N')",
|
||||
" (%ld,%ld,'%c','N','N','N')",
|
||||
NewMsgCod,RecipientUsrCod,
|
||||
NotifyByEmail ? 'Y' :
|
||||
'N');
|
||||
|
@ -3387,7 +3387,7 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
|||
sprintf (Query,"INSERT INTO notif"
|
||||
" (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
|
||||
" VALUES"
|
||||
" ('%u','%ld','%ld','-1','-1','-1','%ld',NOW(),'%u')",
|
||||
" (%u,%ld,%ld,-1,-1,-1,%ld,NOW(),%u)",
|
||||
(unsigned) Ntf_EVENT_MESSAGE,
|
||||
RecipientUsrCod,
|
||||
SenderUsrCod,
|
||||
|
@ -3401,7 +3401,7 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
|||
{
|
||||
/***** ...then update received message setting Replied field to true *****/
|
||||
sprintf (Query,"UPDATE msg_rcv SET Replied='Y'"
|
||||
" WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
OriginalMsgCod,SenderUsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update a received message");
|
||||
}
|
||||
|
@ -3461,7 +3461,7 @@ int swad__sendNotice (struct soap *soap,
|
|||
sprintf (Query,"INSERT INTO notices"
|
||||
" (CrsCod,UsrCod,CreatTime,Content,Status)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',NOW(),'%s','%u')",
|
||||
" (%ld,%ld,NOW(),'%s',%u)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
body,(unsigned) Not_ACTIVE_NOTICE);
|
||||
|
||||
|
@ -3564,7 +3564,7 @@ static int Svc_GetTstConfig (long CrsCod)
|
|||
|
||||
/***** Query database *****/
|
||||
sprintf (Query,"SELECT Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback"
|
||||
" FROM tst_config WHERE CrsCod='%ld'",
|
||||
" FROM tst_config WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get test configuration"))
|
||||
{
|
||||
|
@ -3598,14 +3598,14 @@ static int Svc_GetNumTestQuestionsInCrs (long CrsCod)
|
|||
// Select only questions with tags
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM tst_questions,tst_question_tags,tst_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod FROM tst_tags,tst_question_tags"
|
||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagHidden='Y'"
|
||||
" WHERE tst_tags.CrsCod=%ld AND tst_tags.TagHidden='Y'"
|
||||
" AND tst_tags.TagCod=tst_question_tags.TagCod)"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'",
|
||||
" AND tst_tags.CrsCod=%ld",
|
||||
CrsCod,CrsCod,CrsCod);
|
||||
return (int) DB_QueryCOUNT (Query,"can not get number of test questions");
|
||||
}
|
||||
|
@ -3710,7 +3710,7 @@ static int Svc_GetTstTags (long CrsCod,struct swad__getTestsOutput *getTestsOut)
|
|||
/***** Get available tags from database *****/
|
||||
sprintf (Query,"SELECT TagCod,TagTxt"
|
||||
" FROM tst_tags"
|
||||
" WHERE CrsCod='%ld' AND TagHidden='N'"
|
||||
" WHERE CrsCod=%ld AND TagHidden='N'"
|
||||
" ORDER BY TagTxt",
|
||||
CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get test tags");
|
||||
|
@ -3766,19 +3766,19 @@ static int Svc_GetTstQuestions (long CrsCod,long BeginTime,struct swad__getTests
|
|||
"tst_questions.AnsType,tst_questions.Shuffle,"
|
||||
"tst_questions.Stem,tst_questions.Feedback"
|
||||
" FROM tst_questions,tst_question_tags,tst_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod FROM tst_tags,tst_question_tags"
|
||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagHidden='Y'"
|
||||
" WHERE tst_tags.CrsCod=%ld AND tst_tags.TagHidden='Y'"
|
||||
" AND tst_tags.TagCod=tst_question_tags.TagCod)"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'"
|
||||
" AND tst_tags.CrsCod=%ld"
|
||||
" AND "
|
||||
"("
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME(%ld)"
|
||||
" OR "
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME(%ld)"
|
||||
")"
|
||||
" ORDER BY QstCod",
|
||||
CrsCod,CrsCod,CrsCod,
|
||||
|
@ -3851,19 +3851,19 @@ static int Svc_GetTstAnswers (long CrsCod,long BeginTime,struct swad__getTestsOu
|
|||
" FROM tst_answers WHERE QstCod IN "
|
||||
"(SELECT tst_questions.QstCod"
|
||||
" FROM tst_questions,tst_question_tags,tst_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod FROM tst_tags,tst_question_tags"
|
||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagHidden='Y'"
|
||||
" WHERE tst_tags.CrsCod=%ld AND tst_tags.TagHidden='Y'"
|
||||
" AND tst_tags.TagCod=tst_question_tags.TagCod)"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'"
|
||||
" AND tst_tags.CrsCod=%ld"
|
||||
" AND "
|
||||
"("
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME(%ld)"
|
||||
" OR "
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME(%ld)"
|
||||
")"
|
||||
")"
|
||||
" ORDER BY QstCod,AnsInd",
|
||||
|
@ -3936,19 +3936,19 @@ static int Svc_GetTstQuestionTags (long CrsCod,long BeginTime,struct swad__getTe
|
|||
" FROM tst_question_tags WHERE QstCod IN "
|
||||
"(SELECT tst_questions.QstCod"
|
||||
" FROM tst_questions,tst_question_tags,tst_tags"
|
||||
" WHERE tst_questions.CrsCod='%ld'"
|
||||
" WHERE tst_questions.CrsCod=%ld"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod FROM tst_tags,tst_question_tags"
|
||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagHidden='Y'"
|
||||
" WHERE tst_tags.CrsCod=%ld AND tst_tags.TagHidden='Y'"
|
||||
" AND tst_tags.TagCod=tst_question_tags.TagCod)"
|
||||
" AND tst_questions.QstCod=tst_question_tags.QstCod"
|
||||
" AND tst_question_tags.TagCod=tst_tags.TagCod"
|
||||
" AND tst_tags.CrsCod='%ld'"
|
||||
" AND tst_tags.CrsCod=%ld"
|
||||
" AND "
|
||||
"("
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_questions.EditTime>=FROM_UNIXTIME(%ld)"
|
||||
" OR "
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME('%ld')"
|
||||
"tst_tags.ChangeTime>=FROM_UNIXTIME(%ld)"
|
||||
")"
|
||||
")"
|
||||
" ORDER BY QstCod,TagInd",
|
||||
|
@ -4064,12 +4064,12 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
/* Add this degree to query */
|
||||
if (FirstDegree)
|
||||
{
|
||||
sprintf (DegreesStr,"'%ld'",DegCod);
|
||||
sprintf (DegreesStr,"%ld",DegCod);
|
||||
FirstDegree = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (DegStr,",'%ld'",DegCod);
|
||||
sprintf (DegStr,",%ld",DegCod);
|
||||
Str_Concat (DegreesStr,DegStr,
|
||||
Svc_MAX_BYTES_DEGREES_STR);
|
||||
}
|
||||
|
@ -4099,7 +4099,7 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
" WHERE courses.DegCod IN (%s)"
|
||||
" AND courses.CrsCod=tst_questions.CrsCod"
|
||||
" AND tst_questions.AnsType='unique_choice'"
|
||||
" AND tst_questions.NumHits>'0'"
|
||||
" AND tst_questions.NumHits>0"
|
||||
" AND tst_questions.QstCod NOT IN"
|
||||
" (SELECT tst_question_tags.QstCod"
|
||||
" FROM courses,tst_tags,tst_question_tags"
|
||||
|
@ -4183,7 +4183,7 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
{
|
||||
/***** Get answer from database *****/
|
||||
sprintf (Query,"SELECT QstCod,AnsInd,Correct,Answer,Feedback"
|
||||
" FROM tst_answers WHERE QstCod='%ld'"
|
||||
" FROM tst_answers WHERE QstCod=%ld"
|
||||
" ORDER BY AnsInd",
|
||||
QstCod);
|
||||
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get test answers");
|
||||
|
|
Loading…
Reference in New Issue