Version 15.111

This commit is contained in:
Antonio Cañas Vargas 2016-01-14 01:39:02 +01:00
parent 7859e172e3
commit f1fdffd9cd
15 changed files with 252 additions and 181 deletions

View File

@ -377,9 +377,9 @@ var objXMLHttpReqLog = false;
function refreshLastClicks() { function refreshLastClicks() {
objXMLHttpReqLog = AJAXCreateObject(); objXMLHttpReqLog = AJAXCreateObject();
if (objXMLHttpReqLog) { if (objXMLHttpReqLog) {
var RefreshParams = RefreshParamNxtActLog + '&' + var RefreshParams = RefreshParamNxtActLog + '&' +
RefreshParamIdSes + '&' + RefreshParamIdSes + '&' +
RefreshParamCrsCod; RefreshParamCrsCod;
objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase
objXMLHttpReqLog.open('POST',ActionAJAX,true); objXMLHttpReqLog.open('POST',ActionAJAX,true);
@ -393,13 +393,13 @@ var objXMLHttpReqSoc = false;
function refreshNewTimeline() { function refreshNewTimeline() {
objXMLHttpReqSoc = AJAXCreateObject(); objXMLHttpReqSoc = AJAXCreateObject();
if (objXMLHttpReqSoc) { if (objXMLHttpReqSoc) {
var RefreshParams = RefreshParamNxtActNewPub + '&' + var RefreshParams = RefreshParamNxtActNewPub + '&' +
RefreshParamIdSes; RefreshParamIdSes;
objXMLHttpReqSoc.onreadystatechange = readNewTimelineData; // onreadystatechange must be lowercase objXMLHttpReqSoc.onreadystatechange = readNewTimelineData; // onreadystatechange must be lowercase
objXMLHttpReqSoc.open('POST',ActionAJAX,true); objXMLHttpReqSoc.open('POST',ActionAJAX,true);
objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
objXMLHttpReqSoc.send(RefreshParams); objXMLHttpReqSoc.send(RefreshParams);
} }
} }
@ -408,13 +408,15 @@ var objXMLHttpReqSoc = false;
function refreshOldTimeline() { function refreshOldTimeline() {
objXMLHttpReqSoc = AJAXCreateObject(); objXMLHttpReqSoc = AJAXCreateObject();
if (objXMLHttpReqSoc) { if (objXMLHttpReqSoc) {
var RefreshParams = RefreshParamNxtActOldPub + '&' + var RefreshParams = RefreshParamNxtActOldPub + '&' + RefreshParamIdSes;
RefreshParamIdSes; if (RefreshParamUsr)
if (RefreshParamUsr.length)
RefreshParams += '&' + RefreshParamUsr;
objXMLHttpReqSoc.onreadystatechange = readOldTimelineData; // onreadystatechange must be lowercase objXMLHttpReqSoc.onreadystatechange = readOldTimelineData; // onreadystatechange must be lowercase
objXMLHttpReqSoc.open('POST',ActionAJAX,true); objXMLHttpReqSoc.open('POST',ActionAJAX,true);
objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
objXMLHttpReqSoc.send(RefreshParams); objXMLHttpReqSoc.send(RefreshParams);
} }
} }

View File

@ -83,8 +83,9 @@ extern struct Globals Gbl;
3. ActMnu Show menu of a tab 3. ActMnu Show menu of a tab
4. ActRefCon Refresh number of notifications and connected users via AJAX 4. ActRefCon Refresh number of notifications and connected users via AJAX
5. ActRefLstClk Refresh last clicks in log via AJAX 5. ActRefLstClk Refresh last clicks in log via AJAX
New!!!!!!!!. ActRefNewSocPub Refresh recent social timeline via AJAX New!!!!!!!!. ActRefNewSocPubGbl Refresh recent social timeline via AJAX
New!!!!!!!!. ActRefNewSocPub View old social timeline via AJAX New!!!!!!!!. ActRefOldSocPubUsr View old social timeline of a user via AJAX
New!!!!!!!!. ActRefOldSocPubGbl View old social timeline with users I follow via AJAX
6. ActWebSvc Call plugin function 6. ActWebSvc Call plugin function
System: System:
7. ActSysReqSch Request search in system tab 7. ActSysReqSch Request search in system tab
@ -1340,8 +1341,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,NULL ,NULL}, /* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,NULL ,NULL},
/* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshNotifsAndConnected ,NULL}, /* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshNotifsAndConnected ,NULL},
/* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshLastClicks ,NULL}, /* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshLastClicks ,NULL},
/* ActRefNewSocPub */{1509,-1,TabUnk,ActRefNewSocPub ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshNewTimeline ,NULL}, /* ActRefNewSocPubGbl*/{1509,-1,TabUnk,ActRefNewSocPubGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RefreshNewTimelineGbl ,NULL},
/* ActRefOldSocPub */{1510,-1,TabUnk,ActRefNewSocPub ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshOldTimeline ,NULL}, /* ActRefOldSocPubUsr*/{1511,-1,TabUnk,ActRefOldSocPubUsr ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RefreshOldTimelineUsr ,NULL},
/* ActRefOldSocPubGbl*/{1510,-1,TabUnk,ActRefOldSocPubGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RefreshOldTimelineGbl ,NULL},
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Plg_WebService ,NULL}, /* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Plg_WebService ,NULL},
// TabSys ****************************************************************** // TabSys ******************************************************************
@ -2349,7 +2351,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqRemSocComGbl*/{1506,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialComUsr ,NULL}, /* ActReqRemSocComGbl*/{1506,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialComUsr ,NULL},
/* ActRemSocComGbl */{1508,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialComUsr ,NULL}, /* ActRemSocComGbl */{1508,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialComUsr ,NULL},
/* ActSeePubPrf */{1402,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_GetUsrCodAndShowUserProfile,NULL}, /* ActSeePubPrf */{1402,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL},
/* ActCal1stClkTim */{1405,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFirstClickTime ,NULL}, /* ActCal1stClkTim */{1405,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFirstClickTime ,NULL},
/* ActCalNumClk */{1406,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumClicks ,NULL}, /* ActCalNumClk */{1406,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumClicks ,NULL},
/* ActCalNumFilVie */{1409,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumFileViews ,NULL}, /* ActCalNumFilVie */{1409,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumFileViews ,NULL},
@ -4204,8 +4206,9 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActReqRemSocComUsr, // #1506 ActReqRemSocComUsr, // #1506
ActRemSocComGbl, // #1507 ActRemSocComGbl, // #1507
ActRemSocComUsr, // #1508 ActRemSocComUsr, // #1508
ActRefNewSocPub, // #1509 ActRefNewSocPubGbl, // #1509
ActRefOldSocPub, // #1510 ActRefOldSocPubGbl, // #1510
ActRefOldSocPubUsr, // #1511
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -4504,10 +4507,11 @@ void Act_AdjustCurrentAction (void)
return; return;
/***** Don't adjust anything when refreshing users or on a web service *****/ /***** Don't adjust anything when refreshing users or on a web service *****/
if (Gbl.CurrentAct == ActRefCon || if (Gbl.CurrentAct == ActRefCon ||
Gbl.CurrentAct == ActRefLstClk || Gbl.CurrentAct == ActRefLstClk ||
Gbl.CurrentAct == ActRefNewSocPub || Gbl.CurrentAct == ActRefNewSocPubGbl ||
Gbl.CurrentAct == ActRefOldSocPub || Gbl.CurrentAct == ActRefOldSocPubUsr ||
Gbl.CurrentAct == ActRefOldSocPubGbl ||
Gbl.WebService.IsWebService) Gbl.WebService.IsWebService)
return; return;

View File

@ -71,24 +71,26 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (9+52+15+90+72+67+205+183+143+163+36+27+82) #define Act_NUM_ACTIONS (1+9+52+15+90+72+67+205+183+143+163+36+27+82)
#define Act_MAX_ACTION_COD 1510 #define Act_MAX_ACTION_COD 1511
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
/*****************************************************************************/ /*****************************************************************************/
/************************* Not asociates with tabs ***************************/ /************************* Not asociates with tabs ***************************/
/*****************************************************************************/ /*****************************************************************************/
#define ActAll 0 #define ActAll 0
#define ActUnk 1
#define ActHom 2 #define ActUnk 1
#define ActMnu 3 #define ActHom 2
#define ActRefCon 4 #define ActMnu 3
#define ActRefLstClk 5 #define ActRefCon 4
#define ActRefNewSocPub 6 #define ActRefLstClk 5
#define ActRefOldSocPub 7 #define ActRefNewSocPubGbl 6
#define ActWebSvc 8 #define ActRefOldSocPubUsr 7
#define ActRefOldSocPubGbl 8
#define ActWebSvc 9
/*****************************************************************************/ /*****************************************************************************/
/******************************** System tab *********************************/ /******************************** System tab *********************************/

View File

@ -126,14 +126,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.110.18 (2016-01-13)" #define Log_PLATFORM_VERSION "SWAD 15.111 (2016-01-14)"
#define CSS_FILE "swad15.110.13.css" #define CSS_FILE "swad15.111.css"
#define JS_FILE "swad15.110.13.js" #define JS_FILE "swad15.111.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.110.19:Jan 13, 2016 Fixed bug in user's timeline. (? lines) Version 15.111: Jan 14, 2016 Fixed bug in user's timeline.
Code refactoring related with social timeline. (192622 lines)
Version 15.110.18:Jan 13, 2016 Optimization in query to get initial recent timeline. (192564 lines) Version 15.110.18:Jan 13, 2016 Optimization in query to get initial recent timeline. (192564 lines)
Version 15.110.17:Jan 13, 2016 Reviewed code related to Soc_MAX_RECENT_PUBS_TO_GET. (192568 lines) Version 15.110.17:Jan 13, 2016 Reviewed code related to Soc_MAX_RECENT_PUBS_TO_GET. (192568 lines)
Version 15.110.16:Jan 13, 2016 Form to go to public profile of author of comment in timeline. (192563 lines) Version 15.110.16:Jan 13, 2016 Form to go to public profile of author of comment in timeline. (192563 lines)

View File

@ -438,10 +438,11 @@ void Gbl_InitializeGlobals (void)
void Gbl_Cleanup (void) void Gbl_Cleanup (void)
{ {
if (Gbl.CurrentAct != ActRefCon && if (Gbl.CurrentAct != ActRefCon &&
Gbl.CurrentAct != ActRefLstClk && Gbl.CurrentAct != ActRefLstClk &&
Gbl.CurrentAct != ActRefNewSocPub && Gbl.CurrentAct != ActRefNewSocPubGbl &&
Gbl.CurrentAct != ActRefOldSocPub && Gbl.CurrentAct != ActRefOldSocPubUsr &&
Gbl.CurrentAct != ActRefOldSocPubGbl &&
!Gbl.WebService.IsWebService && !Gbl.WebService.IsWebService &&
Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW && Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW &&
!Gbl.HiddenParamsInsertedIntoDB) !Gbl.HiddenParamsInsertedIntoDB)

View File

@ -123,10 +123,11 @@ void Lay_WriteStartOfPage (void)
Con_ComputeConnectedUsrsBelongingToCurrentCrs (); Con_ComputeConnectedUsrsBelongingToCurrentCrs ();
/***** Send head width the file type for the HTTP protocol *****/ /***** Send head width the file type for the HTTP protocol *****/
if (Gbl.CurrentAct == ActRefCon || if (Gbl.CurrentAct == ActRefCon ||
Gbl.CurrentAct == ActRefLstClk || Gbl.CurrentAct == ActRefLstClk ||
Gbl.CurrentAct == ActRefNewSocPub || Gbl.CurrentAct == ActRefNewSocPubGbl ||
Gbl.CurrentAct == ActRefOldSocPub) Gbl.CurrentAct == ActRefOldSocPubUsr ||
Gbl.CurrentAct == ActRefOldSocPubGbl)
// Don't generate a full HTML page, only the content of a DIV or similar // Don't generate a full HTML page, only the content of a DIV or similar
{ {
fprintf (Gbl.F.Out,"Content-Type: text/html; charset=windows-1252\r\n\r\n"); fprintf (Gbl.F.Out,"Content-Type: text/html; charset=windows-1252\r\n\r\n");
@ -624,18 +625,41 @@ static void Lay_WriteScriptInit (void)
static void Lay_WriteScriptParamsAJAX (void) static void Lay_WriteScriptParamsAJAX (void)
{ {
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n" /***** Start script *****/
"var RefreshParamNxtActCon = \"act=%ld\";\n" fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n");
"var RefreshParamNxtActLog = \"act=%ld\";\n"
"var RefreshParamNxtActNewPub = \"act=%ld\";\n" /***** Parameter to refresh connected users *****/
"var RefreshParamNxtActOldPub = \"act=%ld\";\n" fprintf (Gbl.F.Out,"var RefreshParamNxtActCon = \"act=%ld\";\n",
"var RefreshParamIdSes = \"ses=%s\";\n" Act_Actions[ActRefCon ].ActCod);
/***** Parameter to refresh clicks in realtime *****/
fprintf (Gbl.F.Out,"var RefreshParamNxtActLog = \"act=%ld\";\n",
Act_Actions[ActRefLstClk].ActCod);
/***** Parameters related with refreshing of social timeline *****/
if (Gbl.CurrentAct == ActSeePubPrf) // TODO: Add other actions where social timeline is shown
{
if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0)
Usr_GetParamOtherUsrCodEncrypted ();
if (!Gbl.Usrs.Other.UsrDat.Nickname[0])
Nck_GetNicknameFromUsrCod (Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Usrs.Other.UsrDat.Nickname);
fprintf (Gbl.F.Out,"var RefreshParamNxtActOldPub = \"act=%ld\";\n"
"var RefreshParamUsr = \"usr=@%s\";\n",
Act_Actions[ActRefOldSocPubUsr].ActCod,
Gbl.Usrs.Other.UsrDat.Nickname);
}
else if (Gbl.CurrentAct == ActSeeSocTmlGbl) // TODO: Add other actions where social timeline is shown
fprintf (Gbl.F.Out,"var RefreshParamNxtActNewPub = \"act=%ld\";\n"
"var RefreshParamNxtActOldPub = \"act=%ld\";\n"
"var RefreshParamUsr = \"\";\n", // No user specified
Act_Actions[ActRefNewSocPubGbl].ActCod,
Act_Actions[ActRefOldSocPubGbl].ActCod);
/***** Parameters with code of session and current course code *****/
fprintf (Gbl.F.Out,"var RefreshParamIdSes = \"ses=%s\";\n"
"var RefreshParamCrsCod = \"crs=%ld\";\n" "var RefreshParamCrsCod = \"crs=%ld\";\n"
"</script>\n", "</script>\n",
Act_Actions[ActRefCon ].ActCod,
Act_Actions[ActRefLstClk ].ActCod,
Act_Actions[ActRefNewSocPub].ActCod,
Act_Actions[ActRefOldSocPub].ActCod,
Gbl.Session.Id, Gbl.Session.Id,
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
} }
@ -1298,10 +1322,11 @@ void Lay_ShowErrorAndExit (const char *Message)
/***** Page is generated (except </body> and </html>). /***** Page is generated (except </body> and </html>).
Compute time to generate page *****/ Compute time to generate page *****/
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
Gbl.CurrentAct != ActRefLstClk && // Refreshing last clics Gbl.CurrentAct != ActRefLstClk && // Refreshing last clics
Gbl.CurrentAct != ActRefNewSocPub && // Refreshing new social publishings in timeline Gbl.CurrentAct != ActRefNewSocPubGbl && // Refreshing new social publishings in timeline
Gbl.CurrentAct != ActRefOldSocPub) // Refreshing old social publishings in timeline Gbl.CurrentAct != ActRefOldSocPubUsr && // Refreshing old social publishings in timeline
Gbl.CurrentAct != ActRefOldSocPubGbl) // Refreshing old social publishings in timeline
Sta_ComputeTimeToGeneratePage (); Sta_ComputeTimeToGeneratePage ();
if (Gbl.WebService.IsWebService) // Serving a plugin request if (Gbl.WebService.IsWebService) // Serving a plugin request
@ -1319,10 +1344,11 @@ void Lay_ShowErrorAndExit (const char *Message)
Fil_FastCopyOfOpenFiles (Gbl.F.Out,stdout); Fil_FastCopyOfOpenFiles (Gbl.F.Out,stdout);
Fil_CloseAndRemoveFileForHTMLOutput (); Fil_CloseAndRemoveFileForHTMLOutput ();
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
Gbl.CurrentAct != ActRefLstClk && // Refreshing last clicks Gbl.CurrentAct != ActRefLstClk && // Refreshing last clicks
Gbl.CurrentAct != ActRefNewSocPub && // Refreshing new social publishings in timeline Gbl.CurrentAct != ActRefNewSocPubGbl && // Refreshing new social publishings in timeline
Gbl.CurrentAct != ActRefOldSocPub) // Refreshing old social publishings in timeline Gbl.CurrentAct != ActRefOldSocPubUsr && // Refreshing old social publishings in timeline
Gbl.CurrentAct != ActRefOldSocPubGbl) // Refreshing old social publishings in timeline
{ {
/***** Compute time to send page *****/ /***** Compute time to send page *****/
Sta_ComputeTimeToSendPage (); Sta_ComputeTimeToSendPage ();
@ -1496,33 +1522,6 @@ void Lay_RefreshLastClicks (void)
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true; Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
} }
/*****************************************************************************/
/********** Refresh new publishings in social timeline via AJAX **************/
/*****************************************************************************/
void Lay_RefreshNewTimeline (void)
{
// Send, before the HTML, the refresh time and the last publishing got from database
fprintf (Gbl.F.Out,"%lu|",
Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE);
Soc_GetAndShowNewTimelineGbl ();
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
}
/*****************************************************************************/
/************ View new publishings in social timeline via AJAX ***************/
/*****************************************************************************/
void Lay_RefreshOldTimeline (void)
{
Soc_GetAndShowOldTimelineGbl ();
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
}
/*****************************************************************************/ /*****************************************************************************/
/************************ Write the end of the page **************************/ /************************ Write the end of the page **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -111,8 +111,6 @@ void Lay_ShowAlert (Lay_AlertType_t MsgType,const char *Message);
void Lay_RefreshNotifsAndConnected (void); void Lay_RefreshNotifsAndConnected (void);
void Lay_RefreshLastClicks (void); void Lay_RefreshLastClicks (void);
void Lay_RefreshNewTimeline (void);
void Lay_RefreshOldTimeline (void);
void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingClassPhoto, void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingClassPhoto,
long InsCod,long DegCod,long CrsCod); long InsCod,long DegCod,long CrsCod);

View File

@ -116,11 +116,6 @@ int main (int argc, char *argv[])
if (!Gbl.WebService.IsWebService) if (!Gbl.WebService.IsWebService)
{ {
/***** Check if clicks are made from the same IP too quickly *****/
// Disable this call. Don't check if too fast...
// ...because uploading files using Dropzone.js will trigger error
// Sta_ExitIfTooFast ();
/***** Create file for HTML output *****/ /***** Create file for HTML output *****/
Fil_CreateFileForHTMLOutput (); Fil_CreateFileForHTMLOutput ();

View File

@ -123,7 +123,7 @@ void Par_GetMainParameters (void)
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS]; extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
char UnsignedStr[10+1]; char UnsignedStr[10+1];
unsigned UnsignedNum; unsigned UnsignedNum;
char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA + 1]; char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
long OtherUsrCod; long OtherUsrCod;
char LongStr[1+10+1]; char LongStr[1+10+1];
char YearStr[2+1]; char YearStr[2+1];
@ -158,7 +158,22 @@ void Par_GetMainParameters (void)
} }
// SWAD is not called from external site // SWAD is not called from external site
/***** Set dfault action *****/
Gbl.CurrentAct = ActUnk; Gbl.CurrentAct = ActUnk;
/***** Get another user's nickname, if exists
(this nickname is used to get another user's info,
not to get the logged user) *****/
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA))
if (Nickname[0])
if ((OtherUsrCod = Nck_GetUsrCodFromNickname (Nickname)) > 0)
{
Gbl.Usrs.Other.UsrDat.UsrCod = OtherUsrCod; // Used to go to public profile
// and to refresh old publishings in user's timeline
Gbl.CurrentAct = ActSeePubPrf; // Set default action if no other is specified
}
/***** Get action to perform *****/
Par_GetParToText ("act",UnsignedStr,10); Par_GetParToText ("act",UnsignedStr,10);
if (UnsignedStr[0]) if (UnsignedStr[0])
{ {
@ -313,16 +328,6 @@ void Par_GetMainParameters (void)
Gbl.CurrentCrs.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr); // Overwrite CrsCod from session Gbl.CurrentCrs.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr); // Overwrite CrsCod from session
} }
/***** Get user's nickname, if exists
(this nickname is used to go to a user's profile, not to get the logged user) *****/
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA))
if (Nickname[0])
if ((OtherUsrCod = Nck_GetUsrCodFromNickname (Nickname)) > 0)
{
Gbl.Usrs.Other.UsrDat.UsrCod = OtherUsrCod;
Gbl.CurrentAct = ActSeePubPrf;
}
/***** Get tab to activate *****/ /***** Get tab to activate *****/
Gbl.CurrentTab = TabUnk; Gbl.CurrentTab = TabUnk;
if (Gbl.CurrentAct == ActMnu) if (Gbl.CurrentAct == ActMnu)

