mirror of https://github.com/acanas/swad-core.git
Version19.77
This commit is contained in:
parent
be79861298
commit
463b9fba4c
|
@ -0,0 +1 @@
|
||||||
|
<svg aria-hidden="true" data-prefix="fas" data-icon="poll" class="svg-inline--fa fa-poll fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#404040" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM160 368c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16V240c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v128zm96 0c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16V144c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v224zm96 0c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16v-64c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v64z"></path></svg>
|
After Width: | Height: | Size: 631 B |
160
sql/swad.sql
160
sql/swad.sql
|
@ -1081,86 +1081,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
||||||
SearchString VARCHAR(255) NOT NULL DEFAULT '',
|
SearchString VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
SideCols TINYINT NOT NULL DEFAULT 3,
|
SideCols TINYINT NOT NULL DEFAULT 3,
|
||||||
UNIQUE INDEX(SessionId),
|
UNIQUE INDEX(SessionId),
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));--
|
||||||
--
|
|
||||||
-- Table social_comments: stores the content of comments to social notes
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_comments (
|
|
||||||
PubCod BIGINT NOT NULL,
|
|
||||||
Txt LONGTEXT NOT NULL,
|
|
||||||
MedCod INT NOT NULL DEFAULT -1,
|
|
||||||
UNIQUE INDEX(PubCod),
|
|
||||||
FULLTEXT(Txt),
|
|
||||||
INDEX(MedCod)) ENGINE = MYISAM;
|
|
||||||
--
|
|
||||||
-- Table social_comments_fav: stores users who marked social comments as favourite
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_comments_fav (
|
|
||||||
FavCod BIGINT AUTO_INCREMENT,
|
|
||||||
PubCod BIGINT NOT NULL,
|
|
||||||
UsrCod INT NOT NULL,
|
|
||||||
TimeFav DATETIME NOT NULL,
|
|
||||||
UNIQUE INDEX(FavCod),
|
|
||||||
UNIQUE INDEX(PubCod,UsrCod),
|
|
||||||
INDEX(UsrCod));
|
|
||||||
--
|
|
||||||
-- Table social_notes: stores social notes
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_notes (
|
|
||||||
NotCod BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
NoteType TINYINT NOT NULL,
|
|
||||||
Cod INT NOT NULL DEFAULT -1,
|
|
||||||
UsrCod INT NOT NULL,
|
|
||||||
HieCod INT NOT NULL DEFAULT -1,
|
|
||||||
Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',
|
|
||||||
TimeNote DATETIME NOT NULL,
|
|
||||||
UNIQUE INDEX(NotCod),
|
|
||||||
INDEX(NoteType,Cod),
|
|
||||||
INDEX(UsrCod),
|
|
||||||
INDEX(TimeNote));
|
|
||||||
--
|
|
||||||
-- Table social_notes_fav: stores users who marked social notes as favourite
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_notes_fav (
|
|
||||||
FavCod BIGINT AUTO_INCREMENT,
|
|
||||||
NotCod BIGINT NOT NULL,
|
|
||||||
UsrCod INT NOT NULL,
|
|
||||||
TimeFav DATETIME NOT NULL,
|
|
||||||
UNIQUE INDEX(FavCod),
|
|
||||||
UNIQUE INDEX(NotCod,UsrCod),
|
|
||||||
INDEX(UsrCod));
|
|
||||||
--
|
|
||||||
-- Table social_posts: stores social posts (public comments written by users)
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_posts (
|
|
||||||
PstCod INT NOT NULL AUTO_INCREMENT,
|
|
||||||
Content LONGTEXT NOT NULL,
|
|
||||||
MedCod INT NOT NULL DEFAULT -1,
|
|
||||||
UNIQUE INDEX(PstCod),
|
|
||||||
FULLTEXT(Content),
|
|
||||||
INDEX(MedCod)) ENGINE = MYISAM;
|
|
||||||
--
|
|
||||||
-- Table social_pubs: stores social publishings (original notes, sharede notes or comments)
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_pubs (
|
|
||||||
PubCod BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
NotCod BIGINT NOT NULL,
|
|
||||||
PublisherCod INT NOT NULL,
|
|
||||||
PubType TINYINT NOT NULL,
|
|
||||||
TimePublish DATETIME NOT NULL,
|
|
||||||
UNIQUE INDEX(PubCod),
|
|
||||||
INDEX(NotCod,PublisherCod,PubType),
|
|
||||||
INDEX(PublisherCod),
|
|
||||||
INDEX(PubType),
|
|
||||||
INDEX(TimePublish));
|
|
||||||
--
|
|
||||||
-- Table social_timelines: stores notes published in social timeline for every active session
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_timelines (
|
|
||||||
SessionId CHAR(43) NOT NULL,
|
|
||||||
NotCod BIGINT NOT NULL,
|
|
||||||
UNIQUE INDEX(SessionId,NotCod));
|
|
||||||
--
|
|
||||||
-- Table sta_degrees: stores statistics about degrees
|
-- Table sta_degrees: stores statistics about degrees
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS sta_degrees (
|
CREATE TABLE IF NOT EXISTS sta_degrees (
|
||||||
|
@ -1254,6 +1175,85 @@ CREATE TABLE IF NOT EXISTS timetable_tut (
|
||||||
Duration TIME NOT NULL,
|
Duration TIME NOT NULL,
|
||||||
Info VARCHAR(2047) NOT NULL DEFAULT '',
|
Info VARCHAR(2047) NOT NULL DEFAULT '',
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table tl_comments: stores the content of comments to timeline notes
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_comments (
|
||||||
|
PubCod BIGINT NOT NULL,
|
||||||
|
Txt LONGTEXT NOT NULL,
|
||||||
|
MedCod INT NOT NULL DEFAULT -1,
|
||||||
|
UNIQUE INDEX(PubCod),
|
||||||
|
FULLTEXT(Txt),
|
||||||
|
INDEX(MedCod)) ENGINE = MYISAM;
|
||||||
|
--
|
||||||
|
-- Table tl_comments_fav: stores users who marked timeline comments as favourite
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_comments_fav (
|
||||||
|
FavCod BIGINT AUTO_INCREMENT,
|
||||||
|
PubCod BIGINT NOT NULL,
|
||||||
|
UsrCod INT NOT NULL,
|
||||||
|
TimeFav DATETIME NOT NULL,
|
||||||
|
UNIQUE INDEX(FavCod),
|
||||||
|
UNIQUE INDEX(PubCod,UsrCod),
|
||||||
|
INDEX(UsrCod));
|
||||||
|
--
|
||||||
|
-- Table tl_notes: stores timeline notes
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_notes (
|
||||||
|
NotCod BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
NoteType TINYINT NOT NULL,
|
||||||
|
Cod INT NOT NULL DEFAULT -1,
|
||||||
|
UsrCod INT NOT NULL,
|
||||||
|
HieCod INT NOT NULL DEFAULT -1,
|
||||||
|
Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||||
|
TimeNote DATETIME NOT NULL,
|
||||||
|
UNIQUE INDEX(NotCod),
|
||||||
|
INDEX(NoteType,Cod),
|
||||||
|
INDEX(UsrCod),
|
||||||
|
INDEX(TimeNote));
|
||||||
|
--
|
||||||
|
-- Table tl_notes_fav: stores users who marked timeline notes as favourite
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_notes_fav (
|
||||||
|
FavCod BIGINT AUTO_INCREMENT,
|
||||||
|
NotCod BIGINT NOT NULL,
|
||||||
|
UsrCod INT NOT NULL,
|
||||||
|
TimeFav DATETIME NOT NULL,
|
||||||
|
UNIQUE INDEX(FavCod),
|
||||||
|
UNIQUE INDEX(NotCod,UsrCod),
|
||||||
|
INDEX(UsrCod));
|
||||||
|
--
|
||||||
|
-- Table tl_posts: stores timeline posts (public comments written by users)
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_posts (
|
||||||
|
PstCod INT NOT NULL AUTO_INCREMENT,
|
||||||
|
Content LONGTEXT NOT NULL,
|
||||||
|
MedCod INT NOT NULL DEFAULT -1,
|
||||||
|
UNIQUE INDEX(PstCod),
|
||||||
|
FULLTEXT(Content),
|
||||||
|
INDEX(MedCod)) ENGINE = MYISAM;
|
||||||
|
--
|
||||||
|
-- Table tl_pubs: stores timeline publications (original notes, sharede notes or comments)
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_pubs (
|
||||||
|
PubCod BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
NotCod BIGINT NOT NULL,
|
||||||
|
PublisherCod INT NOT NULL,
|
||||||
|
PubType TINYINT NOT NULL,
|
||||||
|
TimePublish DATETIME NOT NULL,
|
||||||
|
UNIQUE INDEX(PubCod),
|
||||||
|
INDEX(NotCod,PublisherCod,PubType),
|
||||||
|
INDEX(PublisherCod),
|
||||||
|
INDEX(PubType),
|
||||||
|
INDEX(TimePublish));
|
||||||
|
--
|
||||||
|
-- Table tl_timelines: stores notes published in timeline for every active session
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS tl_timelines (
|
||||||
|
SessionId CHAR(43) NOT NULL,
|
||||||
|
NotCod BIGINT NOT NULL,
|
||||||
|
UNIQUE INDEX(SessionId,NotCod));
|
||||||
--
|
--
|
||||||
-- Table tst_answers: stores the answers to the questions in tests
|
-- Table tst_answers: stores the answers to the questions in tests
|
||||||
--
|
--
|
||||||
|
|
|
@ -490,7 +490,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.76.8 (2019-11-25)"
|
#define Log_PLATFORM_VERSION "SWAD 19.77 (2019-11-25)"
|
||||||
#define CSS_FILE "swad19.74.3.css"
|
#define CSS_FILE "swad19.74.3.css"
|
||||||
#define JS_FILE "swad19.70.js"
|
#define JS_FILE "swad19.70.js"
|
||||||
/*
|
/*
|
||||||
|
@ -498,6 +498,18 @@ ps2pdf source.ps destination.pdf
|
||||||
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
||||||
// TODO: En cada juego, poder listar los resultados en una tabla como la de resultados globales
|
// TODO: En cada juego, poder listar los resultados en una tabla como la de resultados globales
|
||||||
|
|
||||||
|
Version 19.77: Nov 25, 2019 Changes in database related to timeline. (246877 lines)
|
||||||
|
7 changes necessary in database:
|
||||||
|
RENAME TABLE social_comments TO tl_comments;
|
||||||
|
RENAME TABLE social_comments_fav TO tl_comments_fav;
|
||||||
|
RENAME TABLE social_notes TO tl_notes;
|
||||||
|
RENAME TABLE social_notes_fav TO tl_notes_fav;
|
||||||
|
RENAME TABLE social_posts TO tl_posts;
|
||||||
|
RENAME TABLE social_pubs TO tl_pubs;
|
||||||
|
RENAME TABLE social_timelines TO tl_timelines;
|
||||||
|
Copy the following icon to icon public directory:
|
||||||
|
sudo cp -a icon/poll.svg /var/www/html/swad/icon/
|
||||||
|
|
||||||
Version 19.76.8: Nov 25, 2019 Changes in database related to timeline. (246885 lines)
|
Version 19.76.8: Nov 25, 2019 Changes in database related to timeline. (246885 lines)
|
||||||
4 changes necessary in database:
|
4 changes necessary in database:
|
||||||
ALTER TABLE social_comments CHANGE COLUMN Content Txt LONGTEXT NOT NULL,DROP FULLTEXT Content,ADD FULLTEXT (Txt);
|
ALTER TABLE social_comments CHANGE COLUMN Content Txt LONGTEXT NOT NULL,DROP FULLTEXT Content,ADD FULLTEXT (Txt);
|
||||||
|
@ -696,7 +708,7 @@ INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1803','es','N','Conf
|
||||||
Version 19.42.6: Oct 24, 2019 Code refactoring in CSS.
|
Version 19.42.6: Oct 24, 2019 Code refactoring in CSS.
|
||||||
Changes icon to upload file in timeline.
|
Changes icon to upload file in timeline.
|
||||||
Code refactoring in media. (246034 lines)
|
Code refactoring in media. (246034 lines)
|
||||||
Copy the following 4 icons to icon public directory:
|
Copy the following icon to icon public directory:
|
||||||
sudo cp -a icon/photo-video.svg /var/www/html/swad/icon/
|
sudo cp -a icon/photo-video.svg /var/www/html/swad/icon/
|
||||||
|
|
||||||
Version 19.42.5: Oct 24, 2019 Code refactoring in contextual menus. (246011 lines)
|
Version 19.42.5: Oct 24, 2019 Code refactoring in contextual menus. (246011 lines)
|
||||||
|
|
310
swad_database.c
310
swad_database.c
|
@ -2307,161 +2307,6 @@ mysql> DESCRIBE sessions;
|
||||||
"UNIQUE INDEX(SessionId),"
|
"UNIQUE INDEX(SessionId),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table social_comments *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_comments;
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
| PubCod | bigint(20) | NO | PRI | NULL | |
|
|
||||||
| Txt | longtext | NO | MUL | NULL | |
|
|
||||||
| MedCod | int(11) | NO | MUL | -1 | |
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
3 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments ("
|
|
||||||
"PubCod BIGINT NOT NULL,"
|
|
||||||
"Content Txt NOT NULL,"
|
|
||||||
"MedCod INT NOT NULL DEFAULT -1,"
|
|
||||||
"UNIQUE INDEX(PubCod),"
|
|
||||||
"FULLTEXT(Txt),"
|
|
||||||
"INDEX(MedCod)) ENGINE = MYISAM;");
|
|
||||||
|
|
||||||
/***** Table social_comments_fav *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_comments_fav;
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
| FavCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
|
||||||
| PubCod | bigint(20) | NO | MUL | NULL | |
|
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| TimeFav | datetime | NO | | NULL | |
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
4 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments_fav ("
|
|
||||||
"FavCod BIGINT AUTO_INCREMENT,"
|
|
||||||
"PubCod BIGINT NOT NULL,"
|
|
||||||
"UsrCod INT NOT NULL,"
|
|
||||||
"TimeFav DATETIME NOT NULL," // Not used. For future use
|
|
||||||
"UNIQUE INDEX(FavCod),"
|
|
||||||
"UNIQUE INDEX(PubCod,UsrCod),"
|
|
||||||
"INDEX(UsrCod))");
|
|
||||||
|
|
||||||
/***** Table social_notes *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_notes;
|
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
|
||||||
| NotCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
|
||||||
| NoteType | tinyint(4) | NO | MUL | NULL | |
|
|
||||||
| Cod | int(11) | NO | | -1 | |
|
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| HieCod | int(11) | NO | | -1 | |
|
|
||||||
| Unavailable | enum('N','Y') | NO | | N | |
|
|
||||||
| TimeNote | datetime | NO | MUL | NULL | |
|
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
|
||||||
7 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes ("
|
|
||||||
"NotCod BIGINT NOT NULL AUTO_INCREMENT,"
|
|
||||||
"NoteType TINYINT NOT NULL,"
|
|
||||||
"Cod INT NOT NULL DEFAULT -1,"
|
|
||||||
"UsrCod INT NOT NULL,"
|
|
||||||
"HieCod INT NOT NULL DEFAULT -1,"
|
|
||||||
"Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
|
||||||
"TimeNote DATETIME NOT NULL,"
|
|
||||||
"UNIQUE INDEX(NotCod),"
|
|
||||||
"INDEX(NoteType,Cod),"
|
|
||||||
"INDEX(UsrCod),"
|
|
||||||
"INDEX(TimeNote))");
|
|
||||||
|
|
||||||
/***** Table social_notes_fav *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_notes_fav;
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
| FavCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
|
||||||
| NotCod | bigint(20) | NO | MUL | NULL | |
|
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| TimeFav | datetime | NO | | NULL | |
|
|
||||||
+---------+------------+------+-----+---------+----------------+
|
|
||||||
4 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes_fav ("
|
|
||||||
"FavCod BIGINT AUTO_INCREMENT,"
|
|
||||||
"NotCod BIGINT NOT NULL,"
|
|
||||||
"UsrCod INT NOT NULL,"
|
|
||||||
"TimeFav DATETIME NOT NULL," // Not used. For future use
|
|
||||||
"UNIQUE INDEX(FavCod),"
|
|
||||||
"UNIQUE INDEX(NotCod,UsrCod),"
|
|
||||||
"INDEX(UsrCod))");
|
|
||||||
|
|
||||||
/***** Table social_posts *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_posts;
|
|
||||||
+--------+----------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+--------+----------+------+-----+---------+----------------+
|
|
||||||
| PstCod | int(11) | NO | PRI | NULL | auto_increment |
|
|
||||||
| Txt | longtext | NO | MUL | NULL | |
|
|
||||||
| MedCod | int(11) | NO | MUL | -1 | |
|
|
||||||
+--------+----------+------+-----+---------+----------------+
|
|
||||||
3 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_posts ("
|
|
||||||
"PubCod INT NOT NULL AUTO_INCREMENT,"
|
|
||||||
"Txt LONGTEXT NOT NULL,"
|
|
||||||
"MedCod INT NOT NULL DEFAULT -1,"
|
|
||||||
"UNIQUE INDEX(PubCod),"
|
|
||||||
"FULLTEXT(Txt),"
|
|
||||||
"INDEX(MedCod)) ENGINE = MYISAM;");
|
|
||||||
|
|
||||||
/***** Table social_pubs *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_pubs;
|
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
|
||||||
| PubCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
|
||||||
| NotCod | bigint(20) | NO | MUL | NULL | |
|
|
||||||
| PublisherCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| PubType | tinyint(4) | NO | MUL | NULL | |
|
|
||||||
| TimePublish | datetime | NO | MUL | NULL | |
|
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
|
||||||
5 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_pubs ("
|
|
||||||
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
|
||||||
"NotCod BIGINT NOT NULL,"
|
|
||||||
"PublisherCod INT NOT NULL,"
|
|
||||||
"PubType TINYINT NOT NULL,"
|
|
||||||
"TimePublish DATETIME NOT NULL,"
|
|
||||||
"UNIQUE INDEX(PubCod),"
|
|
||||||
"INDEX(NotCod,PublisherCod,PubType),"
|
|
||||||
"INDEX(PublisherCod),"
|
|
||||||
"INDEX(PubType),"
|
|
||||||
"INDEX(TimePublish))");
|
|
||||||
|
|
||||||
/***** Table social_timelines *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_timelines;
|
|
||||||
+-----------+------------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+-----------+------------+------+-----+---------+-------+
|
|
||||||
| SessionId | char(43) | NO | PRI | NULL | |
|
|
||||||
| NotCod | bigint(20) | NO | PRI | NULL | |
|
|
||||||
+-----------+------------+------+-----+---------+-------+
|
|
||||||
2 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_timelines ("
|
|
||||||
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
|
||||||
"NotCod BIGINT NOT NULL,"
|
|
||||||
"UNIQUE INDEX(SessionId,NotCod))");
|
|
||||||
|
|
||||||
/***** Table sta_degrees *****/
|
/***** Table sta_degrees *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE sta_degrees;
|
mysql> DESCRIBE sta_degrees;
|
||||||
|
@ -2668,6 +2513,161 @@ mysql> DESCRIBE timetable_tut;
|
||||||
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
|
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
|
/***** Table tl_comments *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_comments;
|
||||||
|
+--------+------------+------+-----+---------+-------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+--------+------------+------+-----+---------+-------+
|
||||||
|
| PubCod | bigint(20) | NO | PRI | NULL | |
|
||||||
|
| Txt | longtext | NO | MUL | NULL | |
|
||||||
|
| MedCod | int(11) | NO | MUL | -1 | |
|
||||||
|
+--------+------------+------+-----+---------+-------+
|
||||||
|
3 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_comments ("
|
||||||
|
"PubCod BIGINT NOT NULL,"
|
||||||
|
"Content Txt NOT NULL,"
|
||||||
|
"MedCod INT NOT NULL DEFAULT -1,"
|
||||||
|
"UNIQUE INDEX(PubCod),"
|
||||||
|
"FULLTEXT(Txt),"
|
||||||
|
"INDEX(MedCod)) ENGINE = MYISAM;");
|
||||||
|
|
||||||
|
/***** Table tl_comments_fav *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_comments_fav;
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
| FavCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
|
| PubCod | bigint(20) | NO | MUL | NULL | |
|
||||||
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
|
| TimeFav | datetime | NO | | NULL | |
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
4 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_comments_fav ("
|
||||||
|
"FavCod BIGINT AUTO_INCREMENT,"
|
||||||
|
"PubCod BIGINT NOT NULL,"
|
||||||
|
"UsrCod INT NOT NULL,"
|
||||||
|
"TimeFav DATETIME NOT NULL," // Not used. For future use
|
||||||
|
"UNIQUE INDEX(FavCod),"
|
||||||
|
"UNIQUE INDEX(PubCod,UsrCod),"
|
||||||
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
|
/***** Table tl_notes *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_notes;
|
||||||
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
|
| NotCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
|
| NoteType | tinyint(4) | NO | MUL | NULL | |
|
||||||
|
| Cod | int(11) | NO | | -1 | |
|
||||||
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
|
| HieCod | int(11) | NO | | -1 | |
|
||||||
|
| Unavailable | enum('N','Y') | NO | | N | |
|
||||||
|
| TimeNote | datetime | NO | MUL | NULL | |
|
||||||
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
|
7 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_notes ("
|
||||||
|
"NotCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
|
"NoteType TINYINT NOT NULL,"
|
||||||
|
"Cod INT NOT NULL DEFAULT -1,"
|
||||||
|
"UsrCod INT NOT NULL,"
|
||||||
|
"HieCod INT NOT NULL DEFAULT -1,"
|
||||||
|
"Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
|
"TimeNote DATETIME NOT NULL,"
|
||||||
|
"UNIQUE INDEX(NotCod),"
|
||||||
|
"INDEX(NoteType,Cod),"
|
||||||
|
"INDEX(UsrCod),"
|
||||||
|
"INDEX(TimeNote))");
|
||||||
|
|
||||||
|
/***** Table tl_notes_fav *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_notes_fav;
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
| FavCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
|
| NotCod | bigint(20) | NO | MUL | NULL | |
|
||||||
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
|
| TimeFav | datetime | NO | | NULL | |
|
||||||
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
4 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_notes_fav ("
|
||||||
|
"FavCod BIGINT AUTO_INCREMENT,"
|
||||||
|
"NotCod BIGINT NOT NULL,"
|
||||||
|
"UsrCod INT NOT NULL,"
|
||||||
|
"TimeFav DATETIME NOT NULL," // Not used. For future use
|
||||||
|
"UNIQUE INDEX(FavCod),"
|
||||||
|
"UNIQUE INDEX(NotCod,UsrCod),"
|
||||||
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
|
/***** Table tl_posts *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_posts;
|
||||||
|
+--------+----------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+--------+----------+------+-----+---------+----------------+
|
||||||
|
| PstCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||||
|
| Txt | longtext | NO | MUL | NULL | |
|
||||||
|
| MedCod | int(11) | NO | MUL | -1 | |
|
||||||
|
+--------+----------+------+-----+---------+----------------+
|
||||||
|
3 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_posts ("
|
||||||
|
"PubCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
|
"Txt LONGTEXT NOT NULL,"
|
||||||
|
"MedCod INT NOT NULL DEFAULT -1,"
|
||||||
|
"UNIQUE INDEX(PubCod),"
|
||||||
|
"FULLTEXT(Txt),"
|
||||||
|
"INDEX(MedCod)) ENGINE = MYISAM;");
|
||||||
|
|
||||||
|
/***** Table tl_pubs *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_pubs;
|
||||||
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
|
| PubCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
|
| NotCod | bigint(20) | NO | MUL | NULL | |
|
||||||
|
| PublisherCod | int(11) | NO | MUL | NULL | |
|
||||||
|
| PubType | tinyint(4) | NO | MUL | NULL | |
|
||||||
|
| TimePublish | datetime | NO | MUL | NULL | |
|
||||||
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
|
5 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_pubs ("
|
||||||
|
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
|
"NotCod BIGINT NOT NULL,"
|
||||||
|
"PublisherCod INT NOT NULL,"
|
||||||
|
"PubType TINYINT NOT NULL,"
|
||||||
|
"TimePublish DATETIME NOT NULL,"
|
||||||
|
"UNIQUE INDEX(PubCod),"
|
||||||
|
"INDEX(NotCod,PublisherCod,PubType),"
|
||||||
|
"INDEX(PublisherCod),"
|
||||||
|
"INDEX(PubType),"
|
||||||
|
"INDEX(TimePublish))");
|
||||||
|
|
||||||
|
/***** Table tl_timelines *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE tl_timelines;
|
||||||
|
+-----------+------------+------+-----+---------+-------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+-----------+------------+------+-----+---------+-------+
|
||||||
|
| SessionId | char(43) | NO | PRI | NULL | |
|
||||||
|
| NotCod | bigint(20) | NO | PRI | NULL | |
|
||||||
|
+-----------+------------+------+-----+---------+-------+
|
||||||
|
2 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_timelines ("
|
||||||
|
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
||||||
|
"NotCod BIGINT NOT NULL,"
|
||||||
|
"UNIQUE INDEX(SessionId,NotCod))");
|
||||||
|
|
||||||
/***** Table tst_answers *****/
|
/***** Table tst_answers *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tst_answers;
|
mysql> DESCRIBE tst_answers;
|
||||||
|
|
136
swad_figure.c
136
swad_figure.c
|
@ -150,7 +150,7 @@ static void Fig_GetAndShowProjectsStats (void);
|
||||||
static void Fig_GetAndShowTestsStats (void);
|
static void Fig_GetAndShowTestsStats (void);
|
||||||
static void Fig_GetAndShowGamesStats (void);
|
static void Fig_GetAndShowGamesStats (void);
|
||||||
|
|
||||||
static void Fig_GetAndShowSocialActivityStats (void);
|
static void Fig_GetAndShowTimelineActivityStats (void);
|
||||||
static void Fig_GetAndShowFollowStats (void);
|
static void Fig_GetAndShowFollowStats (void);
|
||||||
|
|
||||||
static void Fig_GetAndShowForumStats (void);
|
static void Fig_GetAndShowForumStats (void);
|
||||||
|
@ -320,7 +320,7 @@ void Fig_ShowFigures (void)
|
||||||
Fig_GetAndShowTestsStats, // Fig_TESTS
|
Fig_GetAndShowTestsStats, // Fig_TESTS
|
||||||
Fig_GetAndShowGamesStats, // Fig_GAMES
|
Fig_GetAndShowGamesStats, // Fig_GAMES
|
||||||
Fig_GetAndShowSurveysStats, // Fig_SURVEYS
|
Fig_GetAndShowSurveysStats, // Fig_SURVEYS
|
||||||
Fig_GetAndShowSocialActivityStats, // Fig_SOCIAL_ACTIVITY
|
Fig_GetAndShowTimelineActivityStats, // Fig_SOCIAL_ACTIVITY
|
||||||
Fig_GetAndShowFollowStats, // Fig_FOLLOW
|
Fig_GetAndShowFollowStats, // Fig_FOLLOW
|
||||||
Fig_GetAndShowForumStats, // Fig_FORUMS
|
Fig_GetAndShowForumStats, // Fig_FORUMS
|
||||||
Fig_GetAndShowNumUsrsPerNotifyEvent, // Fig_NOTIFY_EVENTS
|
Fig_GetAndShowNumUsrsPerNotifyEvent, // Fig_NOTIFY_EVENTS
|
||||||
|
@ -3248,15 +3248,15 @@ static void Fig_GetAndShowGamesStats (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Get and show number of social notes ********************/
|
/******************* Get and show number of timeline notes *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Fig_GetAndShowSocialActivityStats (void)
|
static void Fig_GetAndShowTimelineActivityStats (void)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ANALYTICS_Figures_timeline;
|
extern const char *Hlp_ANALYTICS_Figures_timeline;
|
||||||
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
||||||
extern const char *Txt_Type;
|
extern const char *Txt_Type;
|
||||||
extern const char *Txt_No_of_social_posts;
|
extern const char *Txt_No_of_posts;
|
||||||
extern const char *Txt_No_of_users;
|
extern const char *Txt_No_of_users;
|
||||||
extern const char *Txt_PERCENT_of_users;
|
extern const char *Txt_PERCENT_of_users;
|
||||||
extern const char *Txt_No_of_posts_BR_per_user;
|
extern const char *Txt_No_of_posts_BR_per_user;
|
||||||
|
@ -3265,7 +3265,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
TL_NoteType_t NoteType;
|
TL_NoteType_t NoteType;
|
||||||
unsigned long NumSocialNotes;
|
unsigned long NumNotes;
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
unsigned NumUsrsTotal;
|
unsigned NumUsrsTotal;
|
||||||
|
@ -3278,7 +3278,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (1,1,"LM",Txt_Type);
|
HTM_TH (1,1,"LM",Txt_Type);
|
||||||
HTM_TH (1,1,"RM",Txt_No_of_social_posts);
|
HTM_TH (1,1,"RM",Txt_No_of_posts);
|
||||||
HTM_TH (1,1,"RM",Txt_No_of_users);
|
HTM_TH (1,1,"RM",Txt_No_of_users);
|
||||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||||
HTM_TH (1,1,"RM",Txt_No_of_posts_BR_per_user);
|
HTM_TH (1,1,"RM",Txt_No_of_posts_BR_per_user);
|
||||||
|
@ -3287,10 +3287,10 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
|
|
||||||
/***** Get total number of users *****/
|
/***** Get total number of users *****/
|
||||||
NumUsrsTotal = (Gbl.Scope.Current == Hie_SYS) ? Usr_GetTotalNumberOfUsersInPlatform () :
|
NumUsrsTotal = (Gbl.Scope.Current == Hie_SYS) ? Usr_GetTotalNumberOfUsersInPlatform () :
|
||||||
Usr_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,
|
Usr_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,
|
||||||
1 << Rol_STD |
|
1 << Rol_STD |
|
||||||
1 << Rol_NET |
|
1 << Rol_NET |
|
||||||
1 << Rol_TCH);
|
1 << Rol_TCH);
|
||||||
|
|
||||||
/***** Get total number of following/followers from database *****/
|
/***** Get total number of following/followers from database *****/
|
||||||
for (NoteType = (TL_NoteType_t) 0;
|
for (NoteType = (TL_NoteType_t) 0;
|
||||||
|
@ -3303,71 +3303,71 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(*),"
|
"SELECT COUNT(*),"
|
||||||
"COUNT(DISTINCT UsrCod)"
|
"COUNT(DISTINCT UsrCod)"
|
||||||
" FROM social_notes WHERE NoteType=%u",
|
" FROM tl_notes WHERE NoteType=%u",
|
||||||
NoteType);
|
NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_CTY:
|
case Hie_CTY:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr,social_notes"
|
" FROM institutions,centres,degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE institutions.CtyCod=%ld"
|
" WHERE institutions.CtyCod=%ld"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod"
|
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
||||||
" AND social_notes.NoteType=%u",
|
" AND tl_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Cty.CtyCod,
|
Gbl.Hierarchy.Cty.CtyCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_INS:
|
case Hie_INS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr,social_notes"
|
" FROM centres,degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE centres.InsCod=%ld"
|
" WHERE centres.InsCod=%ld"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod"
|
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
||||||
" AND social_notes.NoteType=%u",
|
" AND tl_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Ins.InsCod,
|
Gbl.Hierarchy.Ins.InsCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_CTR:
|
case Hie_CTR:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr,social_notes"
|
" FROM degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE degrees.CtrCod=%ld"
|
" WHERE degrees.CtrCod=%ld"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod"
|
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
||||||
" AND social_notes.NoteType=%u",
|
" AND tl_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Ctr.CtrCod,
|
Gbl.Hierarchy.Ctr.CtrCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_DEG:
|
case Hie_DEG:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM courses,crs_usr,social_notes"
|
" FROM courses,crs_usr,tl_notes"
|
||||||
" WHERE courses.DegCod=%ld"
|
" WHERE courses.DegCod=%ld"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod"
|
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
||||||
" AND social_notes.NoteType=%u",
|
" AND tl_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
Gbl.Hierarchy.Deg.DegCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_CRS:
|
case Hie_CRS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM crs_usr,social_notes"
|
" FROM crs_usr,tl_notes"
|
||||||
" WHERE crs_usr.CrsCod=%ld"
|
" WHERE crs_usr.CrsCod=%ld"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod"
|
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
||||||
" AND social_notes.NoteType=%u",
|
" AND tl_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
|
@ -3376,7 +3376,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
NumRows = 0; // Initialized to avoid warning
|
NumRows = 0; // Initialized to avoid warning
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NumSocialNotes = 0;
|
NumNotes = 0;
|
||||||
NumUsrs = 0;
|
NumUsrs = 0;
|
||||||
|
|
||||||
if (NumRows)
|
if (NumRows)
|
||||||
|
@ -3386,8 +3386,8 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
|
|
||||||
/* Get number of social notes */
|
/* Get number of social notes */
|
||||||
if (row[0])
|
if (row[0])
|
||||||
if (sscanf (row[0],"%lu",&NumSocialNotes) != 1)
|
if (sscanf (row[0],"%lu",&NumNotes) != 1)
|
||||||
NumSocialNotes = 0;
|
NumNotes = 0;
|
||||||
|
|
||||||
/* Get number of users */
|
/* Get number of users */
|
||||||
if (row[1])
|
if (row[1])
|
||||||
|
@ -3406,7 +3406,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||||
HTM_UnsignedLong (NumSocialNotes);
|
HTM_UnsignedLong (NumNotes);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||||
|
@ -3420,7 +3420,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||||
HTM_Double (NumUsrs ? (double) NumSocialNotes / (double) NumUsrs :
|
HTM_Double (NumUsrs ? (double) NumNotes / (double) NumUsrs :
|
||||||
0.0);
|
0.0);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -3434,61 +3434,61 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(*),"
|
"SELECT COUNT(*),"
|
||||||
"COUNT(DISTINCT UsrCod)"
|
"COUNT(DISTINCT UsrCod)"
|
||||||
" FROM social_notes");
|
" FROM tl_notes");
|
||||||
break;
|
break;
|
||||||
case Hie_CTY:
|
case Hie_CTY:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr,social_notes"
|
" FROM institutions,centres,degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE institutions.CtyCod=%ld"
|
" WHERE institutions.CtyCod=%ld"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod",
|
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
break;
|
break;
|
||||||
case Hie_INS:
|
case Hie_INS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr,social_notes"
|
" FROM centres,degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE centres.InsCod=%ld"
|
" WHERE centres.InsCod=%ld"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod",
|
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Ins.InsCod);
|
Gbl.Hierarchy.Ins.InsCod);
|
||||||
break;
|
break;
|
||||||
case Hie_CTR:
|
case Hie_CTR:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr,social_notes"
|
" FROM degrees,courses,crs_usr,tl_notes"
|
||||||
" WHERE degrees.CtrCod=%ld"
|
" WHERE degrees.CtrCod=%ld"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod",
|
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Ctr.CtrCod);
|
Gbl.Hierarchy.Ctr.CtrCod);
|
||||||
break;
|
break;
|
||||||
case Hie_DEG:
|
case Hie_DEG:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM courses,crs_usr,social_notes"
|
" FROM courses,crs_usr,tl_notes"
|
||||||
" WHERE courses.DegCod=%ld"
|
" WHERE courses.DegCod=%ld"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod",
|
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Deg.DegCod);
|
Gbl.Hierarchy.Deg.DegCod);
|
||||||
break;
|
break;
|
||||||
case Hie_CRS:
|
case Hie_CRS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT social_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
||||||
"COUNT(DISTINCT social_notes.UsrCod)"
|
"COUNT(DISTINCT tl_notes.UsrCod)"
|
||||||
" FROM crs_usr,social_notes"
|
" FROM crs_usr,tl_notes"
|
||||||
" WHERE crs_usr.CrsCod=%ld"
|
" WHERE crs_usr.CrsCod=%ld"
|
||||||
" AND crs_usr.UsrCod=social_notes.UsrCod",
|
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3496,7 +3496,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
NumRows = 0; // Initialized to avoid warning
|
NumRows = 0; // Initialized to avoid warning
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NumSocialNotes = 0;
|
NumNotes = 0;
|
||||||
NumUsrs = 0;
|
NumUsrs = 0;
|
||||||
|
|
||||||
if (NumRows)
|
if (NumRows)
|
||||||
|
@ -3506,8 +3506,8 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
|
|
||||||
/* Get number of social notes */
|
/* Get number of social notes */
|
||||||
if (row[0])
|
if (row[0])
|
||||||
if (sscanf (row[0],"%lu",&NumSocialNotes) != 1)
|
if (sscanf (row[0],"%lu",&NumNotes) != 1)
|
||||||
NumSocialNotes = 0;
|
NumNotes = 0;
|
||||||
|
|
||||||
/* Get number of users */
|
/* Get number of users */
|
||||||
if (row[1])
|
if (row[1])
|
||||||
|
@ -3526,7 +3526,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
||||||
HTM_UnsignedLong (NumSocialNotes);
|
HTM_UnsignedLong (NumNotes);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
||||||
|
@ -3540,7 +3540,7 @@ static void Fig_GetAndShowSocialActivityStats (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
|
||||||
HTM_Double (NumUsrs ? (double) NumSocialNotes / (double) NumUsrs :
|
HTM_Double (NumUsrs ? (double) NumNotes / (double) NumUsrs :
|
||||||
0.0);
|
0.0);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
|
|
@ -1288,9 +1288,9 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
// Cod is the code of the social publishing
|
// Cod is the code of the social publishing
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
||||||
" to be notified",
|
" to be notified",
|
||||||
"SELECT DISTINCT(PublisherCod) FROM social_pubs"
|
"SELECT DISTINCT(PublisherCod) FROM tl_pubs"
|
||||||
" WHERE NotCod ="
|
" WHERE NotCod="
|
||||||
" (SELECT NotCod FROM social_pubs"
|
"(SELECT NotCod FROM tl_pubs"
|
||||||
" WHERE PubCod=%ld)"
|
" WHERE PubCod=%ld)"
|
||||||
" AND PublisherCod<>%ld",
|
" AND PublisherCod<>%ld",
|
||||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
21
swad_text.c
21
swad_text.c
|
@ -25511,27 +25511,6 @@ const char *Txt_No_of_questions =
|
||||||
"Nº de questões";
|
"Nº de questões";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_No_of_social_posts =
|
|
||||||
#if L==1 // ca
|
|
||||||
"Nombre de missatges socials";
|
|
||||||
#elif L==2 // de
|
|
||||||
"Anzahl der sozialen Beiträge";
|
|
||||||
#elif L==3 // en
|
|
||||||
"No. of social posts";
|
|
||||||
#elif L==4 // es
|
|
||||||
"Nº de mensajes sociales";
|
|
||||||
#elif L==5 // fr
|
|
||||||
"Nombre de messages sociaux";
|
|
||||||
#elif L==6 // gn
|
|
||||||
"Nº de mensajes sociales"; // Okoteve traducción
|
|
||||||
#elif L==7 // it
|
|
||||||
"Numero di post sociali";
|
|
||||||
#elif L==8 // pl
|
|
||||||
"Liczba post społecznej";
|
|
||||||
#elif L==9 // pt
|
|
||||||
"Nº de post sociais";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *Txt_No_of_threads =
|
const char *Txt_No_of_threads =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Nº de discusiones"; // Necessita traduccio
|
"Nº de discusiones"; // Necessita traduccio
|
||||||
|
|
312
swad_timeline.c
312
swad_timeline.c
|
@ -128,7 +128,7 @@ struct TL_Note
|
||||||
long HieCod; // Hierarchy code (institution/centre/degree/course)
|
long HieCod; // Hierarchy code (institution/centre/degree/course)
|
||||||
long Cod; // Code of file, forum post, notice, timeline post...
|
long Cod; // Code of file, forum post, notice, timeline post...
|
||||||
bool Unavailable; // File, forum post, notice,... unavailable (removed)
|
bool Unavailable; // File, forum post, notice,... unavailable (removed)
|
||||||
time_t DateTimeUTC; // Date-time of publishing in UTC time
|
time_t DateTimeUTC; // Date-time of publication in UTC time
|
||||||
unsigned NumShared; // Number of times (users) this note has been shared
|
unsigned NumShared; // Number of times (users) this note has been shared
|
||||||
unsigned NumFavs; // Number of times (users) this note has been favourited
|
unsigned NumFavs; // Number of times (users) this note has been favourited
|
||||||
};
|
};
|
||||||
|
@ -157,7 +157,7 @@ struct TL_Comment
|
||||||
long PubCod;
|
long PubCod;
|
||||||
long UsrCod; // Publisher
|
long UsrCod; // Publisher
|
||||||
long NotCod; // Note code to which this comment belongs
|
long NotCod; // Note code to which this comment belongs
|
||||||
time_t DateTimeUTC; // Date-time of publishing in UTC time
|
time_t DateTimeUTC; // Date-time of publication in UTC time
|
||||||
unsigned NumFavs; // Number of times (users) this comment has been favourited
|
unsigned NumFavs; // Number of times (users) this comment has been favourited
|
||||||
struct PostContent Content;
|
struct PostContent Content;
|
||||||
};
|
};
|
||||||
|
@ -430,7 +430,7 @@ void TL_ShowTimelineGbl2 (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
/* Get who did the action (publishing, commenting, faving, sharing, mentioning) */
|
/* Get who did the action (publication, commenting, faving, sharing, mentioning) */
|
||||||
Usr_GetParamOtherUsrCodEncrypted (&UsrDat);
|
Usr_GetParamOtherUsrCodEncrypted (&UsrDat);
|
||||||
|
|
||||||
/* Get what he/she did */
|
/* Get what he/she did */
|
||||||
|
@ -614,19 +614,19 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
|
|
||||||
/***** Create temporary table with publication codes *****/
|
/***** Create temporary table with publication codes *****/
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE pub_codes "
|
"CREATE TEMPORARY TABLE tl_pub_codes "
|
||||||
"(PubCod BIGINT NOT NULL,UNIQUE INDEX(PubCod)) ENGINE=MEMORY");
|
"(PubCod BIGINT NOT NULL,UNIQUE INDEX(PubCod)) ENGINE=MEMORY");
|
||||||
|
|
||||||
/***** Create temporary table with notes got in this execution *****/
|
/***** Create temporary table with notes got in this execution *****/
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE not_codes "
|
"CREATE TEMPORARY TABLE tl_not_codes "
|
||||||
"(NotCod BIGINT NOT NULL,INDEX(NotCod)) ENGINE=MEMORY");
|
"(NotCod BIGINT NOT NULL,INDEX(NotCod)) ENGINE=MEMORY");
|
||||||
|
|
||||||
/***** Create temporary table with notes already present in timeline for this session *****/
|
/***** Create temporary table with notes already present in timeline for this session *****/
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE current_timeline "
|
"CREATE TEMPORARY TABLE tl_current_timeline "
|
||||||
"(NotCod BIGINT NOT NULL,INDEX(NotCod)) ENGINE=MEMORY"
|
"(NotCod BIGINT NOT NULL,INDEX(NotCod)) ENGINE=MEMORY"
|
||||||
" SELECT NotCod FROM social_timelines WHERE SessionId='%s'",
|
" SELECT NotCod FROM tl_timelines WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
|
|
||||||
/***** Create temporary table and subquery with potential publishers *****/
|
/***** Create temporary table and subquery with potential publishers *****/
|
||||||
|
@ -645,7 +645,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_FOLLOWED: // Show the timeline of the users I follow
|
case Usr_WHO_FOLLOWED: // Show the timeline of the users I follow
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE publishers "
|
"CREATE TEMPORARY TABLE tl_publishers "
|
||||||
"(UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
|
"(UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
|
||||||
" SELECT %ld AS UsrCod"
|
" SELECT %ld AS UsrCod"
|
||||||
" UNION"
|
" UNION"
|
||||||
|
@ -654,7 +654,8 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
||||||
sprintf (SubQueryPublishers,"social_pubs.PublisherCod=publishers.UsrCod AND ");
|
sprintf (SubQueryPublishers,
|
||||||
|
"tl_pubs.PublisherCod=tl_publishers.UsrCod AND ");
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_ALL: // Show the timeline of all users
|
case Usr_WHO_ALL: // Show the timeline of all users
|
||||||
SubQueryPublishers[0] = '\0';
|
SubQueryPublishers[0] = '\0';
|
||||||
|
@ -676,13 +677,13 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
case TL_GET_RECENT_TIMELINE:
|
case TL_GET_RECENT_TIMELINE:
|
||||||
Str_Copy (SubQueryAlreadyExists,
|
Str_Copy (SubQueryAlreadyExists,
|
||||||
" NotCod NOT IN"
|
" NotCod NOT IN"
|
||||||
" (SELECT NotCod FROM not_codes)",
|
" (SELECT NotCod FROM tl_not_codes)",
|
||||||
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
||||||
break;
|
break;
|
||||||
case TL_GET_ONLY_OLD_PUBS:
|
case TL_GET_ONLY_OLD_PUBS:
|
||||||
Str_Copy (SubQueryAlreadyExists,
|
Str_Copy (SubQueryAlreadyExists,
|
||||||
" NotCod NOT IN"
|
" NotCod NOT IN"
|
||||||
" (SELECT NotCod FROM current_timeline)",
|
" (SELECT NotCod FROM tl_current_timeline)",
|
||||||
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -693,14 +694,14 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
case TL_GET_ONLY_NEW_PUBS:
|
case TL_GET_ONLY_NEW_PUBS:
|
||||||
case TL_GET_RECENT_TIMELINE:
|
case TL_GET_RECENT_TIMELINE:
|
||||||
Str_Copy (SubQueryAlreadyExists,
|
Str_Copy (SubQueryAlreadyExists,
|
||||||
" social_pubs.NotCod NOT IN"
|
" tl_pubs.NotCod NOT IN"
|
||||||
" (SELECT NotCod FROM not_codes)",
|
" (SELECT NotCod FROM tl_not_codes)",
|
||||||
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
||||||
break;
|
break;
|
||||||
case TL_GET_ONLY_OLD_PUBS:
|
case TL_GET_ONLY_OLD_PUBS:
|
||||||
Str_Copy (SubQueryAlreadyExists,
|
Str_Copy (SubQueryAlreadyExists,
|
||||||
" social_pubs.NotCod NOT IN"
|
" tl_pubs.NotCod NOT IN"
|
||||||
" (SELECT NotCod FROM current_timeline)",
|
" (SELECT NotCod FROM tl_current_timeline)",
|
||||||
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
TL_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +711,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
/***** Get the publications in timeline *****/
|
/***** Get the publications in timeline *****/
|
||||||
/* Initialize range of pubs:
|
/* Initialize range of pubs:
|
||||||
|
|
||||||
social_pubs
|
tl_pubs
|
||||||
_____
|
_____
|
||||||
|_____|11
|
|_____|11
|
||||||
|_____|10
|
|_____|10
|
||||||
|
@ -756,7 +757,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
As an alternative, we tried to get the maximum PubCod,
|
As an alternative, we tried to get the maximum PubCod,
|
||||||
i.e more recent publication (original, shared or commment),
|
i.e more recent publication (original, shared or commment),
|
||||||
of every set of publications corresponding to the same note:
|
of every set of publications corresponding to the same note:
|
||||||
"SELECT MAX(PubCod) AS NewestPubCod FROM social_pubs ...
|
"SELECT MAX(PubCod) AS NewestPubCod FROM tl_pubs ...
|
||||||
" GROUP BY NotCod ORDER BY NewestPubCod DESC LIMIT ..."
|
" GROUP BY NotCod ORDER BY NewestPubCod DESC LIMIT ..."
|
||||||
but this query is slow (several seconds) with a big table.
|
but this query is slow (several seconds) with a big table.
|
||||||
*/
|
*/
|
||||||
|
@ -765,7 +766,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
NumPub < MaxPubsToGet[WhatToGetFromTimeline];
|
NumPub < MaxPubsToGet[WhatToGetFromTimeline];
|
||||||
NumPub++)
|
NumPub++)
|
||||||
{
|
{
|
||||||
/* Create subqueries with range of publications to get from social_pubs */
|
/* Create subqueries with range of publications to get from tl_pubs */
|
||||||
if (RangePubsToGet.Bottom > 0)
|
if (RangePubsToGet.Bottom > 0)
|
||||||
switch (TimelineUsrOrGbl)
|
switch (TimelineUsrOrGbl)
|
||||||
{
|
{
|
||||||
|
@ -782,7 +783,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
RangePubsToGet.Bottom);
|
RangePubsToGet.Bottom);
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_FOLLOWED:// Show the timeline of the users I follow
|
case Usr_WHO_FOLLOWED:// Show the timeline of the users I follow
|
||||||
sprintf (SubQueryRangeBottom,"social_pubs.PubCod>%ld AND ",
|
sprintf (SubQueryRangeBottom,"tl_pubs.PubCod>%ld AND ",
|
||||||
RangePubsToGet.Bottom);
|
RangePubsToGet.Bottom);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -810,7 +811,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
RangePubsToGet.Top);
|
RangePubsToGet.Top);
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_FOLLOWED:// Show the timeline of the users I follow
|
case Usr_WHO_FOLLOWED:// Show the timeline of the users I follow
|
||||||
sprintf (SubQueryRangeTop,"social_pubs.PubCod<%ld AND ",
|
sprintf (SubQueryRangeTop,"tl_pubs.PubCod<%ld AND ",
|
||||||
RangePubsToGet.Top);
|
RangePubsToGet.Top);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -822,7 +823,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
else
|
else
|
||||||
SubQueryRangeTop[0] = '\0';
|
SubQueryRangeTop[0] = '\0';
|
||||||
|
|
||||||
/* Select the most recent publication from social_pubs */
|
/* Select the most recent publication from tl_pubs */
|
||||||
NumPubs = 0; // Initialized to avoid warning
|
NumPubs = 0; // Initialized to avoid warning
|
||||||
switch (TimelineUsrOrGbl)
|
switch (TimelineUsrOrGbl)
|
||||||
{
|
{
|
||||||
|
@ -830,7 +831,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
NumPubs =
|
NumPubs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
||||||
"SELECT PubCod,NotCod"
|
"SELECT PubCod,NotCod"
|
||||||
" FROM social_pubs"
|
" FROM tl_pubs"
|
||||||
" WHERE %s%s%s%s"
|
" WHERE %s%s%s%s"
|
||||||
" ORDER BY PubCod DESC LIMIT 1",
|
" ORDER BY PubCod DESC LIMIT 1",
|
||||||
SubQueryRangeBottom,SubQueryRangeTop,
|
SubQueryRangeBottom,SubQueryRangeTop,
|
||||||
|
@ -844,7 +845,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
NumPubs =
|
NumPubs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
||||||
"SELECT PubCod,NotCod"
|
"SELECT PubCod,NotCod"
|
||||||
" FROM social_pubs"
|
" FROM tl_pubs"
|
||||||
" WHERE %s%s%s%s"
|
" WHERE %s%s%s%s"
|
||||||
" ORDER BY PubCod DESC LIMIT 1",
|
" ORDER BY PubCod DESC LIMIT 1",
|
||||||
SubQueryRangeBottom,SubQueryRangeTop,
|
SubQueryRangeBottom,SubQueryRangeTop,
|
||||||
|
@ -855,9 +856,9 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
NumPubs =
|
NumPubs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
||||||
"SELECT PubCod,NotCod"
|
"SELECT PubCod,NotCod"
|
||||||
" FROM social_pubs,publishers"
|
" FROM tl_pubs,tl_publishers"
|
||||||
" WHERE %s%s%s%s"
|
" WHERE %s%s%s%s"
|
||||||
" ORDER BY social_pubs.PubCod DESC LIMIT 1",
|
" ORDER BY tl_pubs.PubCod DESC LIMIT 1",
|
||||||
SubQueryRangeBottom,SubQueryRangeTop,
|
SubQueryRangeBottom,SubQueryRangeTop,
|
||||||
SubQueryPublishers,
|
SubQueryPublishers,
|
||||||
SubQueryAlreadyExists);
|
SubQueryAlreadyExists);
|
||||||
|
@ -866,7 +867,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
NumPubs =
|
NumPubs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get publication",
|
||||||
"SELECT PubCod,NotCod"
|
"SELECT PubCod,NotCod"
|
||||||
" FROM social_pubs"
|
" FROM tl_pubs"
|
||||||
" WHERE %s%s%s"
|
" WHERE %s%s%s"
|
||||||
" ORDER BY PubCod DESC LIMIT 1",
|
" ORDER BY PubCod DESC LIMIT 1",
|
||||||
SubQueryRangeBottom,SubQueryRangeTop,
|
SubQueryRangeBottom,SubQueryRangeTop,
|
||||||
|
@ -897,7 +898,7 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
if (PubCod > 0)
|
if (PubCod > 0)
|
||||||
{
|
{
|
||||||
DB_QueryINSERT ("can not store publication code",
|
DB_QueryINSERT ("can not store publication code",
|
||||||
"INSERT INTO pub_codes SET PubCod=%ld",
|
"INSERT INTO tl_pub_codes SET PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
RangePubsToGet.Top = PubCod; // Narrow the range for the next iteration
|
RangePubsToGet.Top = PubCod; // Narrow the range for the next iteration
|
||||||
|
|
||||||
|
@ -906,10 +907,10 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
{
|
{
|
||||||
NotCod = Str_ConvertStrCodToLongCod (row[1]);
|
NotCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
DB_QueryINSERT ("can not store note code",
|
DB_QueryINSERT ("can not store note code",
|
||||||
"INSERT INTO not_codes SET NotCod=%ld",
|
"INSERT INTO tl_not_codes SET NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
DB_QueryINSERT ("can not store note code",
|
DB_QueryINSERT ("can not store note code",
|
||||||
"INSERT INTO current_timeline SET NotCod=%ld",
|
"INSERT INTO tl_current_timeline SET NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,10 +933,10 @@ static void TL_BuildQueryToGetTimeline (char **Query,
|
||||||
"PublisherCod," // row[2]
|
"PublisherCod," // row[2]
|
||||||
"PubType," // row[3]
|
"PubType," // row[3]
|
||||||
"UNIX_TIMESTAMP(TimePublish)" // row[4]
|
"UNIX_TIMESTAMP(TimePublish)" // row[4]
|
||||||
" FROM social_pubs"
|
" FROM tl_pubs"
|
||||||
" WHERE PubCod IN "
|
" WHERE PubCod IN "
|
||||||
"(SELECT PubCod"
|
"(SELECT PubCod"
|
||||||
" FROM pub_codes)"
|
" FROM tl_pub_codes)"
|
||||||
" ORDER BY PubCod DESC");
|
" ORDER BY PubCod DESC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +982,7 @@ static void TL_UpdateLastPubCodIntoSession (void)
|
||||||
DB_QueryUPDATE ("can not update last publication code into session",
|
DB_QueryUPDATE ("can not update last publication code into session",
|
||||||
"UPDATE sessions"
|
"UPDATE sessions"
|
||||||
" SET LastPubCod="
|
" SET LastPubCod="
|
||||||
"(SELECT IFNULL(MAX(PubCod),0) FROM social_pubs)"
|
"(SELECT IFNULL(MAX(PubCod),0) FROM tl_pubs)"
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
@ -1005,8 +1006,11 @@ static void TL_UpdateFirstPubCodIntoSession (long FirstPubCod)
|
||||||
static void TL_DropTemporaryTablesUsedToQueryTimeline (void)
|
static void TL_DropTemporaryTablesUsedToQueryTimeline (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_Query ("can not remove temporary tables",
|
||||||
"DROP TEMPORARY TABLE IF EXISTS"
|
"DROP TEMPORARY TABLE IF EXISTS "
|
||||||
" pub_codes,not_codes,publishers,current_timeline");
|
"tl_pub_codes,"
|
||||||
|
"tl_not_codes,"
|
||||||
|
"tl_publishers,"
|
||||||
|
"tl_current_timeline");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1849,7 +1853,7 @@ static void TL_GetAndWritePost (long PstCod)
|
||||||
" of a post",
|
" of a post",
|
||||||
"SELECT Txt," // row[0]
|
"SELECT Txt," // row[0]
|
||||||
"MedCod" // row[1]
|
"MedCod" // row[1]
|
||||||
" FROM social_posts"
|
" FROM tl_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
PstCod);
|
PstCod);
|
||||||
|
|
||||||
|
@ -2126,7 +2130,7 @@ void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod,struct TL_Publicati
|
||||||
/***** Store note *****/
|
/***** Store note *****/
|
||||||
SocPub->NotCod =
|
SocPub->NotCod =
|
||||||
DB_QueryINSERTandReturnCode ("can not create new note",
|
DB_QueryINSERTandReturnCode ("can not create new note",
|
||||||
"INSERT INTO social_notes"
|
"INSERT INTO tl_notes"
|
||||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%u,%ld,%ld,%ld,'N',NOW())",
|
" (%u,%ld,%ld,%ld,'N',NOW())",
|
||||||
|
@ -2147,7 +2151,7 @@ void TL_MarkNoteAsUnavailableUsingNotCod (long NotCod)
|
||||||
{
|
{
|
||||||
/***** Mark the note as unavailable *****/
|
/***** Mark the note as unavailable *****/
|
||||||
DB_QueryUPDATE ("can not mark note as unavailable",
|
DB_QueryUPDATE ("can not mark note as unavailable",
|
||||||
"UPDATE social_notes SET Unavailable='Y'"
|
"UPDATE tl_notes SET Unavailable='Y'"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -2156,7 +2160,7 @@ void TL_MarkNoteAsUnavailableUsingNoteTypeAndCod (TL_NoteType_t NoteType,long Co
|
||||||
{
|
{
|
||||||
/***** Mark the note as unavailable *****/
|
/***** Mark the note as unavailable *****/
|
||||||
DB_QueryUPDATE ("can not mark note as unavailable",
|
DB_QueryUPDATE ("can not mark note as unavailable",
|
||||||
"UPDATE social_notes SET Unavailable='Y'"
|
"UPDATE tl_notes SET Unavailable='Y'"
|
||||||
" WHERE NoteType=%u AND Cod=%ld",
|
" WHERE NoteType=%u AND Cod=%ld",
|
||||||
(unsigned) NoteType,Cod);
|
(unsigned) NoteType,Cod);
|
||||||
}
|
}
|
||||||
|
@ -2276,7 +2280,7 @@ void TL_MarkNotesChildrenOfFolderAsUnavailable (const char *Path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DB_QueryUPDATE ("can not mark notes as unavailable",
|
DB_QueryUPDATE ("can not mark notes as unavailable",
|
||||||
"UPDATE social_notes SET Unavailable='Y'"
|
"UPDATE tl_notes SET Unavailable='Y'"
|
||||||
" WHERE NoteType=%u AND Cod IN"
|
" WHERE NoteType=%u AND Cod IN"
|
||||||
" (SELECT FilCod FROM files"
|
" (SELECT FilCod FROM files"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||||
|
@ -2300,7 +2304,7 @@ static void TL_PublishNoteInTimeline (struct TL_Publication *SocPub)
|
||||||
/***** Publish note in timeline *****/
|
/***** Publish note in timeline *****/
|
||||||
SocPub->PubCod =
|
SocPub->PubCod =
|
||||||
DB_QueryINSERTandReturnCode ("can not publish note",
|
DB_QueryINSERTandReturnCode ("can not publish note",
|
||||||
"INSERT INTO social_pubs"
|
"INSERT INTO tl_pubs"
|
||||||
" (NotCod,PublisherCod,PubType,TimePublish)"
|
" (NotCod,PublisherCod,PubType,TimePublish)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,%u,NOW())",
|
" (%ld,%ld,%u,NOW())",
|
||||||
|
@ -2458,7 +2462,7 @@ static long TL_ReceivePost (void)
|
||||||
/* Insert post content in the database */
|
/* Insert post content in the database */
|
||||||
PstCod =
|
PstCod =
|
||||||
DB_QueryINSERTandReturnCode ("can not create post",
|
DB_QueryINSERTandReturnCode ("can not create post",
|
||||||
"INSERT INTO social_posts"
|
"INSERT INTO tl_posts"
|
||||||
" (Txt,MedCod)"
|
" (Txt,MedCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%s',%ld)",
|
" ('%s',%ld)",
|
||||||
|
@ -2564,7 +2568,7 @@ static void TL_PutHiddenFormToWriteNewCommentToNote (long NotCod,
|
||||||
static unsigned long TL_GetNumCommentsInNote (long NotCod)
|
static unsigned long TL_GetNumCommentsInNote (long NotCod)
|
||||||
{
|
{
|
||||||
return DB_QueryCOUNT ("can not get number of comments in a note",
|
return DB_QueryCOUNT ("can not get number of comments in a note",
|
||||||
"SELECT COUNT(*) FROM social_pubs"
|
"SELECT COUNT(*) FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
@ -2603,18 +2607,18 @@ static void TL_WriteCommentsInNote (const struct TL_Note *SocNot,
|
||||||
DB_QuerySELECT (&mysql_res,"can not get comments",
|
DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||||
"SELECT * FROM "
|
"SELECT * FROM "
|
||||||
"("
|
"("
|
||||||
"SELECT social_pubs.PubCod," // row[0]
|
"SELECT tl_pubs.PubCod," // row[0]
|
||||||
"social_pubs.PublisherCod," // row[1]
|
"tl_pubs.PublisherCod," // row[1]
|
||||||
"social_pubs.NotCod," // row[2]
|
"tl_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP("
|
"UNIX_TIMESTAMP("
|
||||||
"social_pubs.TimePublish)," // row[3]
|
"tl_pubs.TimePublish)," // row[3]
|
||||||
"social_comments.Txt," // row[4]
|
"tl_comments.Txt," // row[4]
|
||||||
"social_comments.MedCod" // row[5]
|
"tl_comments.MedCod" // row[5]
|
||||||
" FROM social_pubs,social_comments"
|
" FROM tl_pubs,tl_comments"
|
||||||
" WHERE social_pubs.NotCod=%ld"
|
" WHERE tl_pubs.NotCod=%ld"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
" AND tl_pubs.PubCod=tl_comments.PubCod"
|
||||||
" ORDER BY social_pubs.PubCod DESC LIMIT %u"
|
" ORDER BY tl_pubs.PubCod DESC LIMIT %u"
|
||||||
") AS comments"
|
") AS comments"
|
||||||
" ORDER BY PubCod",
|
" ORDER BY PubCod",
|
||||||
SocNot->NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
SocNot->NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
||||||
|
@ -2815,18 +2819,18 @@ static unsigned TL_WriteHiddenComments (long NotCod,
|
||||||
/***** Get comments of this note from database *****/
|
/***** Get comments of this note from database *****/
|
||||||
NumInitialCommentsGot = (unsigned)
|
NumInitialCommentsGot = (unsigned)
|
||||||
DB_QuerySELECT (&mysql_res,"can not get comments",
|
DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||||
"SELECT social_pubs.PubCod," // row[0]
|
"SELECT tl_pubs.PubCod," // row[0]
|
||||||
"social_pubs.PublisherCod," // row[1]
|
"tl_pubs.PublisherCod," // row[1]
|
||||||
"social_pubs.NotCod," // row[2]
|
"tl_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP("
|
"UNIX_TIMESTAMP("
|
||||||
"social_pubs.TimePublish)," // row[3]
|
"tl_pubs.TimePublish)," // row[3]
|
||||||
"social_comments.Txt," // row[4]
|
"tl_comments.Txt," // row[4]
|
||||||
"social_comments.MedCod" // row[5]
|
"tl_comments.MedCod" // row[5]
|
||||||
" FROM social_pubs,social_comments"
|
" FROM tl_pubs,tl_comments"
|
||||||
" WHERE social_pubs.NotCod=%ld"
|
" WHERE tl_pubs.NotCod=%ld"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
" AND tl_pubs.PubCod=tl_comments.PubCod"
|
||||||
" ORDER BY social_pubs.PubCod"
|
" ORDER BY tl_pubs.PubCod"
|
||||||
" LIMIT %lu",
|
" LIMIT %lu",
|
||||||
NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
||||||
NumInitialCommentsToGet);
|
NumInitialCommentsToGet);
|
||||||
|
@ -3393,7 +3397,7 @@ static long TL_ReceiveComment (void)
|
||||||
|
|
||||||
/* Insert comment content in the database */
|
/* Insert comment content in the database */
|
||||||
DB_QueryINSERT ("can not store comment content",
|
DB_QueryINSERT ("can not store comment content",
|
||||||
"INSERT INTO social_comments"
|
"INSERT INTO tl_comments"
|
||||||
" (PubCod,Txt,MedCod)"
|
" (PubCod,Txt,MedCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,'%s',%ld)",
|
" (%ld,'%s',%ld)",
|
||||||
|
@ -3639,7 +3643,7 @@ static void TL_FavNote (struct TL_Note *SocNot)
|
||||||
{
|
{
|
||||||
/***** Mark as favourite in database *****/
|
/***** Mark as favourite in database *****/
|
||||||
DB_QueryINSERT ("can not favourite note",
|
DB_QueryINSERT ("can not favourite note",
|
||||||
"INSERT IGNORE INTO social_notes_fav"
|
"INSERT IGNORE INTO tl_notes_fav"
|
||||||
" (NotCod,UsrCod,TimeFav)"
|
" (NotCod,UsrCod,TimeFav)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,NOW())",
|
" (%ld,%ld,NOW())",
|
||||||
|
@ -3677,7 +3681,7 @@ static void TL_UnfNote (struct TL_Note *SocNot)
|
||||||
{
|
{
|
||||||
/***** Delete the mark as favourite from database *****/
|
/***** Delete the mark as favourite from database *****/
|
||||||
DB_QueryDELETE ("can not unfavourite note",
|
DB_QueryDELETE ("can not unfavourite note",
|
||||||
"DELETE FROM social_notes_fav"
|
"DELETE FROM tl_notes_fav"
|
||||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -3810,7 +3814,7 @@ static void TL_FavComment (struct TL_Comment *SocCom)
|
||||||
{
|
{
|
||||||
/***** Mark as favourite in database *****/
|
/***** Mark as favourite in database *****/
|
||||||
DB_QueryINSERT ("can not favourite comment",
|
DB_QueryINSERT ("can not favourite comment",
|
||||||
"INSERT IGNORE INTO social_comments_fav"
|
"INSERT IGNORE INTO tl_comments_fav"
|
||||||
" (PubCod,UsrCod,TimeFav)"
|
" (PubCod,UsrCod,TimeFav)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,NOW())",
|
" (%ld,%ld,NOW())",
|
||||||
|
@ -3851,7 +3855,7 @@ static void TL_UnfComment (struct TL_Comment *SocCom)
|
||||||
{
|
{
|
||||||
/***** Delete the mark as favourite from database *****/
|
/***** Delete the mark as favourite from database *****/
|
||||||
DB_QueryDELETE ("can not unfavourite comment",
|
DB_QueryDELETE ("can not unfavourite comment",
|
||||||
"DELETE FROM social_comments_fav"
|
"DELETE FROM tl_comments_fav"
|
||||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||||
SocCom->PubCod,
|
SocCom->PubCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -3947,7 +3951,7 @@ static void TL_UnsNote (struct TL_Note *SocNot)
|
||||||
{
|
{
|
||||||
/***** Delete publication from database *****/
|
/***** Delete publication from database *****/
|
||||||
DB_QueryDELETE ("can not remove a publication",
|
DB_QueryDELETE ("can not remove a publication",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod=%ld"
|
" AND PublisherCod=%ld"
|
||||||
" AND PubType=%u",
|
" AND PubType=%u",
|
||||||
|
@ -4136,7 +4140,7 @@ static void TL_RemoveNoteMediaAndDBEntries (struct TL_Note *SocNot)
|
||||||
/* Get comments of this note */
|
/* Get comments of this note */
|
||||||
NumComments = DB_QuerySELECT (&mysql_res,"can not get comments",
|
NumComments = DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||||
"SELECT PubCod"
|
"SELECT PubCod"
|
||||||
" FROM social_pubs"
|
" FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
@ -4164,7 +4168,7 @@ static void TL_RemoveNoteMediaAndDBEntries (struct TL_Note *SocNot)
|
||||||
/* Remove media associated to a post from database */
|
/* Remove media associated to a post from database */
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get media",
|
if (DB_QuerySELECT (&mysql_res,"can not get media",
|
||||||
"SELECT MedCod" // row[0]
|
"SELECT MedCod" // row[0]
|
||||||
" FROM social_posts"
|
" FROM tl_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
SocNot->Cod) == 1) // Result should have a unique row
|
SocNot->Cod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -4193,19 +4197,19 @@ static void TL_RemoveNoteMediaAndDBEntries (struct TL_Note *SocNot)
|
||||||
|
|
||||||
/***** Remove favs for this note *****/
|
/***** Remove favs for this note *****/
|
||||||
DB_QueryDELETE ("can not remove favs for note",
|
DB_QueryDELETE ("can not remove favs for note",
|
||||||
"DELETE FROM social_notes_fav"
|
"DELETE FROM tl_notes_fav"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
SocNot->NotCod);
|
SocNot->NotCod);
|
||||||
|
|
||||||
/***** Remove all the publications of this note *****/
|
/***** Remove all the publications of this note *****/
|
||||||
DB_QueryDELETE ("can not remove a publication",
|
DB_QueryDELETE ("can not remove a publication",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
SocNot->NotCod);
|
SocNot->NotCod);
|
||||||
|
|
||||||
/***** Remove note *****/
|
/***** Remove note *****/
|
||||||
DB_QueryDELETE ("can not remove a note",
|
DB_QueryDELETE ("can not remove a note",
|
||||||
"DELETE FROM social_notes"
|
"DELETE FROM tl_notes"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND UsrCod=%ld", // Extra check: I am the author
|
" AND UsrCod=%ld", // Extra check: I am the author
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
|
@ -4214,7 +4218,7 @@ static void TL_RemoveNoteMediaAndDBEntries (struct TL_Note *SocNot)
|
||||||
if (SocNot->NoteType == TL_NOTE_POST)
|
if (SocNot->NoteType == TL_NOTE_POST)
|
||||||
/***** Remove post *****/
|
/***** Remove post *****/
|
||||||
DB_QueryDELETE ("can not remove a post",
|
DB_QueryDELETE ("can not remove a post",
|
||||||
"DELETE FROM social_posts"
|
"DELETE FROM tl_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
SocNot->Cod);
|
SocNot->Cod);
|
||||||
}
|
}
|
||||||
|
@ -4231,7 +4235,7 @@ static long TL_GetNotCodOfPublication (long PubCod)
|
||||||
|
|
||||||
/***** Get code of note from database *****/
|
/***** Get code of note from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get code of note",
|
if (DB_QuerySELECT (&mysql_res,"can not get code of note",
|
||||||
"SELECT NotCod FROM social_pubs"
|
"SELECT NotCod FROM tl_pubs"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod) == 1) // Result should have a unique row
|
PubCod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -4258,7 +4262,7 @@ static long TL_GetPubCodOfOriginalNote (long NotCod)
|
||||||
|
|
||||||
/***** Get code of publication of the original note *****/
|
/***** Get code of publication of the original note *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get code of publication",
|
if (DB_QuerySELECT (&mysql_res,"can not get code of publication",
|
||||||
"SELECT PubCod FROM social_pubs"
|
"SELECT PubCod FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
NotCod,(unsigned) TL_PUB_ORIGINAL_NOTE) == 1) // Result should have a unique row
|
NotCod,(unsigned) TL_PUB_ORIGINAL_NOTE) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -4452,7 +4456,7 @@ static void TL_RemoveCommentMediaAndDBEntries (long PubCod)
|
||||||
/***** Remove media associated to comment *****/
|
/***** Remove media associated to comment *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get media",
|
if (DB_QuerySELECT (&mysql_res,"can not get media",
|
||||||
"SELECT MedCod" // row[0]
|
"SELECT MedCod" // row[0]
|
||||||
" FROM social_comments"
|
" FROM tl_comments"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod) == 1) // Result should have a unique row
|
PubCod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -4474,19 +4478,19 @@ static void TL_RemoveCommentMediaAndDBEntries (long PubCod)
|
||||||
|
|
||||||
/***** Remove favs for this comment *****/
|
/***** Remove favs for this comment *****/
|
||||||
DB_QueryDELETE ("can not remove favs for comment",
|
DB_QueryDELETE ("can not remove favs for comment",
|
||||||
"DELETE FROM social_comments_fav"
|
"DELETE FROM tl_comments_fav"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
|
|
||||||
/***** Remove content of this comment *****/
|
/***** Remove content of this comment *****/
|
||||||
DB_QueryDELETE ("can not remove a comment",
|
DB_QueryDELETE ("can not remove a comment",
|
||||||
"DELETE FROM social_comments"
|
"DELETE FROM tl_comments"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
|
|
||||||
/***** Remove this comment *****/
|
/***** Remove this comment *****/
|
||||||
DB_QueryDELETE ("can not remove a comment",
|
DB_QueryDELETE ("can not remove a comment",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" WHERE PubCod=%ld"
|
" WHERE PubCod=%ld"
|
||||||
" AND PublisherCod=%ld" // Extra check: I am the author
|
" AND PublisherCod=%ld" // Extra check: I am the author
|
||||||
" AND PubType=%u", // Extra check: it's a comment
|
" AND PubType=%u", // Extra check: it's a comment
|
||||||
|
@ -4504,98 +4508,98 @@ void TL_RemoveUsrContent (long UsrCod)
|
||||||
/***** Remove favs for comments *****/
|
/***** Remove favs for comments *****/
|
||||||
/* Remove all favs made by this user in any comment */
|
/* Remove all favs made by this user in any comment */
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM social_comments_fav"
|
"DELETE FROM tl_comments_fav"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/* Remove all favs for all comments of this user */
|
/* Remove all favs for all comments of this user */
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM social_comments_fav"
|
"DELETE FROM tl_comments_fav"
|
||||||
" USING social_pubs,social_comments_fav"
|
" USING tl_pubs,tl_comments_fav"
|
||||||
" WHERE social_pubs.PublisherCod=%ld" // Author of the comment
|
" WHERE tl_pubs.PublisherCod=%ld" // Author of the comment
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
" AND tl_pubs.PubCod=tl_comments_fav.PubCod",
|
||||||
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
|
||||||
/* Remove all favs for all comments in all the notes of the user */
|
/* Remove all favs for all comments in all the notes of the user */
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM social_comments_fav"
|
"DELETE FROM tl_comments_fav"
|
||||||
" USING social_notes,social_pubs,social_comments_fav"
|
" USING tl_notes,tl_pubs,tl_comments_fav"
|
||||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
" WHERE tl_notes.UsrCod=%ld" // Author of the note
|
||||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
" AND tl_notes.NotCod=tl_pubs.NotCod"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments_fav.PubCod",
|
" AND tl_pubs.PubCod=tl_comments_fav.PubCod",
|
||||||
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
|
||||||
/***** Remove favs for notes *****/
|
/***** Remove favs for notes *****/
|
||||||
/* Remove all favs made by this user in any note */
|
/* Remove all favs made by this user in any note */
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM social_notes_fav"
|
"DELETE FROM tl_notes_fav"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/* Remove all favs for all notes of this user */
|
/* Remove all favs for all notes of this user */
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM social_notes_fav"
|
"DELETE FROM tl_notes_fav"
|
||||||
" USING social_notes,social_notes_fav"
|
" USING tl_notes,tl_notes_fav"
|
||||||
" WHERE social_notes.UsrCod=%ld" // Author of the note
|
" WHERE tl_notes.UsrCod=%ld" // Author of the note
|
||||||
" AND social_notes.NotCod=social_notes_fav.NotCod",
|
" AND tl_notes.NotCod=tl_notes_fav.NotCod",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/***** Remove comments *****/
|
/***** Remove comments *****/
|
||||||
/* Remove content of all the comments in all the notes of the user */
|
/* Remove content of all the comments in all the notes of the user */
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM social_comments"
|
"DELETE FROM tl_comments"
|
||||||
" USING social_notes,social_pubs,social_comments"
|
" USING tl_notes,tl_pubs,tl_comments"
|
||||||
" WHERE social_notes.UsrCod=%ld"
|
" WHERE tl_notes.UsrCod=%ld"
|
||||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
" AND tl_notes.NotCod=tl_pubs.NotCod"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
||||||
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
|
||||||
/* Remove all the comments from any user in any note of the user */
|
/* Remove all the comments from any user in any note of the user */
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" USING social_notes,social_pubs"
|
" USING tl_notes,tl_pubs"
|
||||||
" WHERE social_notes.UsrCod=%ld"
|
" WHERE tl_notes.UsrCod=%ld"
|
||||||
" AND social_notes.NotCod=social_pubs.NotCod"
|
" AND tl_notes.NotCod=tl_pubs.NotCod"
|
||||||
" AND social_pubs.PubType=%u",
|
" AND tl_pubs.PubType=%u",
|
||||||
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
|
||||||
/* Remove content of all the comments of the user in any note */
|
/* Remove content of all the comments of the user in any note */
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM social_comments"
|
"DELETE FROM tl_comments"
|
||||||
" USING social_pubs,social_comments"
|
" USING tl_pubs,tl_comments"
|
||||||
" WHERE social_pubs.PublisherCod=%ld"
|
" WHERE tl_pubs.PublisherCod=%ld"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
||||||
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||||
|
|
||||||
/***** Remove all the posts of the user *****/
|
/***** Remove all the posts of the user *****/
|
||||||
DB_QueryDELETE ("can not remove posts",
|
DB_QueryDELETE ("can not remove posts",
|
||||||
"DELETE FROM social_posts"
|
"DELETE FROM tl_posts"
|
||||||
" WHERE PstCod IN"
|
" WHERE PstCod IN"
|
||||||
" (SELECT Cod FROM social_notes"
|
" (SELECT Cod FROM tl_notes"
|
||||||
" WHERE UsrCod=%ld AND NoteType=%u)",
|
" WHERE UsrCod=%ld AND NoteType=%u)",
|
||||||
UsrCod,(unsigned) TL_NOTE_POST);
|
UsrCod,(unsigned) TL_NOTE_POST);
|
||||||
|
|
||||||
/***** Remove all the publications of any user authored by the user *****/
|
/***** Remove all the publications of any user authored by the user *****/
|
||||||
DB_QueryDELETE ("can not remove publications",
|
DB_QueryDELETE ("can not remove publications",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" USING social_notes,social_pubs"
|
" USING tl_notes,tl_pubs"
|
||||||
" WHERE social_notes.UsrCod=%ld"
|
" WHERE tl_notes.UsrCod=%ld"
|
||||||
" AND social_notes.NotCod=social_pubs.NotCod",
|
" AND tl_notes.NotCod=tl_pubs.NotCod",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/***** Remove all the publications of the user *****/
|
/***** Remove all the publications of the user *****/
|
||||||
DB_QueryDELETE ("can not remove publications",
|
DB_QueryDELETE ("can not remove publications",
|
||||||
"DELETE FROM social_pubs"
|
"DELETE FROM tl_pubs"
|
||||||
" WHERE PublisherCod=%ld",
|
" WHERE PublisherCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/***** Remove all the notes of the user *****/
|
/***** Remove all the notes of the user *****/
|
||||||
DB_QueryDELETE ("can not remove notes",
|
DB_QueryDELETE ("can not remove notes",
|
||||||
"DELETE FROM social_notes"
|
"DELETE FROM tl_notes"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
@ -4607,7 +4611,7 @@ void TL_RemoveUsrContent (long UsrCod)
|
||||||
static bool TL_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod)
|
static bool TL_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod)
|
||||||
{
|
{
|
||||||
return (DB_QueryCOUNT ("can not check if a user has shared a note",
|
return (DB_QueryCOUNT ("can not check if a user has shared a note",
|
||||||
"SELECT COUNT(*) FROM social_pubs"
|
"SELECT COUNT(*) FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod=%ld"
|
" AND PublisherCod=%ld"
|
||||||
" AND PubType=%u",
|
" AND PubType=%u",
|
||||||
|
@ -4624,7 +4628,7 @@ static bool TL_CheckIfNoteIsFavedByUsr (long NotCod,long UsrCod)
|
||||||
{
|
{
|
||||||
return (DB_QueryCOUNT ("can not check if a user"
|
return (DB_QueryCOUNT ("can not check if a user"
|
||||||
" has favourited a note",
|
" has favourited a note",
|
||||||
"SELECT COUNT(*) FROM social_notes_fav"
|
"SELECT COUNT(*) FROM tl_notes_fav"
|
||||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||||
NotCod,UsrCod) != 0);
|
NotCod,UsrCod) != 0);
|
||||||
}
|
}
|
||||||
|
@ -4637,7 +4641,7 @@ static bool TL_CheckIfCommIsFavedByUsr (long PubCod,long UsrCod)
|
||||||
{
|
{
|
||||||
return (DB_QueryCOUNT ("can not check if a user"
|
return (DB_QueryCOUNT ("can not check if a user"
|
||||||
" has favourited a comment",
|
" has favourited a comment",
|
||||||
"SELECT COUNT(*) FROM social_comments_fav"
|
"SELECT COUNT(*) FROM tl_comments_fav"
|
||||||
" WHERE PubCod=%ld AND UsrCod=%ld",
|
" WHERE PubCod=%ld AND UsrCod=%ld",
|
||||||
PubCod,UsrCod) != 0);
|
PubCod,UsrCod) != 0);
|
||||||
}
|
}
|
||||||
|
@ -4652,7 +4656,7 @@ static void TL_UpdateNumTimesANoteHasBeenShared (struct TL_Note *SocNot)
|
||||||
SocNot->NumShared =
|
SocNot->NumShared =
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
||||||
" a note has been shared",
|
" a note has been shared",
|
||||||
"SELECT COUNT(*) FROM social_pubs"
|
"SELECT COUNT(*) FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod<>%ld"
|
" AND PublisherCod<>%ld"
|
||||||
" AND PubType=%u",
|
" AND PubType=%u",
|
||||||
|
@ -4671,7 +4675,7 @@ static void TL_GetNumTimesANoteHasBeenFav (struct TL_Note *SocNot)
|
||||||
SocNot->NumFavs =
|
SocNot->NumFavs =
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
||||||
" a note has been favourited",
|
" a note has been favourited",
|
||||||
"SELECT COUNT(*) FROM social_notes_fav"
|
"SELECT COUNT(*) FROM tl_notes_fav"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND UsrCod<>%ld", // Extra check
|
" AND UsrCod<>%ld", // Extra check
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
|
@ -4688,7 +4692,7 @@ static void TL_GetNumTimesACommHasBeenFav (struct TL_Comment *SocCom)
|
||||||
SocCom->NumFavs =
|
SocCom->NumFavs =
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
||||||
" a comment has been favourited",
|
" a comment has been favourited",
|
||||||
"SELECT COUNT(*) FROM social_comments_fav"
|
"SELECT COUNT(*) FROM tl_comments_fav"
|
||||||
" WHERE PubCod=%ld"
|
" WHERE PubCod=%ld"
|
||||||
" AND UsrCod<>%ld", // Extra check
|
" AND UsrCod<>%ld", // Extra check
|
||||||
SocCom->PubCod,
|
SocCom->PubCod,
|
||||||
|
@ -4709,7 +4713,7 @@ static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
|
||||||
if (SocNot->NumShared)
|
if (SocNot->NumShared)
|
||||||
NumFirstUsrs =
|
NumFirstUsrs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
||||||
"SELECT PublisherCod FROM social_pubs"
|
"SELECT PublisherCod FROM tl_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod<>%ld"
|
" AND PublisherCod<>%ld"
|
||||||
" AND PubType=%u"
|
" AND PubType=%u"
|
||||||
|
@ -4752,7 +4756,7 @@ static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
|
||||||
/***** Get list of users from database *****/
|
/***** Get list of users from database *****/
|
||||||
NumFirstUsrs =
|
NumFirstUsrs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
||||||
"SELECT UsrCod FROM social_notes_fav"
|
"SELECT UsrCod FROM tl_notes_fav"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND UsrCod<>%ld" // Extra check
|
" AND UsrCod<>%ld" // Extra check
|
||||||
" ORDER BY FavCod LIMIT %u",
|
" ORDER BY FavCod LIMIT %u",
|
||||||
|
@ -4793,7 +4797,7 @@ static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom,
|
||||||
/***** Get list of users from database *****/
|
/***** Get list of users from database *****/
|
||||||
NumFirstUsrs =
|
NumFirstUsrs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
||||||
"SELECT UsrCod FROM social_comments_fav"
|
"SELECT UsrCod FROM tl_comments_fav"
|
||||||
" WHERE PubCod=%ld"
|
" WHERE PubCod=%ld"
|
||||||
" AND UsrCod<>%ld" // Extra check
|
" AND UsrCod<>%ld" // Extra check
|
||||||
" ORDER BY FavCod LIMIT %u",
|
" ORDER BY FavCod LIMIT %u",
|
||||||
|
@ -4897,7 +4901,7 @@ static void TL_GetDataOfNoteByCod (struct TL_Note *SocNot)
|
||||||
"HieCod," // row[4]
|
"HieCod," // row[4]
|
||||||
"Unavailable," // row[5]
|
"Unavailable," // row[5]
|
||||||
"UNIX_TIMESTAMP(TimeNote)" // row[6]
|
"UNIX_TIMESTAMP(TimeNote)" // row[6]
|
||||||
" FROM social_notes"
|
" FROM tl_notes"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
SocNot->NotCod))
|
SocNot->NotCod))
|
||||||
{
|
{
|
||||||
|
@ -4930,16 +4934,16 @@ static void TL_GetDataOfCommByCod (struct TL_Comment *SocCom)
|
||||||
{
|
{
|
||||||
/***** Get data of comment from database *****/
|
/***** Get data of comment from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get data of comment",
|
if (DB_QuerySELECT (&mysql_res,"can not get data of comment",
|
||||||
"SELECT social_pubs.PubCod," // row[0]
|
"SELECT tl_pubs.PubCod," // row[0]
|
||||||
"social_pubs.PublisherCod," // row[1]
|
"tl_pubs.PublisherCod," // row[1]
|
||||||
"social_pubs.NotCod," // row[2]
|
"tl_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(social_pubs.TimePublish)," // row[3]
|
"UNIX_TIMESTAMP(tl_pubs.TimePublish)," // row[3]
|
||||||
"social_comments.Txt," // row[4]
|
"tl_comments.Txt," // row[4]
|
||||||
"social_comments.MedCod" // row[5]
|
"tl_comments.MedCod" // row[5]
|
||||||
" FROM social_pubs,social_comments"
|
" FROM tl_pubs,tl_comments"
|
||||||
" WHERE social_pubs.PubCod=%ld"
|
" WHERE tl_pubs.PubCod=%ld"
|
||||||
" AND social_pubs.PubType=%u"
|
" AND tl_pubs.PubType=%u"
|
||||||
" AND social_pubs.PubCod=social_comments.PubCod",
|
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
||||||
SocCom->PubCod,(unsigned) TL_PUB_COMMENT_TO_NOTE))
|
SocCom->PubCod,(unsigned) TL_PUB_COMMENT_TO_NOTE))
|
||||||
{
|
{
|
||||||
/***** Get data of comment *****/
|
/***** Get data of comment *****/
|
||||||
|
@ -4959,7 +4963,7 @@ static void TL_GetDataOfCommByCod (struct TL_Comment *SocCom)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Get data of publication using its code *******************/
|
/***************** Get data of publication using its code ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TL_GetDataOfPublicationFromRow (MYSQL_ROW row,struct TL_Publication *SocPub)
|
static void TL_GetDataOfPublicationFromRow (MYSQL_ROW row,struct TL_Publication *SocPub)
|
||||||
|
@ -5024,7 +5028,7 @@ static void TL_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Note *SocNot)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Get publication type from string number coming from database *******/
|
/******* Get publication type from string number coming from database ********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static TL_PubType_t TL_GetPubTypeFromStr (const char *Str)
|
static TL_PubType_t TL_GetPubTypeFromStr (const char *Str)
|
||||||
|
@ -5128,7 +5132,7 @@ void TL_ClearOldTimelinesDB (void)
|
||||||
{
|
{
|
||||||
/***** Remove timelines for expired sessions *****/
|
/***** Remove timelines for expired sessions *****/
|
||||||
DB_QueryDELETE ("can not remove old timelines",
|
DB_QueryDELETE ("can not remove old timelines",
|
||||||
"DELETE LOW_PRIORITY FROM social_timelines"
|
"DELETE LOW_PRIORITY FROM tl_timelines"
|
||||||
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5140,7 +5144,7 @@ static void TL_ClearTimelineThisSession (void)
|
||||||
{
|
{
|
||||||
/***** Remove timeline for this session *****/
|
/***** Remove timeline for this session *****/
|
||||||
DB_QueryDELETE ("can not remove timeline",
|
DB_QueryDELETE ("can not remove timeline",
|
||||||
"DELETE FROM social_timelines"
|
"DELETE FROM tl_timelines"
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
@ -5152,14 +5156,14 @@ static void TL_ClearTimelineThisSession (void)
|
||||||
static void TL_AddNotesJustRetrievedToTimelineThisSession (void)
|
static void TL_AddNotesJustRetrievedToTimelineThisSession (void)
|
||||||
{
|
{
|
||||||
DB_QueryINSERT ("can not insert notes in timeline",
|
DB_QueryINSERT ("can not insert notes in timeline",
|
||||||
"INSERT IGNORE INTO social_timelines"
|
"INSERT IGNORE INTO tl_timelines"
|
||||||
" (SessionId,NotCod)"
|
" (SessionId,NotCod)"
|
||||||
" SELECT DISTINCTROW '%s',NotCod FROM not_codes",
|
" SELECT DISTINCTROW '%s',NotCod FROM tl_not_codes",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Get notification of a new publication ********************/
|
/***************** Get notification of a new publication *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
|
@ -5186,7 +5190,7 @@ void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
"PublisherCod," // row[2]
|
"PublisherCod," // row[2]
|
||||||
"PubType," // row[3]
|
"PubType," // row[3]
|
||||||
"UNIX_TIMESTAMP(TimePublish)" // row[4]
|
"UNIX_TIMESTAMP(TimePublish)" // row[4]
|
||||||
" FROM social_pubs WHERE PubCod=%ld",
|
" FROM tl_pubs WHERE PubCod=%ld",
|
||||||
PubCod) == 1) // Result should have a unique row
|
PubCod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
/* Get data of publication */
|
/* Get data of publication */
|
||||||
|
@ -5213,7 +5217,7 @@ void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
/***** Get content of post from database *****/
|
/***** Get content of post from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get the content of a post",
|
if (DB_QuerySELECT (&mysql_res,"can not get the content of a post",
|
||||||
"SELECT Txt" // row[0]
|
"SELECT Txt" // row[0]
|
||||||
" FROM social_posts"
|
" FROM tl_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
SocNot.Cod) == 1) // Result should have a unique row
|
SocNot.Cod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -5253,7 +5257,7 @@ void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get the content"
|
if (DB_QuerySELECT (&mysql_res,"can not get the content"
|
||||||
" of a comment to a note",
|
" of a comment to a note",
|
||||||
"SELECT Txt" // row[0]
|
"SELECT Txt" // row[0]
|
||||||
" FROM social_comments"
|
" FROM tl_comments"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
SocPub.PubCod) == 1) // Result should have a unique row
|
SocPub.PubCod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -5392,7 +5396,7 @@ unsigned long TL_GetNumPubsUsr (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Get number of posts from a user from database *****/
|
/***** Get number of posts from a user from database *****/
|
||||||
return DB_QueryCOUNT ("can not get number of publications from a user",
|
return DB_QueryCOUNT ("can not get number of publications from a user",
|
||||||
"SELECT COUNT(*) FROM social_pubs"
|
"SELECT COUNT(*) FROM tl_pubs"
|
||||||
" WHERE PublisherCod=%ld",
|
" WHERE PublisherCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#define TL_NUM_NOTE_TYPES 13
|
#define TL_NUM_NOTE_TYPES 13
|
||||||
// If the numbers assigned to each event type change,
|
// If the numbers assigned to each event type change,
|
||||||
// it is necessary to change old numbers to new ones in database table social_notes
|
// it is necessary to change old numbers to new ones in database table tl_notes
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TL_NOTE_UNKNOWN = 0,
|
TL_NOTE_UNKNOWN = 0,
|
||||||
|
@ -76,7 +76,7 @@ typedef enum
|
||||||
|
|
||||||
#define TL_NUM_PUB_TYPES 4
|
#define TL_NUM_PUB_TYPES 4
|
||||||
// If the numbers assigned to each event type change,
|
// If the numbers assigned to each event type change,
|
||||||
// it is necessary to change old numbers to new ones in database table social_notes
|
// it is necessary to change old numbers to new ones in database table tl_notes
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TL_PUB_UNKNOWN = 0,
|
TL_PUB_UNKNOWN = 0,
|
||||||
|
|
Loading…
Reference in New Issue