2015-03-18 01:06:43 +01:00
|
|
|
|
// swad_follow.c: user's followers and followed
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2022-09-21 10:46:14 +02:00
|
|
|
|
Copyright (C) 1999-2022 Antonio Ca<EFBFBD>as Vargas
|
2015-03-18 01:06:43 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General 3 License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************************** Headers *********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-12-28 11:46:57 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2015-10-16 02:24:29 +02:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
2021-12-28 11:46:57 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2015-03-24 00:01:40 +01:00
|
|
|
|
#include <string.h> // For string functions
|
2015-03-18 01:06:43 +01:00
|
|
|
|
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_alert.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2015-03-18 01:06:43 +01:00
|
|
|
|
#include "swad_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_figure.h"
|
2015-03-18 01:06:43 +01:00
|
|
|
|
#include "swad_follow.h"
|
2021-05-07 19:11:57 +02:00
|
|
|
|
#include "swad_follow_database.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2015-03-18 01:06:43 +01:00
|
|
|
|
#include "swad_global.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2015-03-24 00:01:40 +01:00
|
|
|
|
#include "swad_notification.h"
|
2021-10-01 09:11:58 +02:00
|
|
|
|
#include "swad_notification_database.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_parameter.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_photo.h"
|
2016-12-09 13:59:33 +01:00
|
|
|
|
#include "swad_privacy.h"
|
2015-03-18 02:11:23 +01:00
|
|
|
|
#include "swad_profile.h"
|
2015-03-18 01:06:43 +01:00
|
|
|
|
#include "swad_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-12-12 19:47:10 +01:00
|
|
|
|
#define Fol_NUM_COLUMNS_FOLLOW 3
|
2015-03-19 12:32:45 +01:00
|
|
|
|
|
2017-05-25 13:43:54 +02:00
|
|
|
|
#define Fol_FOLLOW_SECTION_ID "follow_section"
|
|
|
|
|
|
2015-03-18 01:06:43 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Fol_PutIconsWhoToFollow (__attribute__((unused)) void *Args);
|
2016-03-24 13:50:57 +01:00
|
|
|
|
static void Fol_PutIconToUpdateWhoToFollow (void);
|
2016-03-24 13:40:05 +01:00
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ShowNumberOfFollowingOrFollowers (const struct Usr_Data *UsrDat,
|
2015-03-21 19:55:00 +01:00
|
|
|
|
unsigned NumUsrs,
|
|
|
|
|
Act_Action_t Action,
|
|
|
|
|
const char *Title);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ListFollowingUsr (struct Usr_Data *UsrDat);
|
|
|
|
|
static void Fol_ListFollowersUsr (struct Usr_Data *UsrDat);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ShowFollowedOrFollower (struct Usr_Data *UsrDat);
|
|
|
|
|
static void Fol_WriteRowUsrToFollowOnRightColumn (struct Usr_Data *UsrDat);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
static void Fol_PutInactiveIconToFollowUnfollow (void);
|
2021-11-10 19:28:47 +01:00
|
|
|
|
static void Fol_PutIconToFollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
|
|
|
|
static void Fol_PutIconToUnfollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
2015-03-19 00:28:37 +01:00
|
|
|
|
|
2019-04-22 10:10:21 +02:00
|
|
|
|
static void Fol_RequestFollowUsrs (Act_Action_t NextAction);
|
|
|
|
|
static void Fol_RequestUnfollowUsrs (Act_Action_t NextAction);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Fol_PutHiddenParSelectedUsrsCods (void *SelectedUsrs);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
static void Fol_GetFollowedFromSelectedUsrs (unsigned *NumFollowed,
|
|
|
|
|
unsigned *NumNotFollowed);
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_FollowUsr (const struct Usr_Data *UsrDat);
|
|
|
|
|
static void Fol_UnfollowUsr (const struct Usr_Data *UsrDat);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
2016-01-27 22:31:36 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-01-27 23:40:16 +01:00
|
|
|
|
/********************** Put link to show users to follow **********************/
|
2016-01-27 22:31:36 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_PutLinkWhoToFollow (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Who_to_follow;
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Lay_PutContextualLinkIconText (ActSeeSocPrf,NULL,
|
|
|
|
|
NULL,NULL,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"user-plus.svg",Ico_BLACK,
|
2021-12-22 18:54:43 +01:00
|
|
|
|
Txt_Who_to_follow,NULL);
|
2016-01-27 22:31:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-02-16 20:22:13 +01:00
|
|
|
|
/****************** Show several users to follow on main zone ****************/
|
2016-01-27 22:31:36 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-02-16 20:22:13 +01:00
|
|
|
|
#define Fol_MAX_USRS_TO_FOLLOW_MAIN_ZONE (Fol_NUM_COLUMNS_FOLLOW * 3)
|
|
|
|
|
|
|
|
|
|
void Fol_SuggestUsrsToFollowMainZone (void)
|
2016-01-27 22:31:36 +01:00
|
|
|
|
{
|
2019-03-12 21:25:55 +01:00
|
|
|
|
extern const char *Hlp_START_Profiles_who_to_follow;
|
2016-01-28 21:31:11 +01:00
|
|
|
|
extern const char *Txt_Who_to_follow;
|
2016-01-27 23:28:53 +01:00
|
|
|
|
extern const char *Txt_No_user_to_whom_you_can_follow_Try_again_later;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
2021-04-16 13:51:12 +02:00
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
unsigned NumUsr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data UsrDat;
|
2016-01-27 23:04:27 +01:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2021-10-29 00:32:19 +02:00
|
|
|
|
Prf_PutLinkMyPublicProfile (); // My public profile
|
|
|
|
|
Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2016-01-29 00:41:52 +01:00
|
|
|
|
|
2017-02-16 17:58:37 +01:00
|
|
|
|
/***** Get users *****/
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if ((NumUsrs = Fol_DB_GetUsrsToFollow (Fol_MAX_USRS_TO_FOLLOW_MAIN_ZONE,
|
|
|
|
|
Fol_SUGGEST_ANY_USER,
|
|
|
|
|
&mysql_res)))
|
2017-02-16 17:58:37 +01:00
|
|
|
|
{
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin ("560px",Txt_Who_to_follow,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Fol_PutIconsWhoToFollow,NULL,
|
2019-03-12 21:25:55 +01:00
|
|
|
|
Hlp_START_Profiles_who_to_follow,Box_NOT_CLOSABLE,2);
|
2017-02-16 17:58:37 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
2017-02-16 17:58:37 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** List users *****/
|
|
|
|
|
for (NumUsr = 0;
|
|
|
|
|
NumUsr < NumUsrs;
|
|
|
|
|
NumUsr++)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user *****/
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2017-02-16 17:58:37 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* Get user's code (row[0]) */
|
|
|
|
|
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
|
|
|
|
|
|
|
|
/***** Show user *****/
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
|
|
|
|
Fol_ShowFollowedOrFollower (&UsrDat);
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
|
|
|
|
NumUsr == NumUsrs - 1)
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
2017-02-16 17:58:37 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2017-02-16 17:58:37 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_No_user_to_whom_you_can_follow_Try_again_later);
|
2017-02-16 17:58:37 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-16 20:22:13 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Show several users to follow on right column ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define Fol_MAX_USRS_TO_FOLLOW_RIGHT_COLUMN 3
|
|
|
|
|
|
|
|
|
|
void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Who_to_follow;
|
|
|
|
|
extern const char *Txt_No_user_to_whom_you_can_follow_Try_again_later;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
2021-04-17 01:08:48 +02:00
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
unsigned NumUsr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data UsrDat;
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Get users *****/
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if ((NumUsrs = Fol_DB_GetUsrsToFollow (Fol_MAX_USRS_TO_FOLLOW_RIGHT_COLUMN,
|
|
|
|
|
Fol_SUGGEST_ONLY_USERS_WITH_PHOTO,
|
|
|
|
|
&mysql_res)))
|
2017-02-16 20:22:13 +01:00
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container *****/
|
2021-12-29 15:09:17 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"CON CON_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Title with link to suggest more users to follow *****/
|
|
|
|
|
Frm_BeginForm (ActSeeSocPrf);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Who_to_follow,"class=\"BT_LINK\"");
|
2021-11-10 19:28:47 +01:00
|
|
|
|
HTM_Txt (Txt_Who_to_follow);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Begin table *****/
|
|
|
|
|
HTM_TABLE_Begin (NULL);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** List users *****/
|
|
|
|
|
for (NumUsr = 0;
|
|
|
|
|
NumUsr < NumUsrs;
|
|
|
|
|
NumUsr++)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user *****/
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* Get user's code (row[0]) */
|
|
|
|
|
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Show user *****/
|
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
|
|
|
|
Fol_WriteRowUsrToFollowOnRightColumn (&UsrDat);
|
|
|
|
|
}
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** End table *****/
|
|
|
|
|
HTM_TABLE_End ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
|
|
|
|
/***** End container *****/
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-07 10:45:03 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Put contextual icons in "who to follow" ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Fol_PutIconsWhoToFollow (__attribute__((unused)) void *Args)
|
2016-11-07 10:45:03 +01:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to update who to follow *****/
|
|
|
|
|
Fol_PutIconToUpdateWhoToFollow ();
|
2016-11-07 10:45:03 +01:00
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to show a figure *****/
|
|
|
|
|
Fig_PutIconToShowFigure (Fig_FOLLOW);
|
2016-11-07 10:45:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-24 13:40:05 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Put icon to update who to follow **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-03-24 13:50:57 +01:00
|
|
|
|
static void Fol_PutIconToUpdateWhoToFollow (void)
|
2016-03-24 13:40:05 +01:00
|
|
|
|
{
|
2021-12-28 11:46:57 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeSocPrf,NULL,
|
|
|
|
|
NULL,NULL,
|
2022-06-29 18:34:15 +02:00
|
|
|
|
"recycle.svg",Ico_BLACK);
|
2016-03-24 13:40:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-29 14:24:37 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Get number of followed **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-02-22 14:04:54 +01:00
|
|
|
|
void Fol_FlushCacheFollow (void)
|
2015-12-29 14:24:37 +01:00
|
|
|
|
{
|
2019-02-22 14:04:54 +01:00
|
|
|
|
Gbl.Cache.Follow.UsrCod = -1L;
|
|
|
|
|
Gbl.Cache.Follow.NumFollowing =
|
|
|
|
|
Gbl.Cache.Follow.NumFollowers = 0;
|
2015-12-29 14:24:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-22 14:04:54 +01:00
|
|
|
|
void Fol_GetNumFollow (long UsrCod,
|
|
|
|
|
unsigned *NumFollowing,unsigned *NumFollowers)
|
2015-12-29 14:24:37 +01:00
|
|
|
|
{
|
2019-02-22 14:04:54 +01:00
|
|
|
|
/***** 1. Fast check: trivial cases *****/
|
|
|
|
|
if (UsrCod <= 0)
|
|
|
|
|
{
|
|
|
|
|
*NumFollowing = *NumFollowers = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: Is number of following already calculated? *****/
|
|
|
|
|
if (UsrCod == Gbl.Cache.Follow.UsrCod)
|
|
|
|
|
{
|
|
|
|
|
*NumFollowing = Gbl.Cache.Follow.NumFollowing;
|
|
|
|
|
*NumFollowers = Gbl.Cache.Follow.NumFollowers;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** 3. Slow check: Get number of following/followers from database *****/
|
|
|
|
|
Gbl.Cache.Follow.UsrCod = UsrCod;
|
2021-05-07 19:11:57 +02:00
|
|
|
|
*NumFollowing = Gbl.Cache.Follow.NumFollowing = Fol_DB_GetNumFollowing (UsrCod);
|
|
|
|
|
*NumFollowers = Gbl.Cache.Follow.NumFollowers = Fol_DB_GetNumFollowers (UsrCod);
|
2015-12-29 14:24:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-19 00:28:37 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Show following and followers of a user *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void Fol_ShowFollowingAndFollowers (const struct Usr_Data *UsrDat,
|
2015-12-29 19:40:38 +01:00
|
|
|
|
unsigned NumFollowing,unsigned NumFollowers,
|
|
|
|
|
bool UsrFollowsMe,bool IFollowUsr)
|
2015-03-19 00:28:37 +01:00
|
|
|
|
{
|
2015-12-29 20:39:06 +01:00
|
|
|
|
extern const char *Txt_FOLLOWS_YOU;
|
2015-03-19 00:28:37 +01:00
|
|
|
|
extern const char *Txt_Following;
|
|
|
|
|
extern const char *Txt_Followers;
|
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (Fol_FOLLOW_SECTION_ID);
|
2015-03-19 00:28:37 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Followed users *****/
|
|
|
|
|
HTM_DIV_Begin ("id=\"following_side\"");
|
|
|
|
|
HTM_DIV_Begin ("class=\"FOLLOW_SIDE\"");
|
2015-12-29 19:40:38 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* User follows me? */
|
2022-03-25 11:09:51 +01:00
|
|
|
|
HTM_DIV_Begin ("id=\"follows_me\" class=\"DAT_LIGHT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-11-10 19:28:47 +01:00
|
|
|
|
if (UsrFollowsMe)
|
|
|
|
|
HTM_Txt (Txt_FOLLOWS_YOU);
|
|
|
|
|
HTM_DIV_End ();
|
2015-03-21 19:55:00 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* Number of followed */
|
|
|
|
|
Fol_ShowNumberOfFollowingOrFollowers (UsrDat,
|
|
|
|
|
NumFollowing,
|
|
|
|
|
ActSeeFlg,Txt_Following);
|
2015-12-29 19:40:38 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* End following side */
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
HTM_DIV_End ();
|
2015-12-29 19:40:38 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Followers *****/
|
|
|
|
|
HTM_DIV_Begin ("id=\"followers_side\"");
|
|
|
|
|
HTM_DIV_Begin ("class=\"FOLLOW_SIDE\"");
|
|
|
|
|
|
|
|
|
|
/* Number of followers */
|
|
|
|
|
Fol_ShowNumberOfFollowingOrFollowers (UsrDat,
|
|
|
|
|
NumFollowers,
|
|
|
|
|
ActSeeFlr,Txt_Followers);
|
|
|
|
|
|
|
|
|
|
/* I follow user? */
|
|
|
|
|
HTM_DIV_Begin ("id=\"follow_usr\"");
|
|
|
|
|
if (Gbl.Usrs.Me.Logged && // Logged
|
2021-11-18 22:06:06 +01:00
|
|
|
|
!Usr_ItsMe (UsrDat->UsrCod)) // Not me!
|
2021-11-10 19:28:47 +01:00
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (IFollowUsr ? ActUnfUsr :
|
|
|
|
|
ActFolUsr);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2021-11-10 19:28:47 +01:00
|
|
|
|
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,
|
|
|
|
|
IFollowUsr ? "user-check.svg" :
|
|
|
|
|
"user-plus.svg",
|
2022-06-30 00:44:52 +02:00
|
|
|
|
Act_GetActionText (IFollowUsr ? ActUnfUsr :
|
|
|
|
|
ActFolUsr),
|
2022-03-16 01:18:12 +01:00
|
|
|
|
"class=\"ICO_HIGHLIGHT ICO40x40\"");
|
2021-11-10 19:28:47 +01:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
HTM_DIV_End ();
|
2015-03-21 19:55:00 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/* End followers side */
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
HTM_DIV_End ();
|
2015-12-29 19:40:38 +01:00
|
|
|
|
|
2015-12-12 19:47:10 +01:00
|
|
|
|
/***** End section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2015-03-21 19:55:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Show following and followers of a user *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ShowNumberOfFollowingOrFollowers (const struct Usr_Data *UsrDat,
|
2015-03-21 19:55:00 +01:00
|
|
|
|
unsigned NumUsrs,
|
|
|
|
|
Act_Action_t Action,
|
|
|
|
|
const char *Title)
|
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container *****/
|
2021-12-26 22:39:16 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"FOLLOW_BOX %s\"",
|
|
|
|
|
(Gbl.Action.Act == Action) ? "FOLLOW_NUM_B" :
|
|
|
|
|
"FOLLOW_NUM");
|
2015-03-21 19:55:00 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Number *****/
|
|
|
|
|
if (NumUsrs)
|
|
|
|
|
{
|
|
|
|
|
/* Form to list users */
|
|
|
|
|
Frm_BeginFormAnchor (Action,Fol_FOLLOW_SECTION_ID);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Title,"class=\"BT_LINK\"");
|
2021-11-10 19:28:47 +01:00
|
|
|
|
}
|
|
|
|
|
HTM_Unsigned (NumUsrs);
|
|
|
|
|
if (NumUsrs)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
2015-03-19 00:28:37 +01:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Text *****/
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"FORM_OUT_%s%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix (),
|
2022-04-01 01:06:44 +02:00
|
|
|
|
(Gbl.Action.Act == Action) ? " BOLD" :
|
|
|
|
|
"");
|
2021-11-10 19:28:47 +01:00
|
|
|
|
if (NumUsrs)
|
|
|
|
|
{
|
|
|
|
|
/* Form to list users */
|
|
|
|
|
Frm_BeginFormAnchor (Action,Fol_FOLLOW_SECTION_ID);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Title,"class=\"BT_LINK\"");
|
2021-11-10 19:28:47 +01:00
|
|
|
|
}
|
|
|
|
|
HTM_Txt (Title);
|
|
|
|
|
if (NumUsrs)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
HTM_DIV_End ();
|
2015-12-12 19:47:10 +01:00
|
|
|
|
|
|
|
|
|
/***** End container *****/
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2015-03-19 00:28:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-19 01:59:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** List followed users ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_ListFollowing (void)
|
2016-06-12 19:55:33 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Get user to view user he/she follows *****/
|
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
|
|
|
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
|
|
|
|
{
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
2016-06-12 19:55:33 +02:00
|
|
|
|
Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat);
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2016-06-12 19:55:33 +02:00
|
|
|
|
}
|
|
|
|
|
else // If user not specified, view my profile
|
|
|
|
|
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ListFollowingUsr (struct Usr_Data *UsrDat)
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2016-01-28 21:38:24 +01:00
|
|
|
|
extern const char *Txt_Following;
|
2015-03-19 01:59:08 +01:00
|
|
|
|
MYSQL_RES *mysql_res;
|
2021-04-16 13:51:12 +02:00
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
unsigned NumUsr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data FollowingUsrDat;
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Show user's profile *****/
|
|
|
|
|
if (Prf_ShowUserProfile (UsrDat))
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2021-05-07 19:11:57 +02:00
|
|
|
|
/***** Get list of following *****/
|
|
|
|
|
NumUsrs = Fol_DB_GetListFollowing (UsrDat->UsrCod,&mysql_res);
|
2018-10-31 09:40:43 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
if (NumUsrs)
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&FollowingUsrDat);
|
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin ("560px",Txt_Following,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
NULL,Box_NOT_CLOSABLE,2);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
for (NumUsr = 0;
|
|
|
|
|
NumUsr < NumUsrs;
|
|
|
|
|
NumUsr++)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user's code *****/
|
|
|
|
|
FollowingUsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
/***** Show user *****/
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
|
|
|
|
Fol_ShowFollowedOrFollower (&FollowingUsrDat);
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
|
|
|
|
NumUsr == NumUsrs - 1)
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&FollowingUsrDat);
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* List followers ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_ListFollowers (void)
|
2016-06-12 19:55:33 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Get user to view user he/she follows *****/
|
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
|
|
|
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
|
|
|
|
{
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
2016-06-12 19:55:33 +02:00
|
|
|
|
Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat);
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2016-06-12 19:55:33 +02:00
|
|
|
|
}
|
|
|
|
|
else // If user not specified, view my profile
|
|
|
|
|
Fol_ListFollowersUsr (&Gbl.Usrs.Me.UsrDat);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ListFollowersUsr (struct Usr_Data *UsrDat)
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2016-01-28 21:38:24 +01:00
|
|
|
|
extern const char *Txt_Followers;
|
2015-03-19 01:59:08 +01:00
|
|
|
|
MYSQL_RES *mysql_res;
|
2021-04-16 13:51:12 +02:00
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
unsigned NumUsr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data FollowerUsrDat;
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Show user's profile *****/
|
|
|
|
|
if (Prf_ShowUserProfile (UsrDat))
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2021-05-07 19:11:57 +02:00
|
|
|
|
/***** Get list of followers *****/
|
2021-11-09 10:26:27 +01:00
|
|
|
|
if ((NumUsrs = Fol_DB_GetListFollowers (UsrDat->UsrCod,&mysql_res)))
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&FollowerUsrDat);
|
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin ("560px",Txt_Followers,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
NULL,Box_NOT_CLOSABLE,2);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2021-11-09 10:26:27 +01:00
|
|
|
|
for (NumUsr = 0;
|
|
|
|
|
NumUsr < NumUsrs;
|
|
|
|
|
NumUsr++)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user's code *****/
|
|
|
|
|
FollowerUsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
2021-11-09 10:26:27 +01:00
|
|
|
|
/***** Show user *****/
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
|
|
|
|
Fol_ShowFollowedOrFollower (&FollowerUsrDat);
|
|
|
|
|
|
|
|
|
|
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
|
|
|
|
NumUsr == NumUsrs - 1)
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2015-03-24 00:01:40 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&FollowerUsrDat);
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
2016-06-12 19:55:33 +02:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
|
|
|
|
|
/***** If it's me, mark possible notification as seen *****/
|
2021-11-09 10:26:27 +01:00
|
|
|
|
if (Usr_ItsMe (UsrDat->UsrCod))
|
|
|
|
|
Ntf_DB_MarkNotifsAsSeen (Ntf_EVENT_FOLLOWER);
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2015-12-12 02:01:20 +01:00
|
|
|
|
/************************* Show followed or follower *************************/
|
2015-03-19 01:59:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_ShowFollowedOrFollower (struct Usr_Data *UsrDat)
|
2015-03-19 01:59:08 +01:00
|
|
|
|
{
|
2017-02-17 01:59:58 +01:00
|
|
|
|
extern const char *Txt_Another_user_s_profile;
|
2021-12-31 14:51:44 +01:00
|
|
|
|
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
2021-12-01 01:43:13 +01:00
|
|
|
|
{
|
2021-12-31 14:51:44 +01:00
|
|
|
|
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC60x80",
|
|
|
|
|
[PhoSha_SHAPE_ELLIPSE ] = "PHOTOE60x80",
|
|
|
|
|
[PhoSha_SHAPE_OVAL ] = "PHOTOO60x80",
|
|
|
|
|
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR60x80",
|
2021-12-01 01:43:13 +01:00
|
|
|
|
};
|
2019-03-22 15:21:46 +01:00
|
|
|
|
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Show user's photo *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"FOLLOW_PHOTO\"");
|
2021-03-02 10:16:41 +01:00
|
|
|
|
if (Visible)
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Pho_ShowUsrPhotoIfAllowed (UsrDat,
|
2022-10-15 10:58:23 +02:00
|
|
|
|
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2015-03-19 01:59:08 +01:00
|
|
|
|
|
2016-06-12 19:55:33 +02:00
|
|
|
|
/***** Show user's name and icon to follow/unfollow *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"FOLLOW_USR\"");
|
2016-01-29 00:41:52 +01:00
|
|
|
|
|
2021-03-02 10:16:41 +01:00
|
|
|
|
if (Visible)
|
|
|
|
|
{
|
|
|
|
|
/* Put form to go to public profile */
|
|
|
|
|
Frm_BeginForm (ActSeeOthPubPrf);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2022-03-29 00:58:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"LT FOLLOW_USR_NAME DAT_%s\"", // Limited width
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Another_user_s_profile,
|
|
|
|
|
"class=\"BT_LINK LT\"");
|
2021-03-02 10:16:41 +01:00
|
|
|
|
Usr_WriteFirstNameBRSurnames (UsrDat);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Gbl.Usrs.Me.Logged || // Not logged
|
2021-11-18 22:06:06 +01:00
|
|
|
|
Usr_ItsMe (UsrDat->UsrCod)) // It's me
|
2021-03-02 10:16:41 +01:00
|
|
|
|
/* Inactive icon to follow/unfollow */
|
|
|
|
|
Fol_PutInactiveIconToFollowUnfollow ();
|
|
|
|
|
else // It's not me
|
|
|
|
|
{
|
|
|
|
|
/* Put form to follow / unfollow */
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
UsrDat->UsrCod)) // I follow user
|
2021-03-02 10:16:41 +01:00
|
|
|
|
/* Form to unfollow */
|
2021-11-10 19:28:47 +01:00
|
|
|
|
Fol_PutIconToUnfollow (UsrDat->EnUsrCod);
|
2021-03-02 10:16:41 +01:00
|
|
|
|
else if (Visible) // I do not follow this user and I can follow
|
|
|
|
|
/* Form to follow */
|
2021-11-10 19:28:47 +01:00
|
|
|
|
Fol_PutIconToFollow (UsrDat->EnUsrCod);
|
2021-03-02 10:16:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2015-03-19 01:59:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-16 20:22:13 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Write the name of a connected user ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_WriteRowUsrToFollowOnRightColumn (struct Usr_Data *UsrDat)
|
2017-02-16 20:22:13 +01:00
|
|
|
|
{
|
2017-02-17 01:59:58 +01:00
|
|
|
|
extern const char *Txt_Another_user_s_profile;
|
2021-12-31 14:51:44 +01:00
|
|
|
|
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
2021-12-01 01:43:13 +01:00
|
|
|
|
{
|
2021-12-31 14:51:44 +01:00
|
|
|
|
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC21x28",
|
|
|
|
|
[PhoSha_SHAPE_ELLIPSE ] = "PHOTOE21x28",
|
|
|
|
|
[PhoSha_SHAPE_OVAL ] = "PHOTOO21x28",
|
|
|
|
|
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28",
|
2021-12-01 01:43:13 +01:00
|
|
|
|
};
|
2019-03-22 15:21:46 +01:00
|
|
|
|
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Show user's photo *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2022-03-19 02:05:53 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"CON_PHOTO %s\"",The_GetColorRows ());
|
2021-03-02 10:16:41 +01:00
|
|
|
|
if (Visible)
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Pho_ShowUsrPhotoIfAllowed (UsrDat,
|
2022-10-15 10:58:23 +02:00
|
|
|
|
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM);
|
2021-03-02 10:16:41 +01:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** User's name *****/
|
2021-12-20 22:43:32 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"CON_NAME_FOLLOW %s\"",
|
2022-03-19 02:05:53 +01:00
|
|
|
|
The_GetColorRows ());
|
2021-03-02 10:16:41 +01:00
|
|
|
|
if (Visible)
|
|
|
|
|
{
|
|
|
|
|
/* Put form to go to public profile */
|
|
|
|
|
Frm_BeginForm (ActSeeOthPubPrf);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2021-12-26 22:39:16 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"CON_NAME_FOLLOW CON_CRS LT\""); // Limited width
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Another_user_s_profile,
|
2022-09-09 12:50:53 +02:00
|
|
|
|
"class=\"LT BT_LINK\"");
|
2021-03-02 10:16:41 +01:00
|
|
|
|
Usr_WriteFirstNameBRSurnames (UsrDat);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Icon to follow *****/
|
2021-12-20 22:43:32 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"CON_ICON_FOLLOW RM %s\"",
|
2022-03-19 02:05:53 +01:00
|
|
|
|
The_GetColorRows ());
|
2021-12-20 22:43:32 +01:00
|
|
|
|
if (!Gbl.Usrs.Me.Logged || // Not logged
|
|
|
|
|
Usr_ItsMe (UsrDat->UsrCod)) // It's me
|
|
|
|
|
/* Inactive icon to follow/unfollow */
|
|
|
|
|
Fol_PutInactiveIconToFollowUnfollow ();
|
|
|
|
|
else // It's not me
|
|
|
|
|
{
|
|
|
|
|
/* Put form to follow / unfollow */
|
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
UsrDat->UsrCod)) // I follow user
|
|
|
|
|
/* Form to unfollow */
|
|
|
|
|
Fol_PutIconToUnfollow (UsrDat->EnUsrCod);
|
|
|
|
|
else if (Visible) // I do not follow this user and I can follow
|
|
|
|
|
/* Form to follow */
|
|
|
|
|
Fol_PutIconToFollow (UsrDat->EnUsrCod);
|
|
|
|
|
}
|
2021-03-02 10:16:41 +01:00
|
|
|
|
HTM_TD_End ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
|
2022-03-24 01:18:19 +01:00
|
|
|
|
The_ChangeRowColor ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-12-22 18:54:43 +01:00
|
|
|
|
/************* Put inactive icon to follow/unfollow another user *************/
|
2017-02-16 20:22:13 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Fol_PutInactiveIconToFollowUnfollow (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Inactive icon to follow/unfollow *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"FOLLOW_USR_ICO ICO_HIDDEN\"");
|
2021-12-22 00:20:06 +01:00
|
|
|
|
Ico_PutIcon ("user.svg",Ico_BLACK,"","ICO16x16");
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2019-11-18 14:21:01 +01:00
|
|
|
|
/*********************** Put icon to follow another user *********************/
|
2017-02-16 20:22:13 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
static void Fol_PutIconToFollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
2017-02-16 20:22:13 +01:00
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActFolUsr);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
2022-06-30 00:44:52 +02:00
|
|
|
|
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-plus.svg",
|
|
|
|
|
Act_GetActionText (ActFolUsr),
|
2022-04-20 22:56:58 +02:00
|
|
|
|
"class=\"FOLLOW_USR_ICO ICO16x16 ICO_%s_%s ICO_HIGHLIGHT\"",
|
|
|
|
|
Ico_GetPreffix (Ico_BLACK),The_GetSuffix ());
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Put icon to unfollow another user ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-11-10 19:28:47 +01:00
|
|
|
|
static void Fol_PutIconToUnfollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
2017-02-16 20:22:13 +01:00
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActUnfUsr);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
2021-11-10 19:28:47 +01:00
|
|
|
|
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-check.svg",
|
2022-06-30 00:44:52 +02:00
|
|
|
|
Act_GetActionText (ActUnfUsr),
|
2022-03-16 01:18:12 +01:00
|
|
|
|
"class=\"FOLLOW_USR_ICO ICO_HIGHLIGHT ICO16x16\"");
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2017-02-16 20:22:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-18 01:06:43 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Follow another user ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-02-17 02:42:00 +01:00
|
|
|
|
void Fol_FollowUsr1 (void)
|
2015-03-18 01:06:43 +01:00
|
|
|
|
{
|
2015-03-19 01:59:08 +01:00
|
|
|
|
/***** Get user to be followed *****/
|
2015-03-18 01:06:43 +01:00
|
|
|
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
|
|
|
|
{
|
2019-03-12 01:46:40 +01:00
|
|
|
|
// Follow only if I do not follow him/her
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if (!Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.UsrCod))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Fol_FollowUsr (&Gbl.Usrs.Other.UsrDat);
|
|
|
|
|
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
|
2015-03-18 01:06:43 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
2017-02-17 02:42:00 +01:00
|
|
|
|
}
|
2015-03-18 02:11:23 +01:00
|
|
|
|
|
2017-02-17 02:42:00 +01:00
|
|
|
|
void Fol_FollowUsr2 (void)
|
|
|
|
|
{
|
2019-03-09 20:12:44 +01:00
|
|
|
|
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
2019-03-10 00:34:16 +01:00
|
|
|
|
{
|
2017-02-17 02:42:00 +01:00
|
|
|
|
/***** Show user's profile again *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
2019-03-10 00:34:16 +01:00
|
|
|
|
/* 1) I had permission to follow the user and I've just follow him/her
|
|
|
|
|
2) User restricted permission, so now I can not view his/her profile
|
|
|
|
|
3) Now I can not view his/her profile ==> show users I follow */
|
|
|
|
|
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow
|
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlerts (NULL);
|
2015-03-18 01:06:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Unfollow another user *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-02-17 02:42:00 +01:00
|
|
|
|
void Fol_UnfollowUsr1 (void)
|
2015-03-18 01:06:43 +01:00
|
|
|
|
{
|
2015-03-19 01:59:08 +01:00
|
|
|
|
/***** Get user to be unfollowed *****/
|
2015-03-18 01:06:43 +01:00
|
|
|
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
|
|
|
|
{
|
2015-03-19 12:47:05 +01:00
|
|
|
|
// Unfollow only if I follow him/her
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.UsrCod))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Fol_UnfollowUsr (&Gbl.Usrs.Other.UsrDat);
|
2019-02-22 14:04:54 +01:00
|
|
|
|
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
|
2017-02-17 02:42:00 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
2017-02-17 02:42:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Fol_UnfollowUsr2 (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user to be unfollowed *****/
|
2019-03-09 20:12:44 +01:00
|
|
|
|
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
2017-02-17 02:42:00 +01:00
|
|
|
|
{
|
2015-03-18 02:11:23 +01:00
|
|
|
|
/***** Show user's profile again *****/
|
2016-06-12 19:55:33 +02:00
|
|
|
|
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile
|
|
|
|
|
/* 1) I followed a user when I had permission
|
|
|
|
|
2) User restricted permission, so now I can not view his/her profile
|
|
|
|
|
3) Now I can not view his/her profile ==> show users I follow */
|
2016-09-28 13:12:11 +02:00
|
|
|
|
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow
|
2015-03-18 01:06:43 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlerts (NULL);
|
2015-03-18 01:06:43 +01:00
|
|
|
|
}
|
2015-03-23 10:35:15 +01:00
|
|
|
|
|
2019-03-12 01:46:40 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Request follow/unfollow several users *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_RequestFollowStds (void)
|
|
|
|
|
{
|
2019-04-22 10:10:21 +02:00
|
|
|
|
Fol_RequestFollowUsrs (ActFolSevStd);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Fol_RequestFollowTchs (void)
|
|
|
|
|
{
|
2019-04-22 10:10:21 +02:00
|
|
|
|
Fol_RequestFollowUsrs (ActFolSevTch);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 10:10:21 +02:00
|
|
|
|
static void Fol_RequestFollowUsrs (Act_Action_t NextAction)
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Follow;
|
|
|
|
|
extern const char *Txt_Do_you_want_to_follow_the_selected_user_whom_you_do_not_follow_yet;
|
|
|
|
|
extern const char *Txt_Do_you_want_to_follow_the_X_selected_users_whom_you_do_not_follow_yet;
|
|
|
|
|
unsigned NumFollowed;
|
|
|
|
|
unsigned NumNotFollowed;
|
|
|
|
|
|
|
|
|
|
// List of selected users is already got
|
|
|
|
|
|
|
|
|
|
/***** Go through list of selected users
|
|
|
|
|
getting the number of followed and not followed ****/
|
|
|
|
|
Fol_GetFollowedFromSelectedUsrs (&NumFollowed,&NumNotFollowed);
|
|
|
|
|
|
|
|
|
|
/***** Show question to confirm ****/
|
|
|
|
|
if (NumNotFollowed)
|
|
|
|
|
{
|
|
|
|
|
if (NumNotFollowed == 1)
|
|
|
|
|
Ale_ShowAlertAndButton (NextAction,NULL,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Fol_PutHiddenParSelectedUsrsCods,&Gbl.Usrs.Selected,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Btn_CREATE_BUTTON,Txt_Follow,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_want_to_follow_the_selected_user_whom_you_do_not_follow_yet);
|
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlertAndButton (NextAction,NULL,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Fol_PutHiddenParSelectedUsrsCods,&Gbl.Usrs.Selected,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Btn_CREATE_BUTTON,Txt_Follow,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_want_to_follow_the_X_selected_users_whom_you_do_not_follow_yet,
|
|
|
|
|
NumNotFollowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Fol_RequestUnfollowStds (void)
|
|
|
|
|
{
|
2019-04-22 10:10:21 +02:00
|
|
|
|
Fol_RequestUnfollowUsrs (ActUnfSevStd);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Fol_RequestUnfollowTchs (void)
|
|
|
|
|
{
|
2019-04-22 10:10:21 +02:00
|
|
|
|
Fol_RequestUnfollowUsrs (ActUnfSevTch);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 10:10:21 +02:00
|
|
|
|
static void Fol_RequestUnfollowUsrs (Act_Action_t NextAction)
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Do_you_want_to_stop_following_the_selected_user_whom_you_follow;
|
|
|
|
|
extern const char *Txt_Do_you_want_to_stop_following_the_X_selected_users_whom_you_follow;
|
|
|
|
|
extern const char *Txt_Unfollow;
|
|
|
|
|
unsigned NumFollowed;
|
|
|
|
|
unsigned NumNotFollowed;
|
|
|
|
|
|
|
|
|
|
// List of selected users is already got
|
|
|
|
|
|
|
|
|
|
/***** Go through list of selected users
|
|
|
|
|
getting the number of followed and not followed ****/
|
|
|
|
|
Fol_GetFollowedFromSelectedUsrs (&NumFollowed,&NumNotFollowed);
|
|
|
|
|
|
|
|
|
|
/***** Show question to confirm ****/
|
|
|
|
|
if (NumFollowed)
|
|
|
|
|
{
|
|
|
|
|
if (NumFollowed == 1)
|
|
|
|
|
Ale_ShowAlertAndButton (NextAction,NULL,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Fol_PutHiddenParSelectedUsrsCods,&Gbl.Usrs.Selected,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Btn_CREATE_BUTTON,Txt_Unfollow,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_want_to_stop_following_the_selected_user_whom_you_follow);
|
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlertAndButton (NextAction,NULL,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Fol_PutHiddenParSelectedUsrsCods,&Gbl.Usrs.Selected,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Btn_CREATE_BUTTON,Txt_Unfollow,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_want_to_stop_following_the_X_selected_users_whom_you_follow,
|
|
|
|
|
NumFollowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Fol_PutHiddenParSelectedUsrsCods (void *SelectedUsrs)
|
2019-11-15 03:34:48 +01:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
if (SelectedUsrs)
|
2022-09-24 18:30:26 +02:00
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods ((struct Usr_SelectedUsrs *) SelectedUsrs);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**** Go through the list getting the number of followed and not followed ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Fol_GetFollowedFromSelectedUsrs (unsigned *NumFollowed,
|
|
|
|
|
unsigned *NumNotFollowed)
|
|
|
|
|
{
|
2019-04-11 23:15:40 +02:00
|
|
|
|
extern const char *Txt_Selected_users_X_Followed_Y_Not_followed_Z;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data UsrDat;
|
2019-03-12 01:46:40 +01:00
|
|
|
|
const char *Ptr;
|
|
|
|
|
unsigned NumUsrs = 0;
|
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Check users to know if I follow them *****/
|
|
|
|
|
*NumFollowed = 0;
|
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) // Get from the database the data of the student
|
2021-11-03 21:31:16 +01:00
|
|
|
|
if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
2021-05-07 19:11:57 +02:00
|
|
|
|
/* Check if I follow this user, and update number of users */
|
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
UsrDat.UsrCod)) // I follow user
|
2019-03-12 01:46:40 +01:00
|
|
|
|
(*NumFollowed)++;
|
|
|
|
|
NumUsrs++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Show alert ****/
|
|
|
|
|
*NumNotFollowed = NumUsrs - *NumFollowed;
|
2019-04-11 23:15:40 +02:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_Selected_users_X_Followed_Y_Not_followed_Z,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
NumUsrs,*NumFollowed,*NumNotFollowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Follow/unfollow several users ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_FollowUsrs ()
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_You_have_followed_one_user;
|
|
|
|
|
extern const char *Txt_You_have_followed_X_users;
|
|
|
|
|
const char *Ptr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data UsrDat;
|
2019-03-12 01:46:40 +01:00
|
|
|
|
unsigned NumFollowed = 0;
|
|
|
|
|
|
|
|
|
|
/***** Get list of selected users if not already got *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Check users to know if I follow them *****/
|
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
2021-11-03 21:31:16 +01:00
|
|
|
|
if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
/* If I don't follow this user ==> follow him/her */
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if (!Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
UsrDat.UsrCod))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
Fol_FollowUsr (&UsrDat);
|
|
|
|
|
NumFollowed++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Show alert *****/
|
|
|
|
|
if (NumFollowed == 1)
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_You_have_followed_one_user);
|
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_You_have_followed_X_users,
|
|
|
|
|
NumFollowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Fol_UnfollowUsrs (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_You_have_stopped_following_one_user;
|
|
|
|
|
extern const char *Txt_You_have_stopped_following_X_users;
|
|
|
|
|
const char *Ptr;
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data UsrDat;
|
2019-03-12 01:46:40 +01:00
|
|
|
|
unsigned NumUnfollowed = 0;
|
|
|
|
|
|
|
|
|
|
/***** Get list of selected users if not already got *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Check users to know if I follow them *****/
|
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2019-03-12 01:46:40 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
2021-11-03 21:31:16 +01:00
|
|
|
|
if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
/* If I follow this user ==> unfollow him/her */
|
2021-05-07 19:11:57 +02:00
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
UsrDat.UsrCod))
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
Fol_UnfollowUsr (&UsrDat);
|
|
|
|
|
NumUnfollowed++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Show alert *****/
|
|
|
|
|
if (NumUnfollowed == 1)
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_You_have_stopped_following_one_user);
|
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_You_have_stopped_following_X_users,
|
|
|
|
|
NumUnfollowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************** Follow user ********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_FollowUsr (const struct Usr_Data *UsrDat)
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
bool CreateNotif;
|
|
|
|
|
bool NotifyByEmail;
|
|
|
|
|
|
|
|
|
|
/***** Avoid wrong cases *****/
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod <= 0 ||
|
|
|
|
|
UsrDat->UsrCod <= 0 ||
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // Skip me
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** Follow user in database *****/
|
2021-05-07 19:11:57 +02:00
|
|
|
|
Fol_DB_FollowUsr (UsrDat->UsrCod);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Flush cache *****/
|
|
|
|
|
Fol_FlushCacheFollow ();
|
|
|
|
|
|
|
|
|
|
/***** This follow must be notified by email? *****/
|
2019-03-19 13:22:14 +01:00
|
|
|
|
CreateNotif = (UsrDat->NtfEvents.CreateNotif & (1 << Ntf_EVENT_FOLLOWER));
|
2019-03-12 01:46:40 +01:00
|
|
|
|
NotifyByEmail = CreateNotif &&
|
2019-03-19 13:22:14 +01:00
|
|
|
|
(UsrDat->NtfEvents.SendEmail & (1 << Ntf_EVENT_FOLLOWER));
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Create notification for this followed.
|
|
|
|
|
If this followed wants to receive notifications by email,
|
|
|
|
|
activate the sending of a notification *****/
|
|
|
|
|
if (CreateNotif)
|
2021-11-09 09:20:54 +01:00
|
|
|
|
Ntf_DB_StoreNotifyEventToUsr (Ntf_EVENT_FOLLOWER,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
|
|
|
|
|
0),
|
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
|
|
|
|
Gbl.Hierarchy.Ctr.CtrCod,
|
|
|
|
|
Gbl.Hierarchy.Deg.DegCod,
|
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Unfollow user *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void Fol_UnfollowUsr (const struct Usr_Data *UsrDat)
|
2019-03-12 01:46:40 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Avoid wrong cases *****/
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod <= 0 ||
|
|
|
|
|
UsrDat->UsrCod <= 0 ||
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // Skip me
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** Unfollow user in database *****/
|
2021-05-07 19:11:57 +02:00
|
|
|
|
Fol_DB_UnfollowUsr (UsrDat->UsrCod);
|
2019-03-12 01:46:40 +01:00
|
|
|
|
|
|
|
|
|
/***** Flush cache *****/
|
|
|
|
|
Fol_FlushCacheFollow ();
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 10:35:15 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Get and show ranking of users attending to number of followers *******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_GetAndShowRankingFollowers (void)
|
|
|
|
|
{
|
2018-11-01 19:23:52 +01:00
|
|
|
|
MYSQL_RES *mysql_res;
|
2021-05-07 19:11:57 +02:00
|
|
|
|
unsigned NumUsrs;
|
2018-11-01 19:23:52 +01:00
|
|
|
|
|
2015-03-23 10:35:15 +01:00
|
|
|
|
/***** Get ranking from database *****/
|
2021-05-07 19:11:57 +02:00
|
|
|
|
NumUsrs = Fol_DB_GetRankingFollowers (&mysql_res);
|
2018-11-01 19:23:52 +01:00
|
|
|
|
|
2021-05-07 19:11:57 +02:00
|
|
|
|
/***** Show ranking *****/
|
2018-11-01 19:23:52 +01:00
|
|
|
|
Prf_ShowRankingFigure (&mysql_res,NumUsrs);
|
2015-03-23 10:35:15 +01:00
|
|
|
|
}
|
2015-03-24 00:01:40 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get notification of a new follower ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-08 14:12:33 +01:00
|
|
|
|
void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
2017-01-15 22:58:26 +01:00
|
|
|
|
char **ContentStr)
|
2015-03-24 00:01:40 +01:00
|
|
|
|
{
|
2017-03-06 13:01:16 +01:00
|
|
|
|
SummaryStr[0] = '\0'; // Return nothing on error
|
2015-03-24 00:01:40 +01:00
|
|
|
|
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((*ContentStr = malloc (1)))
|
2017-01-13 10:49:56 +01:00
|
|
|
|
*ContentStr[0] = '\0';
|
2015-03-24 00:01:40 +01:00
|
|
|
|
}
|
2015-12-12 02:01:20 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Remove user from user follow ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
|
|
|
|
{
|
2021-05-07 19:11:57 +02:00
|
|
|
|
/***** Remove user from followers and followed *****/
|
|
|
|
|
Fol_DB_RemoveUsrFromUsrFollow (UsrCod);
|
2019-02-22 14:04:54 +01:00
|
|
|
|
|
|
|
|
|
/***** Flush cache *****/
|
|
|
|
|
Fol_FlushCacheFollow ();
|
2015-12-12 02:01:20 +01:00
|
|
|
|
}
|
2022-01-03 02:47:16 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Get and show number of following and followers ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Fol_GetAndShowFollowStats (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_ANALYTICS_Figures_followed_followers;
|
|
|
|
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
|
|
|
|
extern const char *Txt_Users;
|
|
|
|
|
extern const char *Txt_Number_of_users;
|
|
|
|
|
extern const char *Txt_PERCENT_of_users;
|
|
|
|
|
extern const char *Txt_Followed;
|
|
|
|
|
extern const char *Txt_Followers;
|
|
|
|
|
extern const char *Txt_FollowPerFollow[2];
|
|
|
|
|
unsigned Fol;
|
|
|
|
|
unsigned NumUsrsTotal;
|
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
double Average;
|
|
|
|
|
|
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_FOLLOW],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_ANALYTICS_Figures_followed_followers,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
|
|
|
|
/***** Heading row *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
HTM_TH (Txt_Users ,HTM_HEAD_LEFT);
|
|
|
|
|
HTM_TH (Txt_Number_of_users ,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TH (Txt_PERCENT_of_users,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Get total number of users *****/
|
|
|
|
|
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
|
|
|
|
|
|
|
|
|
|
/***** Get total number of following/followers from database *****/
|
|
|
|
|
for (Fol = 0;
|
|
|
|
|
Fol < 2;
|
|
|
|
|
Fol++)
|
|
|
|
|
{
|
|
|
|
|
NumUsrs = Fol_DB_GetNumFollowinFollowers (Fol);
|
|
|
|
|
|
|
|
|
|
/***** Write number of followed / followers *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Txt (Fol == 0 ? Txt_Followed :
|
|
|
|
|
Txt_Followers);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Unsigned (NumUsrs);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
|
|
|
|
|
(double) NumUsrsTotal :
|
|
|
|
|
0.0);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write number of followed/followers per follower/followed *****/
|
|
|
|
|
for (Fol = 0;
|
|
|
|
|
Fol < 2;
|
|
|
|
|
Fol++)
|
|
|
|
|
{
|
|
|
|
|
Average = Fol_DB_GetNumFollowedPerFollower (Fol);
|
|
|
|
|
|
|
|
|
|
/***** Write number of followed per follower *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Txt (Txt_FollowPerFollow[Fol]);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Double2Decimals (Average);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TD_Empty (1);
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** End table and box *****/
|
|
|
|
|
Box_BoxTableEnd ();
|
|
|
|
|
}
|