View File

@ -80,7 +80,6 @@ extern struct Globals Gbl;
static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickname); static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickname);
static void Prf_GetUsrDatAndShowUserProfile (void);
static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat); static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat);
static void Prf_PutLinkToUpdateAction (Act_Action_t Action,const char *EncryptedUsrCod); static void Prf_PutLinkToUpdateAction (Act_Action_t Action,const char *EncryptedUsrCod);
@ -168,55 +167,42 @@ static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickna
} }
/*****************************************************************************/ /*****************************************************************************/
/**************** Get user's code and show a user's profile ******************/ /******************** Get user and show a user's profile *********************/
/*****************************************************************************/ /*****************************************************************************/
// Gbl.Usrs.Other.UsrDat.UsrCod may be already taken. If not ==> try to get it
void Prf_GetUsrCodAndShowUserProfile (void) void Prf_GetUsrDatAndShowUserProfile (void)
{
/***** Try to get user *****/
// User's code may be already taken from nickname in Par_GetMainParameters ()
if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0)
// If user is not set, try to get it from user code
Usr_GetParamOtherUsrCodEncrypted ();
/***** Show user's profile *****/
Prf_GetUsrDatAndShowUserProfile ();
}
/*****************************************************************************/
/*************************** Show a user's profile ***************************/
/*****************************************************************************/
// If error, Nickname is used to fill the form to request another nickname
static void Prf_GetUsrDatAndShowUserProfile (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool Error; bool Error;
/***** Check if user exists and get his data *****/ /***** Get user's data *****/
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0)
/***** Show public profile *****/ Usr_GetParamOtherUsrCodEncrypted ();
Error = !Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat);
/***** Show profile and timeline *****/
if (!Error)
/* Show profile */
Error = !Prf_ShowUserProfile (); Error = !Prf_ShowUserProfile ();
else
Error = true;
if (Error) if (Error)
{ {
/***** Show error message *****/ /* Show error message */
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
/***** Request nickname again *****/ /* Request nickname again */
Prf_RequestUserProfileWithDefaultNickname (""); Prf_RequestUserProfileWithDefaultNickname ("");
} }
else if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users else if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users
{ {
/***** Start section *****/ /* Start section */
fprintf (Gbl.F.Out,"<section id=\"timeline\">"); fprintf (Gbl.F.Out,"<section id=\"timeline\">");
/***** Show social activity (timeline) of this user *****/ /* Show public social activity (timeline) of this user */
Soc_ShowTimelineUsr (); Soc_ShowTimelineUsr ();
/***** End section *****/ /* End section */
fprintf (Gbl.F.Out,"</section>"); fprintf (Gbl.F.Out,"</section>");
} }
} }

