mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version 18.8.14
This commit is contained in:
parent
b60c71b5a6
commit
24c1e20c59
|
@ -332,7 +332,6 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
||||||
|
|
||||||
void MFU_UpdateMFUActions (void)
|
void MFU_UpdateMFUActions (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
float Score;
|
float Score;
|
||||||
|
@ -380,12 +379,11 @@ void MFU_UpdateMFUActions (void)
|
||||||
DB_QueryREPLACE_new ("can not update most frequently used actions");
|
DB_QueryREPLACE_new ("can not update most frequently used actions");
|
||||||
|
|
||||||
/***** Update score for other actions *****/
|
/***** Update score for other actions *****/
|
||||||
if (asprintf (&Query,"UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
|
DB_BuildQuery ("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,
|
MFU_DECREASE_FACTOR,MFU_MIN_SCORE,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update most frequently used actions");
|
||||||
DB_QueryUPDATE_free (Query,"can not update most frequently used actions");
|
|
||||||
|
|
||||||
Str_SetDecimalPointToLocal (); // Return to local system
|
Str_SetDecimalPointToLocal (); // Return to local system
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.8.13 (2018-10-27)"
|
#define Log_PLATFORM_VERSION "SWAD 18.8.14 (2018-10-28)"
|
||||||
#define CSS_FILE "swad18.4.css"
|
#define CSS_FILE "swad18.4.css"
|
||||||
#define JS_FILE "swad17.17.1.js"
|
#define JS_FILE "swad17.17.1.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.8.14: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236493 lines)
|
||||||
Version 18.8.13: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236661 lines)
|
Version 18.8.13: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236661 lines)
|
||||||
Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)
|
Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)
|
||||||
Version 18.8.11: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236921 lines)
|
Version 18.8.11: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236921 lines)
|
||||||
|
|
|
@ -2607,13 +2607,10 @@ static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
||||||
|
|
||||||
void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
|
void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update institutional course code in table of courses *****/
|
/***** Update institutional course code in table of courses *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
||||||
NewInstitutionalCrsCod,Crs->CrsCod) < 0)
|
NewInstitutionalCrsCod,Crs->CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the institutional code"
|
||||||
DB_QueryUPDATE_free (Query,"can not update the institutional code"
|
|
||||||
" of the current course");
|
" of the current course");
|
||||||
|
|
||||||
/***** Copy institutional course code *****/
|
/***** Copy institutional course code *****/
|
||||||
|
|
|
@ -3300,20 +3300,6 @@ void DB_QueryUPDATE_new (const char *MsgError)
|
||||||
//return (unsigned long) mysql_affected_rows (&Gbl.mysql);
|
//return (unsigned long) mysql_affected_rows (&Gbl.mysql);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DB_QueryUPDATE_free (const char *Query,const char *MsgError)
|
|
||||||
{
|
|
||||||
int Result;
|
|
||||||
|
|
||||||
/***** Query database *****/
|
|
||||||
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
|
|
||||||
free ((void *) Query);
|
|
||||||
if (Result)
|
|
||||||
DB_ExitOnMySQLError (MsgError);
|
|
||||||
|
|
||||||
/***** Return number of rows updated *****/
|
|
||||||
//return (unsigned long) mysql_affected_rows (&Gbl.mysql);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DB_QueryUPDATE (const char *Query,const char *MsgError)
|
void DB_QueryUPDATE (const char *Query,const char *MsgError)
|
||||||
{
|
{
|
||||||
/***** Query database *****/
|
/***** Query database *****/
|
||||||
|
|
|
@ -55,7 +55,6 @@ void DB_QueryREPLACE_new (const char *MsgError);
|
||||||
void DB_QueryREPLACE (const char *Query,const char *MsgError);
|
void DB_QueryREPLACE (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_QueryUPDATE_new (const char *MsgError);
|
void DB_QueryUPDATE_new (const char *MsgError);
|
||||||
void DB_QueryUPDATE_free (const char *Query,const char *MsgError);
|
|
||||||
void DB_QueryUPDATE (const char *Query,const char *MsgError);
|
void DB_QueryUPDATE (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_QueryDELETE_new (const char *MsgError);
|
void DB_QueryDELETE_new (const char *MsgError);
|
||||||
|
|
|
@ -679,7 +679,6 @@ void Hld_RemoveHoliday2 (void)
|
||||||
void Hld_ChangeHolidayPlace1 (void)
|
void Hld_ChangeHolidayPlace1 (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_place_of_the_holiday_X_has_changed_to_Y;
|
extern const char *Txt_The_place_of_the_holiday_X_has_changed_to_Y;
|
||||||
char *Query;
|
|
||||||
struct Holiday *Hld;
|
struct Holiday *Hld;
|
||||||
struct Place NewPlace;
|
struct Place NewPlace;
|
||||||
|
|
||||||
|
@ -700,10 +699,9 @@ void Hld_ChangeHolidayPlace1 (void)
|
||||||
Hld_GetDataOfHolidayByCod (Hld);
|
Hld_GetDataOfHolidayByCod (Hld);
|
||||||
|
|
||||||
/***** Update the place in database *****/
|
/***** Update the place in database *****/
|
||||||
if (asprintf (&Query,"UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
|
DB_BuildQuery ("UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
|
||||||
NewPlace.PlcCod,Hld->HldCod) < 0)
|
NewPlace.PlcCod,Hld->HldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the place of a holiday");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the place of a holiday");
|
|
||||||
Hld->PlcCod = NewPlace.PlcCod;
|
Hld->PlcCod = NewPlace.PlcCod;
|
||||||
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
||||||
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
@ -731,7 +729,6 @@ void Hld_ChangeHolidayPlace2 (void)
|
||||||
void Hld_ChangeHolidayType1 (void)
|
void Hld_ChangeHolidayType1 (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_type_of_the_holiday_X_has_changed;
|
extern const char *Txt_The_type_of_the_holiday_X_has_changed;
|
||||||
char *Query;
|
|
||||||
struct Holiday *Hld;
|
struct Holiday *Hld;
|
||||||
|
|
||||||
Hld = &Gbl.Hlds.EditingHld;
|
Hld = &Gbl.Hlds.EditingHld;
|
||||||
|
@ -748,11 +745,10 @@ void Hld_ChangeHolidayType1 (void)
|
||||||
|
|
||||||
/***** Update holiday/no school period in database *****/
|
/***** Update holiday/no school period in database *****/
|
||||||
Dat_AssignDate (&Hld->EndDate,&Hld->StartDate);
|
Dat_AssignDate (&Hld->EndDate,&Hld->StartDate);
|
||||||
if (asprintf (&Query,"UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
|
DB_BuildQuery ("UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
|
||||||
" WHERE HldCod=%ld",
|
" WHERE HldCod=%ld",
|
||||||
(unsigned) Hld->HldTyp,Hld->HldCod) < 0)
|
(unsigned) Hld->HldTyp,Hld->HldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the type of a holiday");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the type of a holiday");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Gbl.Alert.Type = Ale_SUCCESS;
|
Gbl.Alert.Type = Ale_SUCCESS;
|
||||||
|
@ -795,7 +791,6 @@ void Hld_ChangeEndDate1 (void)
|
||||||
static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_date_of_the_holiday_X_has_changed_to_Y;
|
extern const char *Txt_The_date_of_the_holiday_X_has_changed_to_Y;
|
||||||
char *Query;
|
|
||||||
struct Holiday *Hld;
|
struct Holiday *Hld;
|
||||||
struct Date NewDate;
|
struct Date NewDate;
|
||||||
struct Date *PtrDate = NULL; // Initialized to avoid warning
|
struct Date *PtrDate = NULL; // Initialized to avoid warning
|
||||||
|
@ -845,14 +840,13 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Update the date in database *****/
|
/***** Update the date in database *****/
|
||||||
if (asprintf (&Query,"UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
|
DB_BuildQuery ("UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
|
||||||
StrStartOrEndDate,
|
StrStartOrEndDate,
|
||||||
NewDate.Year,
|
NewDate.Year,
|
||||||
NewDate.Month,
|
NewDate.Month,
|
||||||
NewDate.Day,
|
NewDate.Day,
|
||||||
Hld->HldCod) < 0)
|
Hld->HldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the date of a holiday");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the date of a holiday");
|
|
||||||
Dat_AssignDate (PtrDate,&NewDate);
|
Dat_AssignDate (PtrDate,&NewDate);
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
|
@ -885,7 +879,6 @@ void Hld_RenameHoliday1 (void)
|
||||||
extern const char *Txt_You_can_not_leave_the_name_of_the_holiday_X_empty;
|
extern const char *Txt_You_can_not_leave_the_name_of_the_holiday_X_empty;
|
||||||
extern const char *Txt_The_name_of_the_holiday_X_has_changed_to_Y;
|
extern const char *Txt_The_name_of_the_holiday_X_has_changed_to_Y;
|
||||||
extern const char *Txt_The_name_of_the_holiday_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_holiday_X_has_not_changed;
|
||||||
char *Query;
|
|
||||||
struct Holiday *Hld;
|
struct Holiday *Hld;
|
||||||
char NewHldName[Hld_MAX_BYTES_HOLIDAY_NAME + 1];
|
char NewHldName[Hld_MAX_BYTES_HOLIDAY_NAME + 1];
|
||||||
|
|
||||||
|
@ -917,10 +910,9 @@ void Hld_RenameHoliday1 (void)
|
||||||
{
|
{
|
||||||
/***** If degree was in database... *****/
|
/***** If degree was in database... *****/
|
||||||
/* Update the table changing old name by new name */
|
/* Update the table changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
|
DB_BuildQuery ("UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
|
||||||
NewHldName,Hld->HldCod) < 0)
|
NewHldName,Hld->HldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the text of a holiday");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the text of a holiday");
|
|
||||||
Str_Copy (Hld->Name,NewHldName,
|
Str_Copy (Hld->Name,NewHldName,
|
||||||
Hld_MAX_BYTES_HOLIDAY_NAME);
|
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,6 @@ static void Ico_PutIconsIconSet (void)
|
||||||
|
|
||||||
void Ico_ChangeIconSet (void)
|
void Ico_ChangeIconSet (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with icon set *****/
|
/***** Get param with icon set *****/
|
||||||
Gbl.Prefs.IconSet = Ico_GetParamIconSet ();
|
Gbl.Prefs.IconSet = Ico_GetParamIconSet ();
|
||||||
snprintf (Gbl.Prefs.PathIconSet,sizeof (Gbl.Prefs.PathIconSet),
|
snprintf (Gbl.Prefs.PathIconSet,sizeof (Gbl.Prefs.PathIconSet),
|
||||||
|
@ -135,11 +133,10 @@ void Ico_ChangeIconSet (void)
|
||||||
/***** Store icon set in database *****/
|
/***** Store icon set in database *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
DB_BuildQuery ("UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
||||||
Ico_IconSetId[Gbl.Prefs.IconSet],
|
Ico_IconSetId[Gbl.Prefs.IconSet],
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about icon set");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about icon set");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set preferences from current IP *****/
|
/***** Set preferences from current IP *****/
|
||||||
|
|
|
@ -1417,13 +1417,10 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
||||||
|
|
||||||
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Store number of indicators of a course in database *****/
|
/***** Store number of indicators of a course in database *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
||||||
NumIndicators,CrsCod) < 0)
|
NumIndicators,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not store number of indicators of a course");
|
||||||
DB_QueryUPDATE_free (Query,"can not store number of indicators of a course");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
51
swad_info.c
51
swad_info.c
|
@ -695,16 +695,14 @@ static bool Inf_GetIfIHaveReadFromForm (void)
|
||||||
|
|
||||||
static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Insert or replace info source for a specific type of course information *****/
|
/***** Insert or replace info source for a specific type of course information *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_info_src SET MustBeRead='%c'"
|
DB_BuildQuery ("UPDATE crs_info_src SET MustBeRead='%c'"
|
||||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||||
MustBeRead ? 'Y' :
|
MustBeRead ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Lay_NotEnoughMemoryExit ();
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
DB_QueryUPDATE_free (Query,"can not update if info must be read");
|
DB_QueryUPDATE_new ("can not update if info must be read");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -713,31 +711,27 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
||||||
|
|
||||||
static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
if (IHaveRead)
|
if (IHaveRead)
|
||||||
{
|
{
|
||||||
/***** Insert I have read course information *****/
|
/***** Insert I have read course information *****/
|
||||||
if (asprintf (&Query,"REPLACE INTO crs_info_read"
|
DB_BuildQuery ("REPLACE INTO crs_info_read"
|
||||||
" (UsrCod,CrsCod,InfoType)"
|
" (UsrCod,CrsCod,InfoType)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,'%s')",
|
" (%ld,%ld,'%s')",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set that I have read course info");
|
||||||
DB_QueryUPDATE_free (Query,"can not set that I have read course info");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Remove I have read course information *****/
|
/***** Remove I have read course information *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_info_read"
|
DB_BuildQuery ("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.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not set that I have not read course info");
|
||||||
DB_QueryDELETE_free (Query,"can not set that I have not read course info");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,35 +1480,26 @@ Inf_InfoSrc_t Inf_GetInfoSrcFromForm (void)
|
||||||
|
|
||||||
void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get if info source is already stored in database *****/
|
/***** Get if info source is already stored in database *****/
|
||||||
if (asprintf (&Query,"SELECT COUNT(*) FROM crs_info_src"
|
DB_BuildQuery ("SELECT COUNT(*) FROM crs_info_src"
|
||||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
Lay_NotEnoughMemoryExit ();
|
if (DB_QueryCOUNT_new ("can not get if info source is already stored in database")) // Info is already stored in database, so update it
|
||||||
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
|
{ // Update info source
|
||||||
if (InfoSrc == Inf_INFO_SRC_NONE)
|
if (InfoSrc == Inf_INFO_SRC_NONE)
|
||||||
{
|
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'"
|
||||||
if (asprintf (&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],
|
Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE],
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else // MustBeRead remains unchanged
|
else // MustBeRead remains unchanged
|
||||||
{
|
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s'"
|
||||||
if (asprintf (&Query,"UPDATE crs_info_src SET InfoSrc='%s'"
|
|
||||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||||
Inf_NamesInDBForInfoSrc[InfoSrc],
|
Inf_NamesInDBForInfoSrc[InfoSrc],
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]) < 0)
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update info source");
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update info source");
|
|
||||||
}
|
}
|
||||||
else // Info is not stored in database, so insert it
|
else // Info is not stored in database, so insert it
|
||||||
{
|
{
|
||||||
|
|
|
@ -1876,13 +1876,10 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
||||||
|
|
||||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update institution changing old name by new name */
|
/***** Update institution changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
DB_BuildQuery ("UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
||||||
FieldName,NewInsName,InsCod) < 0)
|
FieldName,NewInsName,InsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of an institution");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of an institution");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Ins_FlushCacheShortNameOfInstitution ();
|
Ins_FlushCacheShortNameOfInstitution ();
|
||||||
|
@ -1961,13 +1958,10 @@ void Ins_ContEditAfterChgInsInConfig (void)
|
||||||
|
|
||||||
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
|
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update country in table of institutions *****/
|
/***** Update country in table of institutions *****/
|
||||||
if (asprintf (&Query,"UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
DB_BuildQuery ("UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
||||||
CtyCod,InsCod) < 0)
|
CtyCod,InsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the country of an institution");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the country of an institution");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2050,13 +2044,10 @@ void Ins_ChangeInsWWWInConfig (void)
|
||||||
|
|
||||||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update database changing old WWW by new WWW *****/
|
/***** Update database changing old WWW by new WWW *****/
|
||||||
if (asprintf (&Query,"UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
DB_BuildQuery ("UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
||||||
NewWWW,InsCod) < 0)
|
NewWWW,InsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of an institution");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of an institution");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2066,7 +2057,6 @@ static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW
|
||||||
void Ins_ChangeInsStatus (void)
|
void Ins_ChangeInsStatus (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_status_of_the_institution_X_has_changed;
|
extern const char *Txt_The_status_of_the_institution_X_has_changed;
|
||||||
char *Query;
|
|
||||||
Ins_Status_t Status;
|
Ins_Status_t Status;
|
||||||
Ins_StatusTxt_t StatusTxt;
|
Ins_StatusTxt_t StatusTxt;
|
||||||
|
|
||||||
|
@ -2089,10 +2079,9 @@ void Ins_ChangeInsStatus (void)
|
||||||
Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
|
Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
|
||||||
|
|
||||||
/***** Update status in table of institutions *****/
|
/***** Update status in table of institutions *****/
|
||||||
if (asprintf (&Query,"UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
DB_BuildQuery ("UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
||||||
(unsigned) Status,Gbl.Inss.EditingIns.InsCod) < 0)
|
(unsigned) Status,Gbl.Inss.EditingIns.InsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the status of an institution");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the status of an institution");
|
|
||||||
Gbl.Inss.EditingIns.Status = Status;
|
Gbl.Inss.EditingIns.Status = Status;
|
||||||
|
|
||||||
/***** Write message to show the change made
|
/***** Write message to show the change made
|
||||||
|
|
|
@ -179,17 +179,15 @@ void Lan_ChangeLanguage (void)
|
||||||
void Lan_UpdateMyLanguageToCurrentLanguage (void)
|
void Lan_UpdateMyLanguageToCurrentLanguage (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set my language to the current language *****/
|
/***** Set my language to the current language *****/
|
||||||
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
|
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
|
||||||
|
|
||||||
/***** Update my language in database *****/
|
/***** Update my language in database *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
DB_BuildQuery ("UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your language");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your language");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
17
swad_link.c
17
swad_link.c
|
@ -642,13 +642,10 @@ static bool Lnk_CheckIfLinkNameExists (const char *FieldName,const char *Name,lo
|
||||||
|
|
||||||
static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *NewLnkName)
|
static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *NewLnkName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update institutional link changing old name by new name */
|
/***** Update institutional link changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE links SET %s='%s' WHERE LnkCod=%ld",
|
DB_BuildQuery ("UPDATE links SET %s='%s' WHERE LnkCod=%ld",
|
||||||
FieldName,NewLnkName,LnkCod) < 0)
|
FieldName,NewLnkName,LnkCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of an institutional link");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of an institutional link");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -660,7 +657,6 @@ void Lnk_ChangeLinkWWW (void)
|
||||||
extern const char *Txt_The_new_web_address_is_X;
|
extern const char *Txt_The_new_web_address_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||||
struct Link *Lnk;
|
struct Link *Lnk;
|
||||||
char *Query;
|
|
||||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
|
|
||||||
Lnk = &Gbl.Links.EditingLnk;
|
Lnk = &Gbl.Links.EditingLnk;
|
||||||
|
@ -677,10 +673,9 @@ void Lnk_ChangeLinkWWW (void)
|
||||||
if (NewWWW[0])
|
if (NewWWW[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old WWW by new WWW */
|
/* Update the table changing old WWW by new WWW */
|
||||||
if (asprintf (&Query,"UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
|
DB_BuildQuery ("UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
|
||||||
NewWWW,Lnk->LnkCod) < 0)
|
NewWWW,Lnk->LnkCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of an institutional link");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of an institutional link");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
16
swad_mail.c
16
swad_mail.c
|
@ -703,13 +703,10 @@ static bool Mai_CheckIfMailDomainNameExists (const char *FieldName,const char *N
|
||||||
|
|
||||||
static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const char *NewMaiName)
|
static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const char *NewMaiName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update mail domain changing old name by new name */
|
/***** Update mail domain changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
|
DB_BuildQuery ("UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
|
||||||
FieldName,NewMaiName,MaiCod) < 0)
|
FieldName,NewMaiName,MaiCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a mail domain");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a mail domain");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1861,12 +1858,11 @@ void Mai_ConfirmEmail (void)
|
||||||
Email);
|
Email);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_emails SET Confirmed='Y'"
|
DB_BuildQuery ("UPDATE usr_emails SET Confirmed='Y'"
|
||||||
" WHERE usr_emails.UsrCod=%ld"
|
" WHERE usr_emails.UsrCod=%ld"
|
||||||
" AND usr_emails.E_mail='%s'",
|
" AND usr_emails.E_mail='%s'",
|
||||||
UsrCod,Email) < 0)
|
UsrCod,Email);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not confirm email");
|
||||||
DB_QueryUPDATE_free (Query,"can not confirm email");
|
|
||||||
|
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
Txt_The_email_X_has_been_confirmed,
|
Txt_The_email_X_has_been_confirmed,
|
||||||
|
|
|
@ -257,7 +257,6 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
||||||
extern const char *Txt_The_number_of_rows_is_now_X;
|
extern const char *Txt_The_number_of_rows_is_now_X;
|
||||||
char UnsignedStr[10 + 1];
|
char UnsignedStr[10 + 1];
|
||||||
long Cod;
|
long Cod;
|
||||||
char *Query;
|
|
||||||
unsigned NumRows;
|
unsigned NumRows;
|
||||||
|
|
||||||
/***** Get parameters related to file browser *****/
|
/***** Get parameters related to file browser *****/
|
||||||
|
@ -269,16 +268,15 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
||||||
{
|
{
|
||||||
/***** Update properties of marks in the database *****/
|
/***** Update properties of marks in the database *****/
|
||||||
Cod = Brw_GetCodForFiles ();
|
Cod = Brw_GetCodForFiles ();
|
||||||
if (asprintf (&Query,"UPDATE marks_properties,files"
|
DB_BuildQuery ("UPDATE marks_properties,files"
|
||||||
" SET marks_properties.%s=%u"
|
" SET marks_properties.%s=%u"
|
||||||
" 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",
|
" AND files.FilCod=marks_properties.FilCod",
|
||||||
Mrk_HeadOrFootStr[HeaderOrFooter],NumRows,
|
Mrk_HeadOrFootStr[HeaderOrFooter],NumRows,
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,
|
Cod,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree) < 0)
|
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update properties of marks");
|
||||||
DB_QueryUPDATE_free (Query,"can not update properties of marks");
|
|
||||||
|
|
||||||
/***** Write message of success *****/
|
/***** Write message of success *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -455,18 +455,15 @@ static void Mnu_PutIconsMenu (void)
|
||||||
|
|
||||||
void Mnu_ChangeMenu (void)
|
void Mnu_ChangeMenu (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with menu *****/
|
/***** Get param with menu *****/
|
||||||
Gbl.Prefs.Menu = Mnu_GetParamMenu ();
|
Gbl.Prefs.Menu = Mnu_GetParamMenu ();
|
||||||
|
|
||||||
/***** Store menu in database *****/
|
/***** Store menu in database *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
DB_BuildQuery ("UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
||||||
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about menu");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set preferences from current IP *****/
|
/***** Set preferences from current IP *****/
|
||||||
|
|
|
@ -180,13 +180,10 @@ static long Not_InsertNoticeInDB (const char *Content)
|
||||||
|
|
||||||
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail)
|
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
/***** Update number of users notified *****/
|
||||||
if (asprintf (&Query,"UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
|
DB_BuildQuery ("UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
|
||||||
NumUsrsToBeNotifiedByEMail,NotCod) < 0)
|
NumUsrsToBeNotifiedByEMail,NotCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the number of notifications of a notice");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the number of notifications of a notice");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -224,19 +221,17 @@ void Not_ListFullNotices (void)
|
||||||
|
|
||||||
void Not_HideActiveNotice (void)
|
void Not_HideActiveNotice (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long NotCod;
|
long NotCod;
|
||||||
|
|
||||||
/***** Get the code of the notice to hide *****/
|
/***** Get the code of the notice to hide *****/
|
||||||
NotCod = Not_GetParamNotCod ();
|
NotCod = Not_GetParamNotCod ();
|
||||||
|
|
||||||
/***** Set notice as hidden *****/
|
/***** Set notice as hidden *****/
|
||||||
if (asprintf (&Query,"UPDATE notices SET Status=%u"
|
DB_BuildQuery ("UPDATE notices SET Status=%u"
|
||||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||||
(unsigned) Not_OBSOLETE_NOTICE,
|
(unsigned) Not_OBSOLETE_NOTICE,
|
||||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide notice");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide notice");
|
|
||||||
|
|
||||||
/***** Update RSS of current course *****/
|
/***** Update RSS of current course *****/
|
||||||
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
||||||
|
@ -248,19 +243,17 @@ void Not_HideActiveNotice (void)
|
||||||
|
|
||||||
void Not_RevealHiddenNotice (void)
|
void Not_RevealHiddenNotice (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long NotCod;
|
long NotCod;
|
||||||
|
|
||||||
/***** Get the code of the notice to reveal *****/
|
/***** Get the code of the notice to reveal *****/
|
||||||
NotCod = Not_GetParamNotCod ();
|
NotCod = Not_GetParamNotCod ();
|
||||||
|
|
||||||
/***** Set notice as active *****/
|
/***** Set notice as active *****/
|
||||||
if (asprintf (&Query,"UPDATE notices SET Status=%u"
|
DB_BuildQuery ("UPDATE notices SET Status=%u"
|
||||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||||
(unsigned) Not_ACTIVE_NOTICE,
|
(unsigned) Not_ACTIVE_NOTICE,
|
||||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not reveal notice");
|
||||||
DB_QueryUPDATE_free (Query,"can not reveal notice");
|
|
||||||
|
|
||||||
/***** Update RSS of current course *****/
|
/***** Update RSS of current course *****/
|
||||||
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
||||||
|
|
|
@ -953,36 +953,25 @@ void Ntf_GetNotifSummaryAndContent (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
|
|
||||||
void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,long ToUsrCod)
|
void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,long ToUsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set notification as seen by me *****/
|
/***** Set notification as seen by me *****/
|
||||||
if (ToUsrCod > 0) // If the user code is specified
|
if (ToUsrCod > 0) // If the user code is specified
|
||||||
{
|
{
|
||||||
if (Cod > 0) // Set only one notification for the user as seen
|
if (Cod > 0) // Set only one notification for the user as seen
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&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,
|
(unsigned) Ntf_STATUS_BIT_READ,
|
||||||
ToUsrCod,(unsigned) NotifyEvent,Cod) < 0)
|
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else if (CrsCod > 0) // Set all notifications of this type in the current course for the user as seen
|
else if (CrsCod > 0) // Set all notifications of this type in the current course for the user as seen
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&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,
|
(unsigned) Ntf_STATUS_BIT_READ,
|
||||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else // Set all notifications of this type for the user as seen
|
else // Set all notifications of this type for the user as seen
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
|
||||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u",
|
" WHERE ToUsrCod=%ld AND NotifyEvent=%u",
|
||||||
(unsigned) Ntf_STATUS_BIT_READ,
|
(unsigned) Ntf_STATUS_BIT_READ,
|
||||||
ToUsrCod,(unsigned) NotifyEvent) < 0)
|
ToUsrCod,(unsigned) NotifyEvent);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as seen");
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as seen");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,15 +981,12 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon
|
||||||
|
|
||||||
void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set notification as removed *****/
|
/***** Set notification as removed *****/
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
" WHERE NotifyEvent=%u AND Cod=%ld",
|
" WHERE NotifyEvent=%u AND Cod=%ld",
|
||||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
(unsigned) NotifyEvent,Cod) < 0)
|
(unsigned) NotifyEvent,Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1009,26 +995,18 @@ void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
|
|
||||||
void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod)
|
void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set notification as removed *****/
|
/***** Set notification as removed *****/
|
||||||
if (Cod > 0) // Set only one notification as removed
|
if (Cod > 0) // Set only one notification as removed
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&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,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
ToUsrCod,(unsigned) NotifyEvent,Cod) < 0)
|
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else // Set all notifications of this type, in the current course for the user, as removed
|
else // Set all notifications of this type, in the current course for the user, as removed
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&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,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1041,31 +1019,23 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long
|
||||||
|
|
||||||
void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
|
void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set all notifications from the course as removed,
|
/***** Set all notifications from the course as removed,
|
||||||
except notifications about new messages *****/
|
except notifications about new messages *****/
|
||||||
if (ToUsrCod > 0) // If the user code is specified
|
if (ToUsrCod > 0) // If the user code is specified
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
|
||||||
" WHERE ToUsrCod=%ld"
|
" WHERE ToUsrCod=%ld"
|
||||||
" AND CrsCod=%ld"
|
" AND CrsCod=%ld"
|
||||||
" AND NotifyEvent<>%u", // messages will remain available
|
" AND NotifyEvent<>%u", // messages will remain available
|
||||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
ToUsrCod,
|
ToUsrCod,
|
||||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE) < 0)
|
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else // User code not specified ==> any user
|
else // User code not specified ==> any user
|
||||||
{
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
|
||||||
" WHERE CrsCod=%ld"
|
" WHERE CrsCod=%ld"
|
||||||
" AND NotifyEvent<>%u", // messages will remain available
|
" AND NotifyEvent<>%u", // messages will remain available
|
||||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE) < 0)
|
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1132,7 +1102,6 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
||||||
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||||
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
char *Query;
|
|
||||||
Ntf_NotifyEvent_t NotifyEvent;
|
Ntf_NotifyEvent_t NotifyEvent;
|
||||||
|
|
||||||
switch (FileBrowser)
|
switch (FileBrowser)
|
||||||
|
@ -1167,7 +1136,7 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
" WHERE NotifyEvent=%u AND Cod IN"
|
" WHERE NotifyEvent=%u AND Cod IN"
|
||||||
" (SELECT FilCod FROM files"
|
" (SELECT FilCod FROM files"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||||
|
@ -1175,9 +1144,8 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
||||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
(unsigned) NotifyEvent,
|
(unsigned) NotifyEvent,
|
||||||
(unsigned) FileBrowser,Cod,
|
(unsigned) FileBrowser,Cod,
|
||||||
Path) < 0)
|
Path);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1190,10 +1158,8 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
||||||
|
|
||||||
void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set notifications as removed *****/
|
/***** Set notifications as removed *****/
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
DB_BuildQuery ("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"
|
" (SELECT FilCod FROM files"
|
||||||
" WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)",
|
" WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)",
|
||||||
|
@ -1206,9 +1172,8 @@ void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
||||||
(unsigned) Brw_ADMI_TCH_GRP,
|
(unsigned) Brw_ADMI_TCH_GRP,
|
||||||
(unsigned) Brw_ADMI_SHR_GRP,
|
(unsigned) Brw_ADMI_SHR_GRP,
|
||||||
(unsigned) Brw_ADMI_MRK_GRP,
|
(unsigned) Brw_ADMI_MRK_GRP,
|
||||||
GrpCod) < 0)
|
GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1528,14 +1493,11 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
|
|
||||||
static void Ntf_UpdateMyLastAccessToNotifications (void)
|
static void Ntf_UpdateMyLastAccessToNotifications (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Reset to 0 my number of new received messages *****/
|
/***** Reset to 0 my number of new received messages *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_last SET LastAccNotif=NOW()"
|
DB_BuildQuery ("UPDATE usr_last SET LastAccNotif=NOW()"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update last access to notifications");
|
||||||
DB_QueryUPDATE_free (Query,"can not update last access to notifications");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1620,7 +1582,6 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
||||||
extern const char *Txt_TAB_Messages_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
extern const char *Txt_TAB_Messages_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
||||||
extern const char *Txt_Notifications_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
extern const char *Txt_Notifications_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
||||||
extern const char *Txt_If_you_no_longer_wish_to_receive_email_notifications_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
extern const char *Txt_If_you_no_longer_wish_to_receive_email_notifications_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumRow;
|
unsigned long NumRow;
|
||||||
|
@ -1817,15 +1778,14 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Mark all the pending notifications of this user as 'sent' *****/
|
/***** Mark all the pending notifications of this user as 'sent' *****/
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
" WHERE ToUsrCod=%ld"
|
" WHERE ToUsrCod=%ld"
|
||||||
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0",
|
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0",
|
||||||
(unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod,
|
(unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod,
|
||||||
(unsigned) Ntf_STATUS_BIT_EMAIL,
|
(unsigned) Ntf_STATUS_BIT_EMAIL,
|
||||||
(unsigned) Ntf_STATUS_BIT_SENT,
|
(unsigned) Ntf_STATUS_BIT_SENT,
|
||||||
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED)) < 0)
|
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set pending notifications of a user as sent");
|
||||||
DB_QueryUPDATE_free (Query,"can not set pending notifications of a user as sent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -1913,15 +1873,12 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
|
||||||
|
|
||||||
void Ntf_MarkAllNotifAsSeen (void)
|
void Ntf_MarkAllNotifAsSeen (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set all my notifications as seen *****/
|
/***** Set all my notifications as seen *****/
|
||||||
if (asprintf (&Query,"UPDATE notif SET Status=(Status | %u)"
|
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||||
" WHERE ToUsrCod=%ld",
|
" WHERE ToUsrCod=%ld",
|
||||||
(unsigned) Ntf_STATUS_BIT_READ,
|
(unsigned) Ntf_STATUS_BIT_READ,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as seen");
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as seen");
|
|
||||||
|
|
||||||
/***** Show my notifications again *****/
|
/***** Show my notifications again *****/
|
||||||
Ntf_ShowMyNotifications ();
|
Ntf_ShowMyNotifications ();
|
||||||
|
@ -2042,20 +1999,18 @@ static void Ntf_GetParamsNotifyEvents (void)
|
||||||
void Ntf_ChangeNotifyEvents (void)
|
void Ntf_ChangeNotifyEvents (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Your_preferences_about_notifications_have_changed;
|
extern const char *Txt_Your_preferences_about_notifications_have_changed;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with whether notify me about events *****/
|
/***** Get param with whether notify me about events *****/
|
||||||
Ntf_GetParamsNotifyEvents ();
|
Ntf_GetParamsNotifyEvents ();
|
||||||
|
|
||||||
/***** Store preferences about notify events *****/
|
/***** Store preferences about notify events *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data"
|
DB_BuildQuery ("UPDATE usr_data"
|
||||||
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
|
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
|
||||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
|
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's preferences");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's preferences");
|
|
||||||
|
|
||||||
/***** Show message *****/
|
/***** Show message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed);
|
||||||
|
|
|
@ -800,15 +800,12 @@ unsigned Pag_GetParamPagNum (Pag_WhatPaginate_t WhatPaginate)
|
||||||
|
|
||||||
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
|
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Save last page of received/sent messages *****/
|
/***** Save last page of received/sent messages *****/
|
||||||
if (asprintf (&Query,"UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
DB_BuildQuery ("UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
||||||
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
||||||
"LastPageMsgSnt",
|
"LastPageMsgSnt",
|
||||||
NumPage,Gbl.Session.Id) < 0)
|
NumPage,Gbl.Session.Id);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update last page of messages");
|
||||||
DB_QueryUPDATE_free (Query,"can not update last page of messages");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -145,15 +145,12 @@ bool Pwd_CheckPendingPassword (void)
|
||||||
|
|
||||||
void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
|
void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update my current password in database *****/
|
/***** Update my current password in database *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Password='%s'"
|
DB_BuildQuery ("UPDATE usr_data SET Password='%s'"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.PendingPassword,
|
Gbl.Usrs.Me.PendingPassword,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your password");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your password");
|
|
||||||
|
|
||||||
/***** Update my current password *****/
|
/***** Update my current password *****/
|
||||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Password,Gbl.Usrs.Me.PendingPassword,
|
Str_Copy (Gbl.Usrs.Me.UsrDat.Password,Gbl.Usrs.Me.PendingPassword,
|
||||||
|
|
35
swad_photo.c
35
swad_photo.c
|
@ -977,7 +977,6 @@ static void Pho_UpdatePhoto2 (void)
|
||||||
|
|
||||||
unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
|
@ -999,11 +998,10 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
||||||
/* Update number of clicks */
|
/* Update number of clicks */
|
||||||
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE clicks_without_photo"
|
DB_BuildQuery ("UPDATE clicks_without_photo"
|
||||||
" SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
" SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update number of clicks without photo");
|
||||||
DB_QueryUPDATE_free (Query,"can not update number of clicks without photo");
|
|
||||||
NumClicks++;
|
NumClicks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1190,14 +1188,9 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
|
||||||
|
|
||||||
static void Pho_ClearPhotoName (long UsrCod)
|
static void Pho_ClearPhotoName (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Clear photo name in user's data *****/
|
/***** Clear photo name in user's data *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Photo=''"
|
DB_BuildQuery ("UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",UsrCod);
|
||||||
" WHERE UsrCod=%ld",
|
DB_QueryUPDATE_new ("can not clear the name of a user's photo");
|
||||||
UsrCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not clear the name of a user's photo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1206,15 +1199,12 @@ static void Pho_ClearPhotoName (long UsrCod)
|
||||||
|
|
||||||
void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
char PathPublPhoto[PATH_MAX + 1];
|
char PathPublPhoto[PATH_MAX + 1];
|
||||||
|
|
||||||
/***** Update photo name in database *****/
|
/***** Update photo name in database *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Photo='%s'"
|
DB_BuildQuery ("UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
|
||||||
" WHERE UsrCod=%ld",
|
Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
|
||||||
Gbl.UniqueNameEncrypted,UsrDat->UsrCod) < 0)
|
DB_QueryUPDATE_new ("can not update the name of a user's photo");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a user's photo");
|
|
||||||
|
|
||||||
/***** Remove the old symbolic link to photo *****/
|
/***** Remove the old symbolic link to photo *****/
|
||||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
||||||
|
@ -1336,18 +1326,15 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
||||||
void Pho_ChangePhotoVisibility (void)
|
void Pho_ChangePhotoVisibility (void)
|
||||||
{
|
{
|
||||||
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
|
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with public/private photo *****/
|
/***** Get param with public/private photo *****/
|
||||||
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho");
|
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho");
|
||||||
|
|
||||||
/***** Store public/private photo in database *****/
|
/***** Store public/private photo in database *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET PhotoVisibility='%s'"
|
DB_BuildQuery ("UPDATE usr_data SET PhotoVisibility='%s' WHERE UsrCod=%ld",
|
||||||
" WHERE UsrCod=%ld",
|
|
||||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about photo visibility");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about photo visibility");
|
|
||||||
|
|
||||||
/***** Show form again *****/
|
/***** Show form again *****/
|
||||||
Pre_EditPrefs ();
|
Pre_EditPrefs ();
|
||||||
|
|
|
@ -718,13 +718,10 @@ static bool Plc_CheckIfPlaceNameExists (const char *FieldName,const char *Name,l
|
||||||
|
|
||||||
static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName)
|
static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update place changing old name by new name */
|
/***** Update place changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
DB_BuildQuery ("UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
||||||
FieldName,NewPlcName,PlcCod) < 0)
|
FieldName,NewPlcName,PlcCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a place");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a place");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -522,7 +522,6 @@ void Plg_RenamePlugin (void)
|
||||||
extern const char *Txt_The_plugin_X_already_exists;
|
extern const char *Txt_The_plugin_X_already_exists;
|
||||||
extern const char *Txt_The_plugin_X_has_been_renamed_as_Y;
|
extern const char *Txt_The_plugin_X_has_been_renamed_as_Y;
|
||||||
extern const char *Txt_The_name_of_the_plugin_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_plugin_X_has_not_changed;
|
||||||
char *Query;
|
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char NewPlgName[Plg_MAX_BYTES_PLUGIN_NAME + 1];
|
char NewPlgName[Plg_MAX_BYTES_PLUGIN_NAME + 1];
|
||||||
|
|
||||||
|
@ -563,10 +562,9 @@ void Plg_RenamePlugin (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/* Update the table changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
|
||||||
NewPlgName,Plg->PlgCod) < 0)
|
NewPlgName,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -612,7 +610,6 @@ void Plg_ChangePlgDescription (void)
|
||||||
extern const char *Txt_The_new_description_is_X;
|
extern const char *Txt_The_new_description_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_description_empty;
|
extern const char *Txt_You_can_not_leave_the_description_empty;
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char *Query;
|
|
||||||
char NewDescription[Plg_MAX_BYTES_PLUGIN_DESCRIPTION + 1];
|
char NewDescription[Plg_MAX_BYTES_PLUGIN_DESCRIPTION + 1];
|
||||||
|
|
||||||
Plg = &Gbl.Plugins.EditingPlg;
|
Plg = &Gbl.Plugins.EditingPlg;
|
||||||
|
@ -629,10 +626,9 @@ void Plg_ChangePlgDescription (void)
|
||||||
if (NewDescription[0])
|
if (NewDescription[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old description by new description */
|
/* Update the table changing old description by new description */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
|
||||||
NewDescription,Plg->PlgCod) < 0)
|
NewDescription,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the description of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the description of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -658,7 +654,6 @@ void Plg_ChangePlgLogo (void)
|
||||||
extern const char *Txt_The_new_logo_is_X;
|
extern const char *Txt_The_new_logo_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_logo_empty;
|
extern const char *Txt_You_can_not_leave_the_logo_empty;
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char *Query;
|
|
||||||
char NewLogo[Plg_MAX_BYTES_PLUGIN_LOGO + 1];
|
char NewLogo[Plg_MAX_BYTES_PLUGIN_LOGO + 1];
|
||||||
|
|
||||||
Plg = &Gbl.Plugins.EditingPlg;
|
Plg = &Gbl.Plugins.EditingPlg;
|
||||||
|
@ -675,10 +670,9 @@ void Plg_ChangePlgLogo (void)
|
||||||
if (NewLogo[0])
|
if (NewLogo[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old logo by new logo */
|
/* Update the table changing old logo by new logo */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
|
||||||
NewLogo,Plg->PlgCod) < 0)
|
NewLogo,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the logo of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the logo of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -704,7 +698,6 @@ void Plg_ChangePlgAppKey (void)
|
||||||
extern const char *Txt_The_new_logo_is_X; // TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
extern const char *Txt_The_new_logo_is_X; // TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
extern const char *Txt_You_can_not_leave_the_logo_empty;// TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
extern const char *Txt_You_can_not_leave_the_logo_empty;// TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char *Query;
|
|
||||||
char NewAppKey[Plg_MAX_BYTES_PLUGIN_APP_KEY + 1];
|
char NewAppKey[Plg_MAX_BYTES_PLUGIN_APP_KEY + 1];
|
||||||
|
|
||||||
Plg = &Gbl.Plugins.EditingPlg;
|
Plg = &Gbl.Plugins.EditingPlg;
|
||||||
|
@ -721,10 +714,9 @@ void Plg_ChangePlgAppKey (void)
|
||||||
if (NewAppKey[0])
|
if (NewAppKey[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old application key by new application key */
|
/* Update the table changing old application key by new application key */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
|
||||||
NewAppKey,Plg->PlgCod) < 0)
|
NewAppKey,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the application key of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the application key of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -750,7 +742,6 @@ void Plg_ChangePlgURL (void)
|
||||||
extern const char *Txt_The_new_URL_is_X;
|
extern const char *Txt_The_new_URL_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_URL_empty;
|
extern const char *Txt_You_can_not_leave_the_URL_empty;
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char *Query;
|
|
||||||
char NewURL[Cns_MAX_BYTES_WWW + 1];
|
char NewURL[Cns_MAX_BYTES_WWW + 1];
|
||||||
|
|
||||||
Plg = &Gbl.Plugins.EditingPlg;
|
Plg = &Gbl.Plugins.EditingPlg;
|
||||||
|
@ -767,10 +758,9 @@ void Plg_ChangePlgURL (void)
|
||||||
if (NewURL[0])
|
if (NewURL[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old WWW by new WWW */
|
/* Update the table changing old WWW by new WWW */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
|
||||||
NewURL,Plg->PlgCod) < 0)
|
NewURL,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the URL of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the URL of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -796,7 +786,6 @@ void Plg_ChangePlgIP (void)
|
||||||
extern const char *Txt_The_new_IP_address_is_X;
|
extern const char *Txt_The_new_IP_address_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_IP_address_empty;
|
extern const char *Txt_You_can_not_leave_the_IP_address_empty;
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char *Query;
|
|
||||||
char NewIP[Cns_MAX_BYTES_IP + 1];
|
char NewIP[Cns_MAX_BYTES_IP + 1];
|
||||||
|
|
||||||
Plg = &Gbl.Plugins.EditingPlg;
|
Plg = &Gbl.Plugins.EditingPlg;
|
||||||
|
@ -813,10 +802,9 @@ void Plg_ChangePlgIP (void)
|
||||||
if (NewIP[0])
|
if (NewIP[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old IP by new IP */
|
/* Update the table changing old IP by new IP */
|
||||||
if (asprintf (&Query,"UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
|
DB_BuildQuery ("UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
|
||||||
NewIP,Plg->PlgCod) < 0)
|
NewIP,Plg->PlgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the IP address of a plugin");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the IP address of a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -352,13 +352,10 @@ void Pre_ShowRightCol (void)
|
||||||
|
|
||||||
static void Pre_UpdateSideColsOnUsrDataTable (void)
|
static void Pre_UpdateSideColsOnUsrDataTable (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("UPDATE usr_data SET SideCols=%u"
|
||||||
|
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET SideCols=%u"
|
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about side columns");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about side columns");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -332,18 +332,16 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
||||||
void Prf_ChangeProfileVisibility (void)
|
void Prf_ChangeProfileVisibility (void)
|
||||||
{
|
{
|
||||||
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
|
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with public/private photo *****/
|
/***** Get param with public/private photo *****/
|
||||||
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf");
|
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf");
|
||||||
|
|
||||||
/***** Store public/private photo in database *****/
|
/***** Store public/private photo in database *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET ProfileVisibility='%s'"
|
DB_BuildQuery ("UPDATE usr_data SET ProfileVisibility='%s'"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
|
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about public profile visibility");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about public profile visibility");
|
|
||||||
|
|
||||||
/***** Show form again *****/
|
/***** Show form again *****/
|
||||||
Pre_EditPrefs ();
|
Pre_EditPrefs ();
|
||||||
|
@ -830,7 +828,6 @@ bool Prf_GetAndStoreAllUsrFigures (long UsrCod,struct UsrFigures *UsrFigures)
|
||||||
|
|
||||||
static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
|
@ -860,12 +857,11 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
||||||
/***** Update first click time in user's figures *****/
|
/***** Update first click time in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_figures"
|
DB_BuildQuery ("UPDATE usr_figures"
|
||||||
" SET FirstClickTime=FROM_UNIXTIME(%ld)"
|
" SET FirstClickTime=FROM_UNIXTIME(%ld)"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
(long) UsrFigures.FirstClickTimeUTC,UsrCod) < 0)
|
(long) UsrFigures.FirstClickTimeUTC,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's figures");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's figures");
|
|
||||||
}
|
}
|
||||||
else // User entry does not exist
|
else // User entry does not exist
|
||||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||||
|
@ -878,7 +874,6 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
||||||
|
|
||||||
static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
|
|
||||||
if (Usr_ChkIfUsrCodExists (UsrCod))
|
if (Usr_ChkIfUsrCodExists (UsrCod))
|
||||||
|
@ -893,11 +888,10 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
||||||
/***** Update number of clicks in user's figures *****/
|
/***** Update number of clicks in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_figures SET NumClicks=%ld"
|
DB_BuildQuery ("UPDATE usr_figures SET NumClicks=%ld"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrFigures.NumClicks,UsrCod) < 0)
|
UsrFigures.NumClicks,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's figures");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's figures");
|
|
||||||
}
|
}
|
||||||
else // User entry does not exist
|
else // User entry does not exist
|
||||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||||
|
@ -910,7 +904,6 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
||||||
|
|
||||||
static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
|
|
||||||
if (Usr_ChkIfUsrCodExists (UsrCod))
|
if (Usr_ChkIfUsrCodExists (UsrCod))
|
||||||
|
@ -924,11 +917,10 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
||||||
/***** Update number of file views in user's figures *****/
|
/***** Update number of file views in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_figures SET NumFileViews=%ld"
|
DB_BuildQuery ("UPDATE usr_figures SET NumFileViews=%ld"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrFigures.NumFileViews,UsrCod) < 0)
|
UsrFigures.NumFileViews,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's figures");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's figures");
|
|
||||||
}
|
}
|
||||||
else // User entry does not exist
|
else // User entry does not exist
|
||||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||||
|
@ -941,7 +933,6 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
||||||
|
|
||||||
static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
|
|
||||||
if (Usr_ChkIfUsrCodExists (UsrCod))
|
if (Usr_ChkIfUsrCodExists (UsrCod))
|
||||||
|
@ -955,11 +946,10 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
||||||
/***** Update number of forum posts in user's figures *****/
|
/***** Update number of forum posts in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_figures SET NumForPst=%ld"
|
DB_BuildQuery ("UPDATE usr_figures SET NumForPst=%ld"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrFigures.NumForPst,UsrCod) < 0)
|
UsrFigures.NumForPst,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's figures");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's figures");
|
|
||||||
}
|
}
|
||||||
else // User entry does not exist
|
else // User entry does not exist
|
||||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||||
|
@ -972,7 +962,6 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
||||||
|
|
||||||
static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
|
static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
|
|
||||||
if (Usr_ChkIfUsrCodExists (UsrCod))
|
if (Usr_ChkIfUsrCodExists (UsrCod))
|
||||||
|
@ -986,11 +975,10 @@ static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
|
||||||
/***** Update number of messages sent in user's figures *****/
|
/***** Update number of messages sent in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_figures SET NumMsgSnt=%ld"
|
DB_BuildQuery ("UPDATE usr_figures SET NumMsgSnt=%ld"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrFigures.NumMsgSnt,UsrCod) < 0)
|
UsrFigures.NumMsgSnt,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's figures");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's figures");
|
|
||||||
}
|
}
|
||||||
else // User entry does not exist
|
else // User entry does not exist
|
||||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||||
|
|
|
@ -2828,7 +2828,6 @@ void Prj_RemoveProject (void)
|
||||||
void Prj_HideProject (void)
|
void Prj_HideProject (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Project_X_is_now_hidden;
|
extern const char *Txt_Project_X_is_now_hidden;
|
||||||
char *Query;
|
|
||||||
struct Project Prj;
|
struct Project Prj;
|
||||||
|
|
||||||
/***** Allocate memory for the project *****/
|
/***** Allocate memory for the project *****/
|
||||||
|
@ -2845,11 +2844,10 @@ void Prj_HideProject (void)
|
||||||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||||
{
|
{
|
||||||
/***** Hide project *****/
|
/***** Hide project *****/
|
||||||
if (asprintf (&Query,"UPDATE projects SET Hidden='Y'"
|
DB_BuildQuery ("UPDATE projects SET Hidden='Y'"
|
||||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide project");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide project");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -2874,7 +2872,6 @@ void Prj_HideProject (void)
|
||||||
void Prj_ShowProject (void)
|
void Prj_ShowProject (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Project_X_is_now_visible;
|
extern const char *Txt_Project_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct Project Prj;
|
struct Project Prj;
|
||||||
|
|
||||||
/***** Allocate memory for the project *****/
|
/***** Allocate memory for the project *****/
|
||||||
|
@ -2891,11 +2888,10 @@ void Prj_ShowProject (void)
|
||||||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||||
{
|
{
|
||||||
/***** Show project *****/
|
/***** Show project *****/
|
||||||
if (asprintf (&Query,"UPDATE projects SET Hidden='N'"
|
DB_BuildQuery ("UPDATE projects SET Hidden='N'"
|
||||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not show project");
|
||||||
DB_QueryUPDATE_free (Query,"can not show project");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -3402,13 +3398,11 @@ static void Prj_CreateProject (struct Project *Prj)
|
||||||
|
|
||||||
static void Prj_UpdateProject (struct Project *Prj)
|
static void Prj_UpdateProject (struct Project *Prj)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Adjust date of last edition to now *****/
|
/***** Adjust date of last edition to now *****/
|
||||||
Prj->ModifTime = Gbl.StartExecutionTimeUTC;
|
Prj->ModifTime = Gbl.StartExecutionTimeUTC;
|
||||||
|
|
||||||
/***** Update the data of the project *****/
|
/***** Update the data of the project *****/
|
||||||
if (asprintf (&Query,"UPDATE projects SET "
|
DB_BuildQuery ("UPDATE projects SET "
|
||||||
"DptCod=%ld,Hidden='%c',Preassigned='%c',NumStds=%u,Proposal='%s',"
|
"DptCod=%ld,Hidden='%c',Preassigned='%c',NumStds=%u,Proposal='%s',"
|
||||||
"ModifTime=FROM_UNIXTIME(%ld),"
|
"ModifTime=FROM_UNIXTIME(%ld),"
|
||||||
"Title='%s',"
|
"Title='%s',"
|
||||||
|
@ -3427,9 +3421,8 @@ static void Prj_UpdateProject (struct Project *Prj)
|
||||||
Prj->Knowledge,
|
Prj->Knowledge,
|
||||||
Prj->Materials,
|
Prj->Materials,
|
||||||
Prj->URL,
|
Prj->URL,
|
||||||
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update project");
|
||||||
DB_QueryUPDATE_free (Query,"can not update project");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -790,7 +790,6 @@ void Rec_RenameField (void)
|
||||||
extern const char *Txt_The_record_field_X_already_exists;
|
extern const char *Txt_The_record_field_X_already_exists;
|
||||||
extern const char *Txt_The_record_field_X_has_been_renamed_as_Y;
|
extern const char *Txt_The_record_field_X_has_been_renamed_as_Y;
|
||||||
extern const char *Txt_The_name_of_the_field_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_field_X_has_not_changed;
|
||||||
char *Query;
|
|
||||||
char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1];
|
char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1];
|
||||||
|
|
||||||
/***** Get parameters of the form *****/
|
/***** Get parameters of the form *****/
|
||||||
|
@ -832,11 +831,10 @@ void Rec_RenameField (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table of fields changing then old name by the new one */
|
/* Update the table of fields changing then old name by the new one */
|
||||||
if (asprintf (&Query,"UPDATE crs_record_fields SET FieldName='%s'"
|
DB_BuildQuery ("UPDATE crs_record_fields SET FieldName='%s'"
|
||||||
" WHERE FieldCod=%ld",
|
" WHERE FieldCod=%ld",
|
||||||
NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod) < 0)
|
NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update name of field of record");
|
||||||
DB_QueryUPDATE_free (Query,"can not update name of field of record");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -868,7 +866,6 @@ void Rec_ChangeLinesField (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_number_of_editing_lines_in_the_record_field_X_has_not_changed;
|
extern const char *Txt_The_number_of_editing_lines_in_the_record_field_X_has_not_changed;
|
||||||
extern const char *Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y;
|
extern const char *Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y;
|
||||||
char *Query;
|
|
||||||
unsigned NewNumLines;
|
unsigned NewNumLines;
|
||||||
|
|
||||||
/***** Get parameters of the form *****/
|
/***** Get parameters of the form *****/
|
||||||
|
@ -898,11 +895,10 @@ void Rec_ChangeLinesField (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_record_fields SET NumLines=%u"
|
DB_BuildQuery ("UPDATE crs_record_fields SET NumLines=%u"
|
||||||
" WHERE FieldCod=%ld",
|
" WHERE FieldCod=%ld",
|
||||||
NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod) < 0)
|
NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the number of lines of a field of record");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the number of lines of a field of record");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -924,7 +920,6 @@ void Rec_ChangeVisibilityField (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_visibility_of_the_record_field_X_has_not_changed;
|
extern const char *Txt_The_visibility_of_the_record_field_X_has_not_changed;
|
||||||
extern const char *Txt_RECORD_FIELD_VISIBILITY_MSG[Rec_NUM_TYPES_VISIBILITY];
|
extern const char *Txt_RECORD_FIELD_VISIBILITY_MSG[Rec_NUM_TYPES_VISIBILITY];
|
||||||
char *Query;
|
|
||||||
Rec_VisibilityRecordFields_t NewVisibility;
|
Rec_VisibilityRecordFields_t NewVisibility;
|
||||||
|
|
||||||
/***** Get parameters of the form *****/
|
/***** Get parameters of the form *****/
|
||||||
|
@ -954,11 +949,10 @@ void Rec_ChangeVisibilityField (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Update of the table of fields changing the old visibility by the new *****/
|
/***** Update of the table of fields changing the old visibility by the new *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_record_fields SET Visibility=%u"
|
DB_BuildQuery ("UPDATE crs_record_fields SET Visibility=%u"
|
||||||
" WHERE FieldCod=%ld",
|
" WHERE FieldCod=%ld",
|
||||||
(unsigned) NewVisibility,Gbl.CurrentCrs.Records.Field.FieldCod) < 0)
|
(unsigned) NewVisibility,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the visibility of a field of record");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the visibility of a field of record");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1985,7 +1979,6 @@ void Rec_GetFieldsCrsRecordFromForm (void)
|
||||||
void Rec_UpdateCrsRecord (long UsrCod)
|
void Rec_UpdateCrsRecord (long UsrCod)
|
||||||
{
|
{
|
||||||
unsigned NumField;
|
unsigned NumField;
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
bool FieldAlreadyExists;
|
bool FieldAlreadyExists;
|
||||||
|
|
||||||
|
@ -2002,21 +1995,20 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
||||||
{
|
{
|
||||||
/***** Update text of the field of record course *****/
|
/***** Update text of the field of record course *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_records SET Txt='%s'"
|
DB_BuildQuery ("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,
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text,
|
||||||
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod) < 0)
|
UsrCod,
|
||||||
Lay_NotEnoughMemoryExit ();
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||||
DB_QueryUPDATE_free (Query,"can not update field of record");
|
DB_QueryUPDATE_new ("can not update field of record");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Remove text of the field of record course *****/
|
/***** Remove text of the field of record course *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_records"
|
DB_BuildQuery ("DELETE FROM crs_records"
|
||||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||||
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod) < 0)
|
UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove field of record");
|
||||||
DB_QueryDELETE_free (Query,"can not remove field of record");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
||||||
|
@ -4406,17 +4398,14 @@ void Rec_UpdateMyDepartment (void)
|
||||||
|
|
||||||
void Rec_UpdateMyOffice (void)
|
void Rec_UpdateMyOffice (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get my office *****/
|
/***** Get my office *****/
|
||||||
Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
|
Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
|
||||||
|
|
||||||
/***** Update office *****/
|
/***** Update office *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
DB_BuildQuery ("UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update office");
|
||||||
DB_QueryUPDATE_free (Query,"can not update office");
|
|
||||||
|
|
||||||
/***** Show form again *****/
|
/***** Show form again *****/
|
||||||
Rec_ShowMySharedRecordAndMore ();
|
Rec_ShowMySharedRecordAndMore ();
|
||||||
|
@ -4428,17 +4417,14 @@ void Rec_UpdateMyOffice (void)
|
||||||
|
|
||||||
void Rec_UpdateMyOfficePhone (void)
|
void Rec_UpdateMyOfficePhone (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get my office *****/
|
/***** Get my office *****/
|
||||||
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
|
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
|
||||||
|
|
||||||
/***** Update office phone *****/
|
/***** Update office phone *****/
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
DB_BuildQuery ("UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update office phone");
|
||||||
DB_QueryUPDATE_free (Query,"can not update office phone");
|
|
||||||
|
|
||||||
/***** Show form again *****/
|
/***** Show form again *****/
|
||||||
Rec_ShowMySharedRecordAndMore ();
|
Rec_ShowMySharedRecordAndMore ();
|
||||||
|
|
|
@ -280,7 +280,6 @@ void The_ChangeTheme (void)
|
||||||
char Path[PATH_MAX + 1 +
|
char Path[PATH_MAX + 1 +
|
||||||
NAME_MAX + 1 +
|
NAME_MAX + 1 +
|
||||||
NAME_MAX + 1];
|
NAME_MAX + 1];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param theme *****/
|
/***** Get param theme *****/
|
||||||
Gbl.Prefs.Theme = The_GetParamTheme ();
|
Gbl.Prefs.Theme = The_GetParamTheme ();
|
||||||
|
@ -295,11 +294,10 @@ void The_ChangeTheme (void)
|
||||||
/***** Store theme in database *****/
|
/***** Store theme in database *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET Theme='%s'"
|
DB_BuildQuery ("UPDATE usr_data SET Theme='%s'"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
The_ThemeId[Gbl.Prefs.Theme],Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
The_ThemeId[Gbl.Prefs.Theme],Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about theme");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about theme");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set preferences from current IP *****/
|
/***** Set preferences from current IP *****/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user