View File

@ -41,7 +41,8 @@
char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba); char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba);
void Prf_RequestUserProfile (void); void Prf_RequestUserProfile (void);
void Prf_GetUsrCodAndShowUserProfile (void); void Prf_GetUsrDatAndShowUserProfile (void);
bool Prf_ShowUserProfile (void); bool Prf_ShowUserProfile (void);
void Prf_ChangeProfileVisibility (void); void Prf_ChangeProfileVisibility (void);
void Prf_CalculateFirstClickTime (void); void Prf_CalculateFirstClickTime (void);

View File

@ -54,17 +54,23 @@
#define Soc_MAX_BYTES_SUMMARY 100 #define Soc_MAX_BYTES_SUMMARY 100
// Number of recent publishings got and shown the first time, before refreshing // Number of recent publishings got and shown the first time, before refreshing
#define Soc_MAX_RECENT_PUBS_TO_SHOW 20 // Publishings to show #define Soc_MAX_RECENT_PUBS_TO_SHOW 10 // Publishings to show
/* Try to get one more publishing that the number of publishings to show /* Try to get one more publishing that the number of publishings to show
For example, if the number of publishings to show is 10, try to get 11 For example, if the number of publishings to show is 10, try to get 11
If the number of publishings shown is lesser than the number of publishing got ==> show link to get old publishings */ If the number of publishings shown is lesser than the number of publishing got ==> show link to get old publishings */
#define Soc_MAX_RECENT_PUBS_TO_GET (Soc_MAX_RECENT_PUBS_TO_SHOW+1) // Publishings to get #define Soc_MAX_RECENT_PUBS_TO_GET (Soc_MAX_RECENT_PUBS_TO_SHOW+1) // Publishings to get
// Number of old publishings got and shown when I want to see old publishings // Number of old publishings got and shown when I want to see old publishings
#define Soc_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // If you change this number, set also this constant to the new value in JavaScript #define Soc_MAX_OLD_PUBS_TO_GET_AND_SHOW 10 // If you change this number, set also this constant to the new value in JavaScript
#define Soc_MAX_LENGTH_ID (256+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1) #define Soc_MAX_LENGTH_ID (256+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1)
typedef enum
{
Soc_TIMELINE_USR, // Show the timeline of a user
Soc_TIMELINE_GBL, // Show the timeline of the users follwed by me
} Soc_TimelineUsrOrGbl_t;
typedef enum typedef enum
{ {
Soc_GET_RECENT_TIMELINE, // Recent timeline is shown when user clicks on action menu,... Soc_GET_RECENT_TIMELINE, // Recent timeline is shown when user clicks on action menu,...
@ -199,8 +205,12 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline, static void Soc_GetAndShowNewTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl);
char *Query); static void Soc_GetAndShowOldTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl);
static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl,
Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline,
char *Query);
static long Soc_GetPubCodFromSession (const char *FieldName); static long Soc_GetPubCodFromSession (const char *FieldName);
static void Soc_UpdateLastPubCodIntoSession (void); static void Soc_UpdateLastPubCodIntoSession (void);
static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod); static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod);
@ -298,16 +308,16 @@ void Soc_ShowTimelineUsr (void)
char Query[512]; char Query[512];
/***** Build query to show timeline with publishings of a unique user *****/ /***** Build query to show timeline with publishings of a unique user *****/
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)" Soc_BuildQueryToGetTimeline (Soc_TIMELINE_USR,
" FROM social_pubs" Soc_GET_RECENT_TIMELINE,
" WHERE PublisherCod='%ld'" Query);
" ORDER BY PubCod DESC LIMIT %u",
Gbl.Usrs.Other.UsrDat.UsrCod,
Soc_MAX_RECENT_PUBS_TO_GET);
/***** Show timeline *****/ /***** Show timeline *****/
sprintf (Gbl.Title,Txt_Public_activity_OF_A_USER,Gbl.Usrs.Other.UsrDat.FirstName); sprintf (Gbl.Title,Txt_Public_activity_OF_A_USER,Gbl.Usrs.Other.UsrDat.FirstName);
Soc_ShowTimeline (Query,Gbl.Title); Soc_ShowTimeline (Query,Gbl.Title);
/***** Drop temporary tables *****/
Soc_DropTemporaryTablesUsedToQueryTimeline ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -325,7 +335,9 @@ void Soc_ShowTimelineGbl (void)
Lay_ShowAlert (Lay_INFO,Txt_You_dont_follow_any_user); Lay_ShowAlert (Lay_INFO,Txt_You_dont_follow_any_user);
/***** Build query to get timeline *****/ /***** Build query to get timeline *****/
Soc_BuildQueryToGetTimelineGbl (Soc_GET_RECENT_TIMELINE,Query); Soc_BuildQueryToGetTimeline (Soc_TIMELINE_GBL,
Soc_GET_RECENT_TIMELINE,
Query);
/***** Show timeline *****/ /***** Show timeline *****/
Soc_ShowTimeline (Query,Txt_Public_activity); Soc_ShowTimeline (Query,Txt_Public_activity);
@ -335,39 +347,86 @@ void Soc_ShowTimelineGbl (void)
} }
/*****************************************************************************/ /*****************************************************************************/
/******* Get and show recent timeline including all the users I follow *******/ /********** Refresh new publishings in social timeline via AJAX **************/
/*****************************************************************************/ /*****************************************************************************/
void Soc_GetAndShowNewTimelineGbl (void) void Soc_RefreshNewTimelineGbl (void)
{
// Send, before the HTML, the refresh time
fprintf (Gbl.F.Out,"%lu|",
Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE);
Soc_GetAndShowNewTimeline (Soc_TIMELINE_GBL);
}
/*****************************************************************************/
/****************** Get and show new publishings in timeline *****************/
/*****************************************************************************/
static void Soc_GetAndShowNewTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl)
{ {
char Query[512]; char Query[512];
/***** Build query to get timeline *****/ /***** Build query to get timeline *****/
Soc_BuildQueryToGetTimelineGbl (Soc_GET_ONLY_NEW_PUBS,Query); Soc_BuildQueryToGetTimeline (TimelineUsrOrGbl,
Soc_GET_ONLY_NEW_PUBS,
Query);
/***** Show new timeline *****/ /***** Show new timeline *****/
Soc_ShowNewPubsInTimeline (Query); Soc_ShowNewPubsInTimeline (Query);
/***** Drop temporary tables *****/ /***** Drop temporary tables *****/
Soc_DropTemporaryTablesUsedToQueryTimeline (); Soc_DropTemporaryTablesUsedToQueryTimeline ();
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
} }
/*****************************************************************************/ /*****************************************************************************/
/******** Get and show old timeline including all the users I follow *********/ /************ View new publishings in social timeline via AJAX ***************/
/*****************************************************************************/ /*****************************************************************************/
void Soc_GetAndShowOldTimelineGbl (void) void Soc_GetOtherUsrNicknameFromUsrCod (void)
{
// User's code is already taken from nickname in Par_GetMainParameters ()
if (!Nck_GetNicknameFromUsrCod (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.Nickname))
Gbl.Usrs.Other.UsrDat.UsrCod = -1L;
}
void Soc_RefreshOldTimelineUsr (void)
{
/***** If user exists, show old publishings *****/
// User's code is already taken from nickname in Par_GetMainParameters ()
if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod)) // Existing user
Soc_GetAndShowOldTimeline (Soc_TIMELINE_USR);
}
void Soc_RefreshOldTimelineGbl (void)
{
Soc_GetAndShowOldTimeline (Soc_TIMELINE_GBL);
}
/*****************************************************************************/
/**************** Get and show old publishings in timeline *******************/
/*****************************************************************************/
static void Soc_GetAndShowOldTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl)
{ {
char Query[512]; char Query[512];
/***** Build query to get timeline *****/ /***** Build query to get timeline *****/
Soc_BuildQueryToGetTimelineGbl (Soc_GET_ONLY_OLD_PUBS,Query); Soc_BuildQueryToGetTimeline (TimelineUsrOrGbl,
Soc_GET_ONLY_OLD_PUBS,
Query);
/***** Show old timeline *****/ /***** Show old timeline *****/
Soc_ShowOldPubsInTimeline (Query); Soc_ShowOldPubsInTimeline (Query);
/***** Drop temporary tables *****/ /***** Drop temporary tables *****/
Soc_DropTemporaryTablesUsedToQueryTimeline (); Soc_DropTemporaryTablesUsedToQueryTimeline ();
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -375,9 +434,11 @@ void Soc_GetAndShowOldTimelineGbl (void)
/*****************************************************************************/ /*****************************************************************************/
// Query must have space for at least 512 chars // Query must have space for at least 512 chars
static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline, static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl,
char *Query) Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline,
char *Query)
{ {
char SubQueryPublishers[128];
char SubQueryRangePubs[64]; char SubQueryRangePubs[64];
long LastPubCod; long LastPubCod;
long FirstPubCod; long FirstPubCod;
@ -390,17 +451,28 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
Soc_DropTemporaryTablesUsedToQueryTimeline (); Soc_DropTemporaryTablesUsedToQueryTimeline ();
/***** Create temporary table with potential publishers *****/ /***** Create temporary table with potential publishers *****/
sprintf (Query,"CREATE TEMPORARY TABLE publishers " switch (TimelineUsrOrGbl)
"(UsrCod INT NOT NULL," {
"UNIQUE INDEX(UsrCod)) ENGINE=MEMORY" case Soc_TIMELINE_USR: // Show the timeline of a user
" SELECT '%ld' AS UsrCod" sprintf (SubQueryPublishers,"PublisherCod='%ld'",
" UNION" Gbl.Usrs.Other.UsrDat.UsrCod);
" SELECT FollowedCod AS UsrCod" break;
" FROM usr_follow WHERE FollowerCod='%ld'", case Soc_TIMELINE_GBL: // Show the timeline of the users follwed by me
Gbl.Usrs.Me.UsrDat.UsrCod, sprintf (Query,"CREATE TEMPORARY TABLE publishers "
Gbl.Usrs.Me.UsrDat.UsrCod); "(UsrCod INT NOT NULL,"
if (mysql_query (&Gbl.mysql,Query)) "UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
DB_ExitOnMySQLError ("can not create temporary table"); " SELECT '%ld' AS UsrCod"
" UNION"
" SELECT FollowedCod AS UsrCod"
" FROM usr_follow WHERE FollowerCod='%ld'",
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table");
sprintf (SubQueryPublishers,"PublisherCod IN (SELECT UsrCod FROM publishers)");
break;
}
/***** Create temporary table with notes already present in current timeline *****/ /***** Create temporary table with notes already present in current timeline *****/
if (WhatToGetFromTimeline == Soc_GET_ONLY_OLD_PUBS) if (WhatToGetFromTimeline == Soc_GET_ONLY_OLD_PUBS)
@ -427,9 +499,10 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
"UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY" "UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY"
" SELECT MAX(PubCod) AS NewestPubForNote" " SELECT MAX(PubCod) AS NewestPubForNote"
" FROM social_pubs" " FROM social_pubs"
" WHERE PublisherCod IN (SELECT UsrCod FROM publishers)" " WHERE %s"
" GROUP BY NotCod" " GROUP BY NotCod"
" ORDER BY NewestPubForNote DESC LIMIT %u", " ORDER BY NewestPubForNote DESC LIMIT %u",
SubQueryPublishers,
Soc_MAX_RECENT_PUBS_TO_GET); Soc_MAX_RECENT_PUBS_TO_GET);
break; break;
case Soc_GET_ONLY_NEW_PUBS: // Get the publishings (without limit) newer than LastPubCod case Soc_GET_ONLY_NEW_PUBS: // Get the publishings (without limit) newer than LastPubCod
@ -444,10 +517,11 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
"UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY" "UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY"
" SELECT MAX(PubCod) AS NewestPubForNote" " SELECT MAX(PubCod) AS NewestPubForNote"
" FROM social_pubs" " FROM social_pubs"
" WHERE %sPublisherCod IN (SELECT UsrCod FROM publishers)" " WHERE %s%s"
" GROUP BY NotCod" " GROUP BY NotCod"
" ORDER BY NewestPubForNote DESC", " ORDER BY NewestPubForNote DESC",
SubQueryRangePubs); SubQueryRangePubs,
SubQueryPublishers);
break; break;
case Soc_GET_ONLY_OLD_PUBS: // Get some limited publishings older than FirstPubCod case Soc_GET_ONLY_OLD_PUBS: // Get some limited publishings older than FirstPubCod
/* This query is made via AJAX /* This query is made via AJAX
@ -462,11 +536,12 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
"UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY" "UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY"
" SELECT MAX(PubCod) AS NewestPubForNote" " SELECT MAX(PubCod) AS NewestPubForNote"
" FROM social_pubs" " FROM social_pubs"
" WHERE %sPublisherCod IN (SELECT UsrCod FROM publishers)" " WHERE %s%s"
" AND NotCod NOT IN (SELECT NotCod FROM current_timeline)" " AND NotCod NOT IN (SELECT NotCod FROM current_timeline)"
" GROUP BY NotCod" " GROUP BY NotCod"
" ORDER BY NewestPubForNote DESC LIMIT %u", " ORDER BY NewestPubForNote DESC LIMIT %u",
SubQueryRangePubs, SubQueryRangePubs,
SubQueryPublishers,
Soc_MAX_OLD_PUBS_TO_GET_AND_SHOW); Soc_MAX_OLD_PUBS_TO_GET_AND_SHOW);
break; break;
} }

View File

@ -93,8 +93,11 @@ typedef enum
void Soc_ShowTimelineUsr (void); void Soc_ShowTimelineUsr (void);
void Soc_ShowTimelineGbl (void); void Soc_ShowTimelineGbl (void);
void Soc_GetAndShowNewTimelineGbl (void);
void Soc_GetAndShowOldTimelineGbl (void); void Soc_RefreshNewTimelineGbl (void);
void Soc_RefreshOldTimelineUsr (void);
void Soc_RefreshOldTimelineGbl (void);
void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod); void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod);
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod); void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod);

View File

@ -1844,11 +1844,10 @@ bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void)
/***** Get parameter with encrypted user's code *****/ /***** Get parameter with encrypted user's code *****/
Usr_GetParamOtherUsrCodEncrypted (); Usr_GetParamOtherUsrCodEncrypted ();
/***** Check if user exists and get his data *****/ /***** Check if user exists and get her/his data *****/
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
return true; return true;
// Lay_ShowAlert (Lay_ERROR,"User does not exist.");
return false; return false;
} }