Merge pull request #2244 from annando/1601-gcontact-total
Global contacts are now playing a central role
This commit is contained in:
commit
f4173d1764
2
boot.php
2
boot.php
|
@ -36,7 +36,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
|||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||
define ( 'FRIENDICA_VERSION', '3.5-dev' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1191 );
|
||||
define ( 'DB_UPDATE_VERSION', 1192 );
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
|
|
216
database.sql
216
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 3.4.2 (Lily of the valley)
|
||||
-- DB_UPDATE_VERSION 1190
|
||||
-- Friendica 3.5-dev (Asparagus)
|
||||
-- DB_UPDATE_VERSION 1192
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -8,20 +8,21 @@
|
|||
-- TABLE addon
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `addon` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` varchar(255) NOT NULL DEFAULT '',
|
||||
`installed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`hidden` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`timestamp` bigint(20) NOT NULL DEFAULT 0,
|
||||
`plugin_admin` tinyint(1) NOT NULL DEFAULT 0
|
||||
`plugin_admin` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE attach
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `attach` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`hash` varchar(64) NOT NULL DEFAULT '',
|
||||
`filename` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -33,28 +34,31 @@ CREATE TABLE IF NOT EXISTS `attach` (
|
|||
`allow_cid` mediumtext NOT NULL,
|
||||
`allow_gid` mediumtext NOT NULL,
|
||||
`deny_cid` mediumtext NOT NULL,
|
||||
`deny_gid` mediumtext NOT NULL
|
||||
`deny_gid` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE auth_codes
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `auth_codes` (
|
||||
`id` varchar(40) NOT NULL PRIMARY KEY,
|
||||
`id` varchar(40) NOT NULL,
|
||||
`client_id` varchar(20) NOT NULL DEFAULT '',
|
||||
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
|
||||
`expires` int(11) NOT NULL DEFAULT 0,
|
||||
`scope` varchar(250) NOT NULL DEFAULT ''
|
||||
`scope` varchar(250) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE cache
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `cache` (
|
||||
`k` varchar(255) NOT NULL PRIMARY KEY,
|
||||
`k` varchar(255) NOT NULL,
|
||||
`v` text NOT NULL,
|
||||
`expire_mode` int(11) NOT NULL DEFAULT 0,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`k`),
|
||||
INDEX `updated` (`updated`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -62,34 +66,37 @@ CREATE TABLE IF NOT EXISTS `cache` (
|
|||
-- TABLE challenge
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `challenge` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`challenge` varchar(255) NOT NULL DEFAULT '',
|
||||
`dfrn-id` varchar(255) NOT NULL DEFAULT '',
|
||||
`expire` int(11) NOT NULL DEFAULT 0,
|
||||
`type` varchar(255) NOT NULL DEFAULT '',
|
||||
`last_update` varchar(255) NOT NULL DEFAULT ''
|
||||
`last_update` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE clients
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `clients` (
|
||||
`client_id` varchar(20) NOT NULL PRIMARY KEY,
|
||||
`client_id` varchar(20) NOT NULL,
|
||||
`pw` varchar(20) NOT NULL DEFAULT '',
|
||||
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
|
||||
`name` text,
|
||||
`icon` text,
|
||||
`uid` int(11) NOT NULL DEFAULT 0
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`client_id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE config
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `config` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`cat` varchar(255) NOT NULL DEFAULT '',
|
||||
`k` varchar(255) NOT NULL DEFAULT '',
|
||||
`v` text NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `cat_k` (`cat`(30),`k`(30))
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -97,7 +104,7 @@ CREATE TABLE IF NOT EXISTS `config` (
|
|||
-- TABLE contact
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `contact` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`self` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -162,6 +169,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
`notify_new_posts` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`ffi_keyword_blacklist` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -169,7 +177,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
-- TABLE conv
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `conv` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
||||
`recips` mediumtext NOT NULL,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
|
@ -177,6 +185,7 @@ CREATE TABLE IF NOT EXISTS `conv` (
|
|||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`subject` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -184,27 +193,29 @@ CREATE TABLE IF NOT EXISTS `conv` (
|
|||
-- TABLE deliverq
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `deliverq` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`cmd` varchar(32) NOT NULL DEFAULT '',
|
||||
`item` int(11) NOT NULL DEFAULT 0,
|
||||
`contact` int(11) NOT NULL DEFAULT 0
|
||||
`contact` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE dsprphotoq
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `dsprphotoq` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`msg` mediumtext NOT NULL,
|
||||
`attempt` tinyint(4) NOT NULL DEFAULT 0
|
||||
`attempt` tinyint(4) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE event
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `event` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -223,6 +234,7 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||
`allow_gid` mediumtext NOT NULL,
|
||||
`deny_cid` mediumtext NOT NULL,
|
||||
`deny_gid` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -230,7 +242,7 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||
-- TABLE fcontact
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -246,6 +258,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
|
|||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`pubkey` text NOT NULL,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `addr` (`addr`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -253,20 +266,22 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
|
|||
-- TABLE ffinder
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `ffinder` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`cid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`fid` int(10) unsigned NOT NULL DEFAULT 0
|
||||
`fid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE fserver
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `fserver` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`server` varchar(255) NOT NULL DEFAULT '',
|
||||
`posturl` varchar(255) NOT NULL DEFAULT '',
|
||||
`key` text NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `server` (`server`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -274,7 +289,7 @@ CREATE TABLE IF NOT EXISTS `fserver` (
|
|||
-- TABLE fsuggest
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `fsuggest` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -282,16 +297,18 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
|
|||
`request` varchar(255) NOT NULL DEFAULT '',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '',
|
||||
`note` text NOT NULL,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE gcign
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `gcign` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`gcid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `gcid` (`gcid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -300,7 +317,7 @@ CREATE TABLE IF NOT EXISTS `gcign` (
|
|||
-- TABLE gcontact
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `gcontact` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`nick` varchar(255) NOT NULL DEFAULT '',
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -315,11 +332,17 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
|
|||
`about` text NOT NULL,
|
||||
`keywords` text NOT NULL,
|
||||
`gender` varchar(32) NOT NULL DEFAULT '',
|
||||
`birthday` varchar(32) NOT NULL DEFAULT '0000-00-00',
|
||||
`community` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`hide` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`nsfw` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`network` varchar(255) NOT NULL DEFAULT '',
|
||||
`addr` varchar(255) NOT NULL DEFAULT '',
|
||||
`notify` text NOT NULL,
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`generation` tinyint(3) NOT NULL DEFAULT 0,
|
||||
`server_url` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `nurl` (`nurl`),
|
||||
INDEX `updated` (`updated`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -328,12 +351,13 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
|
|||
-- TABLE glink
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `glink` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`gcid` int(11) NOT NULL DEFAULT 0,
|
||||
`zcid` int(11) NOT NULL DEFAULT 0,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
|
||||
INDEX `gcid` (`gcid`),
|
||||
INDEX `zcid` (`zcid`)
|
||||
|
@ -343,11 +367,12 @@ CREATE TABLE IF NOT EXISTS `glink` (
|
|||
-- TABLE group
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `group` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`visible` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -355,10 +380,11 @@ CREATE TABLE IF NOT EXISTS `group` (
|
|||
-- TABLE group_member
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `group_member` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`gid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -366,7 +392,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
|
|||
-- TABLE gserver
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `gserver` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`nurl` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -381,6 +407,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
|
|||
`last_poco_query` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `nurl` (`nurl`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -388,11 +415,12 @@ CREATE TABLE IF NOT EXISTS `gserver` (
|
|||
-- TABLE guid
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `guid` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||
`plink` varchar(255) NOT NULL DEFAULT '',
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `guid` (`guid`),
|
||||
INDEX `plink` (`plink`),
|
||||
INDEX `uri` (`uri`)
|
||||
|
@ -402,11 +430,12 @@ CREATE TABLE IF NOT EXISTS `guid` (
|
|||
-- TABLE hook
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `hook` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`hook` varchar(255) NOT NULL DEFAULT '',
|
||||
`file` varchar(255) NOT NULL DEFAULT '',
|
||||
`function` varchar(255) NOT NULL DEFAULT '',
|
||||
`priority` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `hook_file_function` (`hook`(30),`file`(60),`function`(30))
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -414,7 +443,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
|
|||
-- TABLE intro
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `intro` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`fid` int(11) NOT NULL DEFAULT 0,
|
||||
`contact-id` int(11) NOT NULL DEFAULT 0,
|
||||
|
@ -424,18 +453,20 @@ CREATE TABLE IF NOT EXISTS `intro` (
|
|||
`hash` varchar(255) NOT NULL DEFAULT '',
|
||||
`datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`blocked` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`ignore` tinyint(1) NOT NULL DEFAULT 0
|
||||
`ignore` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE item
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `item` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`contact-id` int(11) NOT NULL DEFAULT 0,
|
||||
`gcontact-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`type` varchar(255) NOT NULL DEFAULT '',
|
||||
`wall` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`gravity` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -493,6 +524,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
|||
`rendered-hash` varchar(32) NOT NULL DEFAULT '',
|
||||
`rendered-html` mediumtext NOT NULL,
|
||||
`global` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `guid` (`guid`),
|
||||
INDEX `uri` (`uri`),
|
||||
INDEX `parent` (`parent`),
|
||||
|
@ -509,6 +541,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
|||
INDEX `uid_thrparent` (`uid`,`thr-parent`),
|
||||
INDEX `uid_parenturi` (`uid`,`parent-uri`),
|
||||
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
||||
INDEX `gcontactid_uid_created` (`gcontact-id`,`uid`,`created`),
|
||||
INDEX `wall_body` (`wall`,`body`(6)),
|
||||
INDEX `uid_visible_moderated_created` (`uid`,`visible`,`moderated`,`created`),
|
||||
INDEX `uid_uri` (`uid`,`uri`),
|
||||
|
@ -531,11 +564,12 @@ CREATE TABLE IF NOT EXISTS `item` (
|
|||
-- TABLE item_id
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `item_id` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`iid` int(11) NOT NULL DEFAULT 0,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`sid` varchar(255) NOT NULL DEFAULT '',
|
||||
`service` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `sid` (`sid`),
|
||||
INDEX `service` (`service`),
|
||||
|
@ -546,17 +580,18 @@ CREATE TABLE IF NOT EXISTS `item_id` (
|
|||
-- TABLE locks
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `locks` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(128) NOT NULL DEFAULT '',
|
||||
`locked` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created` datetime DEFAULT '0000-00-00 00:00:00'
|
||||
`created` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE mail
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `mail` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
||||
`from-name` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -573,6 +608,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
|||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`parent-uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `guid` (`guid`),
|
||||
INDEX `convid` (`convid`),
|
||||
|
@ -585,7 +621,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
|||
-- TABLE mailacct
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `mailacct` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`server` varchar(255) NOT NULL DEFAULT '',
|
||||
`port` int(11) NOT NULL DEFAULT 0,
|
||||
|
@ -597,16 +633,18 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
|
|||
`action` int(11) NOT NULL DEFAULT 0,
|
||||
`movetofolder` varchar(255) NOT NULL DEFAULT '',
|
||||
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
`last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE manage
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `manage` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`mid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid_mid` (`uid`,`mid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -614,7 +652,7 @@ CREATE TABLE IF NOT EXISTS `manage` (
|
|||
-- TABLE notify
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `notify` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`hash` varchar(64) NOT NULL DEFAULT '',
|
||||
`type` int(11) NOT NULL DEFAULT 0,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -629,6 +667,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
|
|||
`seen` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`verb` varchar(255) NOT NULL DEFAULT '',
|
||||
`otype` varchar(16) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -636,11 +675,12 @@ CREATE TABLE IF NOT EXISTS `notify` (
|
|||
-- TABLE notify-threads
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `notify-threads` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`notify-id` int(11) NOT NULL DEFAULT 0,
|
||||
`master-parent-item` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`parent-item` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`receiver-uid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `master-parent-item` (`master-parent-item`),
|
||||
INDEX `receiver-uid` (`receiver-uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -649,11 +689,12 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
|
|||
-- TABLE pconfig
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `pconfig` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`cat` varchar(255) NOT NULL DEFAULT '',
|
||||
`k` varchar(255) NOT NULL DEFAULT '',
|
||||
`v` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30))
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -661,7 +702,7 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
|
|||
-- TABLE photo
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `photo` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
||||
|
@ -683,6 +724,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
`allow_gid` mediumtext NOT NULL,
|
||||
`deny_cid` mediumtext NOT NULL,
|
||||
`deny_gid` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `resource-id` (`resource-id`),
|
||||
INDEX `guid` (`guid`)
|
||||
|
@ -692,7 +734,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
-- TABLE poll
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `poll` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`q0` mediumtext NOT NULL,
|
||||
`q1` mediumtext NOT NULL,
|
||||
|
@ -704,6 +746,7 @@ CREATE TABLE IF NOT EXISTS `poll` (
|
|||
`q7` mediumtext NOT NULL,
|
||||
`q8` mediumtext NOT NULL,
|
||||
`q9` mediumtext NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -711,9 +754,10 @@ CREATE TABLE IF NOT EXISTS `poll` (
|
|||
-- TABLE poll_result
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `poll_result` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`poll_id` int(11) NOT NULL DEFAULT 0,
|
||||
`choice` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `poll_id` (`poll_id`),
|
||||
INDEX `choice` (`choice`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -722,7 +766,7 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
|
|||
-- TABLE profile
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `profile` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`profile-name` varchar(255) NOT NULL DEFAULT '',
|
||||
`is-default` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -763,6 +807,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
|
|||
`thumb` varchar(255) NOT NULL DEFAULT '',
|
||||
`publish` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`net-publish` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `hometown` (`hometown`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -770,39 +815,42 @@ CREATE TABLE IF NOT EXISTS `profile` (
|
|||
-- TABLE profile_check
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `profile_check` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`cid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`dfrn_id` varchar(255) NOT NULL DEFAULT '',
|
||||
`sec` varchar(255) NOT NULL DEFAULT '',
|
||||
`expire` int(11) NOT NULL DEFAULT 0
|
||||
`expire` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE push_subscriber
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `push_subscriber` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`callback_url` varchar(255) NOT NULL DEFAULT '',
|
||||
`topic` varchar(255) NOT NULL DEFAULT '',
|
||||
`nickname` varchar(255) NOT NULL DEFAULT '',
|
||||
`push` int(11) NOT NULL DEFAULT 0,
|
||||
`last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`secret` varchar(255) NOT NULL DEFAULT ''
|
||||
`secret` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE queue
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `queue` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`content` mediumtext NOT NULL,
|
||||
`batch` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `cid` (`cid`),
|
||||
INDEX `created` (`created`),
|
||||
INDEX `last` (`last`),
|
||||
|
@ -814,21 +862,23 @@ CREATE TABLE IF NOT EXISTS `queue` (
|
|||
-- TABLE register
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `register` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`hash` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`uid` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`password` varchar(255) NOT NULL DEFAULT '',
|
||||
`language` varchar(16) NOT NULL DEFAULT ''
|
||||
`language` varchar(16) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE search
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `search` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`term` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `term` (`term`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -837,10 +887,11 @@ CREATE TABLE IF NOT EXISTS `search` (
|
|||
-- TABLE session
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `session` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`sid` varchar(255) NOT NULL DEFAULT '',
|
||||
`data` text NOT NULL,
|
||||
`expire` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `sid` (`sid`),
|
||||
INDEX `expire` (`expire`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -849,12 +900,13 @@ CREATE TABLE IF NOT EXISTS `session` (
|
|||
-- TABLE sign
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `sign` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`iid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`retract_iid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`signed_text` mediumtext NOT NULL,
|
||||
`signature` text NOT NULL,
|
||||
`signer` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `iid` (`iid`),
|
||||
INDEX `retract_iid` (`retract_iid`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
@ -863,12 +915,13 @@ CREATE TABLE IF NOT EXISTS `sign` (
|
|||
-- TABLE spam
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `spam` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`spam` int(11) NOT NULL DEFAULT 0,
|
||||
`ham` int(11) NOT NULL DEFAULT 0,
|
||||
`term` varchar(255) NOT NULL DEFAULT '',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `spam` (`spam`),
|
||||
INDEX `ham` (`ham`),
|
||||
|
@ -879,7 +932,7 @@ CREATE TABLE IF NOT EXISTS `spam` (
|
|||
-- TABLE term
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `term` (
|
||||
`tid` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`tid` int(10) unsigned NOT NULL auto_increment,
|
||||
`oid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`otype` tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
`type` tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -891,6 +944,7 @@ CREATE TABLE IF NOT EXISTS `term` (
|
|||
`global` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`aid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`tid`),
|
||||
INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`),
|
||||
INDEX `uid_term_tid` (`uid`,`term`,`tid`),
|
||||
INDEX `type_term` (`type`,`term`),
|
||||
|
@ -903,9 +957,10 @@ CREATE TABLE IF NOT EXISTS `term` (
|
|||
-- TABLE thread
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `thread` (
|
||||
`iid` int(10) unsigned NOT NULL DEFAULT 0 PRIMARY KEY,
|
||||
`iid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`contact-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`gcontact-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
|
@ -926,12 +981,15 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
|||
`forum_mode` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`mention` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`iid`),
|
||||
INDEX `created` (`created`),
|
||||
INDEX `commented` (`commented`),
|
||||
INDEX `uid_network_commented` (`uid`,`network`,`commented`),
|
||||
INDEX `uid_network_created` (`uid`,`network`,`created`),
|
||||
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
|
||||
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
||||
INDEX `uid_gcontactid_commented` (`uid`,`gcontact-id`,`commented`),
|
||||
INDEX `uid_gcontactid_created` (`uid`,`gcontact-id`,`created`),
|
||||
INDEX `wall_private_received` (`wall`,`private`,`received`),
|
||||
INDEX `uid_created` (`uid`,`created`),
|
||||
INDEX `uid_commented` (`uid`,`commented`)
|
||||
|
@ -941,33 +999,20 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
|||
-- TABLE tokens
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `tokens` (
|
||||
`id` varchar(40) NOT NULL PRIMARY KEY,
|
||||
`id` varchar(40) NOT NULL,
|
||||
`secret` text NOT NULL,
|
||||
`client_id` varchar(20) NOT NULL DEFAULT '',
|
||||
`expires` int(11) NOT NULL DEFAULT 0,
|
||||
`scope` varchar(200) NOT NULL DEFAULT '',
|
||||
`uid` int(11) NOT NULL DEFAULT 0
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE unique_contacts
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `unique_contacts` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`nick` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`avatar` varchar(255) NOT NULL DEFAULT '',
|
||||
`location` varchar(255) NOT NULL DEFAULT '',
|
||||
`about` text NOT NULL,
|
||||
INDEX `url` (`url`)
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- TABLE user
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `user` (
|
||||
`uid` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`uid` int(11) NOT NULL auto_increment,
|
||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
||||
`username` varchar(255) NOT NULL DEFAULT '',
|
||||
`password` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -1009,6 +1054,7 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
`deny_cid` mediumtext NOT NULL,
|
||||
`deny_gid` mediumtext NOT NULL,
|
||||
`openidserver` text NOT NULL,
|
||||
PRIMARY KEY(`uid`),
|
||||
INDEX `nickname` (`nickname`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1016,8 +1062,9 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
-- TABLE userd
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `userd` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`username` varchar(255) NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `username` (`username`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1025,12 +1072,13 @@ CREATE TABLE IF NOT EXISTS `userd` (
|
|||
-- TABLE workerqueue
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `workerqueue` (
|
||||
`id` int(11) NOT NULL auto_increment PRIMARY KEY,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`parameter` text NOT NULL,
|
||||
`priority` tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`pid` int(11) NOT NULL DEFAULT 0,
|
||||
`executed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `created` (`created`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ Database Tables
|
|||
| [term](help/database/db_term) | item taxonomy (categories, tags, etc.) table |
|
||||
| [thread](help/database/db_thread) | |
|
||||
| [tokens](help/database/db_tokens) | OAuth usage |
|
||||
| [unique_contacts](help/database/db_unique_contacts) | |
|
||||
| [user](help/database/db_user) | local user table |
|
||||
| [userd](help/database/db_userd) | |
|
||||
| [workerqueue](help/database/db_workerqueue) | |
|
||||
|
|
|
@ -18,9 +18,14 @@ Table gcontact
|
|||
| about | | text | NO | | NULL | |
|
||||
| keywords | puplic keywords (interests) | text | NO | | NULL | |
|
||||
| gender | | varchar(32) | NO | | | |
|
||||
| birthday | | varchar(32) | NO | | 0000-00-00 | |
|
||||
| community | 1 if contact is forum account | tinyint(1) | NO | | 0 | |
|
||||
| hide | 1 = should be hidden from search | tinyint(1) | NO | | 0 | |
|
||||
| nsfw | 1 = contact posts nsfw content | tinyint(1) | NO | | 0 | |
|
||||
| network | social network protocol | varchar(255) | NO | | | |
|
||||
| addr | | varchar(255) | NO | | | |
|
||||
| notify | | text | NO | | | |
|
||||
| alias | | varchar(255) | NO | | | |
|
||||
| generation | | tinyint(3) | NO | | 0 | |
|
||||
| server_url | baseurl of the contacts server | varchar(255) | NO | | | |
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ Table item
|
|||
| uri | | varchar(255) | NO | MUL | | |
|
||||
| uid | user.id which owns this copy of the item | int(10) unsigned | NO | MUL | 0 | |
|
||||
| contact-id | contact.id | int(11) | NO | MUL | 0 | |
|
||||
| gcontact-id | ID of the global contact | int(11) | NO | MUL | 0 | |
|
||||
| type | | varchar(255) | NO | | | |
|
||||
| wall | This item was posted to the wall of uid | tinyint(1) | NO | MUL | 0 | |
|
||||
| gravity | | tinyint(1) | NO | | 0 | |
|
||||
|
|
|
@ -2,10 +2,11 @@ Table thread
|
|||
============
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
|------------|------------------|------------------|------|-----|---------------------|-------|
|
||||
|-------------|------------------|------------------|------|-----|---------------------|-------|
|
||||
| iid | sequential ID | int(10) unsigned | NO | PRI | 0 | |
|
||||
| uid | | int(10) unsigned | NO | MUL | 0 | |
|
||||
| contact-id | | int(11) unsigned | NO | | 0 | |
|
||||
| gcontact-id | Global Contact | int(11) unsigned | NO | | 0 | |
|
||||
| created | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
|
||||
| edited | | datetime | NO | | 0000-00-00 00:00:00 | |
|
||||
| commented | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
Table unique_contacts
|
||||
=====================
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
|----------|------------------|--------------|------|-----|---------|----------------|
|
||||
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| url | | varchar(255) | NO | MUL | | |
|
||||
| nick | | varchar(255) | NO | | | |
|
||||
| name | | varchar(255) | NO | | | |
|
||||
| avatar | | varchar(255) | NO | | | |
|
||||
| location | | varchar(255) | NO | | | |
|
||||
| about | | text | NO | | NULL | |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -1657,35 +1657,6 @@ LOCK TABLES `tokens` WRITE;
|
|||
/*!40000 ALTER TABLE `tokens` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `unique_contacts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `unique_contacts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `unique_contacts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`nick` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`avatar` varchar(255) NOT NULL DEFAULT '',
|
||||
`location` varchar(255) NOT NULL DEFAULT '',
|
||||
`about` text NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `url` (`url`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `unique_contacts`
|
||||
--
|
||||
|
||||
LOCK TABLES `unique_contacts` WRITE;
|
||||
/*!40000 ALTER TABLE `unique_contacts` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `unique_contacts` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `user`
|
||||
--
|
||||
|
|
|
@ -205,19 +205,6 @@ function get_contact_details_by_url($url, $uid = -1) {
|
|||
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND
|
||||
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
||||
proc_run('php',"include/update_gcontact.php", $profile["gid"]);
|
||||
|
||||
} else {
|
||||
$r = q("SELECT `url`, `name`, `nick`, `avatar` AS `photo`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'",
|
||||
dbesc(normalise_link($url)));
|
||||
|
||||
if (count($r)) {
|
||||
$profile = $r[0];
|
||||
$profile["keywords"] = "";
|
||||
$profile["gender"] = "";
|
||||
$profile["community"] = false;
|
||||
$profile["network"] = "";
|
||||
$profile["addr"] = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Fetching further contact data from the contact table
|
||||
|
@ -415,6 +402,7 @@ function get_contact($url, $uid = 0) {
|
|||
$contactid = 0;
|
||||
|
||||
// is it an address in the format user@server.tld?
|
||||
/// @todo use gcontact and/or the addr field for a lookup
|
||||
if (!strstr($url, "http") OR strstr($url, "@")) {
|
||||
$data = probe_url($url);
|
||||
$url = $data["url"];
|
||||
|
@ -513,3 +501,165 @@ function get_contact($url, $uid = 0) {
|
|||
|
||||
return $contactid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns posts from a given gcontact
|
||||
*
|
||||
* @param App $a argv application class
|
||||
* @param int $gcontact_id Global contact
|
||||
*
|
||||
* @return string posts in HTML
|
||||
*/
|
||||
function posts_from_gcontact($a, $gcontact_id) {
|
||||
|
||||
require_once('include/conversation.php');
|
||||
|
||||
// There are no posts with "uid = 0" with connector networks
|
||||
// This speeds up the query a lot
|
||||
$r = q("SELECT `network` FROM `gcontact` WHERE `id` = %d", dbesc($gcontact_id));
|
||||
if (in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, "")))
|
||||
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = %d AND `item`.`private`))";
|
||||
else
|
||||
$sql = "`item`.`uid` = %d";
|
||||
|
||||
if(get_config('system', 'old_pager')) {
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `item`
|
||||
WHERE `gcontact-id` = %d and $sql",
|
||||
intval($gcontact_id),
|
||||
intval(local_user()));
|
||||
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
FROM `item` FORCE INDEX (`gcontactid_uid_created`)
|
||||
WHERE `gcontact-id` = %d AND $sql AND
|
||||
NOT `deleted` AND NOT `moderated` AND `visible`
|
||||
ORDER BY `item`.`created` DESC LIMIT %d, %d",
|
||||
intval($gcontact_id),
|
||||
intval(local_user()),
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
$o = conversation($a,$r,'community',false);
|
||||
|
||||
if(!get_config('system', 'old_pager')) {
|
||||
$o .= alt_pager($a,count($r));
|
||||
} else {
|
||||
$o .= paginate($a);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set the gcontact-id in all item entries
|
||||
*
|
||||
* This job has to be started multiple times until all entries are set.
|
||||
* It isn't started in the update function since it would consume too much time and can be done in the background.
|
||||
*/
|
||||
function item_set_gcontact() {
|
||||
define ('POST_UPDATE_VERSION', 1192);
|
||||
|
||||
// Was the script completed?
|
||||
if (get_config("system", "post_update_version") >= POST_UPDATE_VERSION)
|
||||
return;
|
||||
|
||||
// Check if the first step is done (Setting "gcontact-id" in the item table)
|
||||
$r = q("SELECT `author-link`, `author-name`, `author-avatar`, `uid`, `network` FROM `item` WHERE `gcontact-id` = 0 LIMIT 1000");
|
||||
if (!$r) {
|
||||
// Are there unfinished entries in the thread table?
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `thread`
|
||||
INNER JOIN `item` ON `item`.`id` =`thread`.`iid`
|
||||
WHERE `thread`.`gcontact-id` = 0 AND
|
||||
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
||||
|
||||
if ($r AND ($r[0]["total"] == 0)) {
|
||||
set_config("system", "post_update_version", POST_UPDATE_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update the thread table from the item table
|
||||
q("UPDATE `thread` INNER JOIN `item` ON `item`.`id`=`thread`.`iid`
|
||||
SET `thread`.`gcontact-id` = `item`.`gcontact-id`
|
||||
WHERE `thread`.`gcontact-id` = 0 AND
|
||||
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$item_arr = array();
|
||||
foreach ($r AS $item) {
|
||||
$index = $item["author-link"]."-".$item["uid"];
|
||||
$item_arr[$index] = array("author-link" => $item["author-link"],
|
||||
"uid" => $item["uid"],
|
||||
"network" => $item["network"]);
|
||||
}
|
||||
|
||||
// Set the "gcontact-id" in the item table and add a new gcontact entry if needed
|
||||
foreach($item_arr AS $item) {
|
||||
$gcontact_id = get_gcontact_id(array("url" => $item['author-link'], "network" => $item['network'],
|
||||
"photo" => $item['author-avatar'], "name" => $item['author-name']));
|
||||
q("UPDATE `item` SET `gcontact-id` = %d WHERE `uid` = %d AND `author-link` = '%s' AND `gcontact-id` = 0",
|
||||
intval($gcontact_id), intval($item["uid"]), dbesc($item["author-link"]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns posts from a given contact
|
||||
*
|
||||
* @param App $a argv application class
|
||||
* @param int $contact_id contact
|
||||
*
|
||||
* @return string posts in HTML
|
||||
*/
|
||||
function posts_from_contact($a, $contact_id) {
|
||||
|
||||
require_once('include/conversation.php');
|
||||
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
if (!$r)
|
||||
return false;
|
||||
|
||||
$contact = $r[0];
|
||||
|
||||
if(get_config('system', 'old_pager')) {
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `item`
|
||||
WHERE `item`.`uid` = %d AND `author-link` IN ('%s', '%s')",
|
||||
intval(local_user()),
|
||||
dbesc(str_replace("https://", "http://", $contact["url"])),
|
||||
dbesc(str_replace("http://", "https://", $contact["url"])));
|
||||
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
FROM `item` FORCE INDEX (`uid_contactid_created`)
|
||||
WHERE `item`.`uid` = %d AND `contact-id` = %d
|
||||
AND `author-link` IN ('%s', '%s')
|
||||
AND NOT `deleted` AND NOT `moderated` AND `visible`
|
||||
ORDER BY `item`.`created` DESC LIMIT %d, %d",
|
||||
intval(local_user()),
|
||||
intval($contact_id),
|
||||
dbesc(str_replace("https://", "http://", $contact["url"])),
|
||||
dbesc(str_replace("http://", "https://", $contact["url"])),
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
$o .= conversation($a,$r,'community',false);
|
||||
|
||||
if(!get_config('system', 'old_pager'))
|
||||
$o .= alt_pager($a,count($r));
|
||||
else
|
||||
$o .= paginate($a);
|
||||
|
||||
return $o;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -407,7 +407,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
$search = $_REQUEST['query'];
|
||||
}
|
||||
|
||||
// logger("Searching for ".$search." - type ".$type, LOGGER_DEBUG);
|
||||
logger("Searching for ".$search." - type ".$type, LOGGER_DEBUG);
|
||||
|
||||
if ($search!=""){
|
||||
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
|
||||
|
@ -503,7 +503,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
}
|
||||
}
|
||||
|
||||
if ($type=='' || $type=='c'){
|
||||
if ($type==''){
|
||||
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
||||
|
@ -514,6 +514,17 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
}
|
||||
elseif ($type=='c'){
|
||||
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
||||
AND NOT (`network` IN ('%s'))
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
}
|
||||
elseif($type == 'm') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
|
||||
|
|
|
@ -393,7 +393,7 @@
|
|||
* Contact url or False if contact id is unknown
|
||||
*/
|
||||
function api_unique_id_to_url($id){
|
||||
$r = q("SELECT `url` FROM `unique_contacts` WHERE `id`=%d LIMIT 1",
|
||||
$r = q("SELECT `url` FROM `gcontact` WHERE `id`=%d LIMIT 1",
|
||||
intval($id));
|
||||
if ($r)
|
||||
return ($r[0]["url"]);
|
||||
|
@ -503,9 +503,7 @@
|
|||
$r = array();
|
||||
|
||||
if ($url != "")
|
||||
$r = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", $url);
|
||||
elseif ($nick != "")
|
||||
$r = q("SELECT * FROM `unique_contacts` WHERE `nick`='%s' LIMIT 1", $nick);
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `nurl`='%s' LIMIT 1", dbesc(normalise_link($url)));
|
||||
|
||||
if ($r) {
|
||||
// If no nick where given, extract it from the address
|
||||
|
@ -517,14 +515,14 @@
|
|||
'id_str' => (string) $r[0]["id"],
|
||||
'name' => $r[0]["name"],
|
||||
'screen_name' => (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']),
|
||||
'location' => NULL,
|
||||
'description' => NULL,
|
||||
'location' => $r[0]["location"],
|
||||
'description' => $r[0]["about"],
|
||||
'url' => $r[0]["url"],
|
||||
'protected' => false,
|
||||
'followers_count' => 0,
|
||||
'friends_count' => 0,
|
||||
'listed_count' => 0,
|
||||
'created_at' => api_date(0),
|
||||
'created_at' => api_date($r[0]["created"]),
|
||||
'favourites_count' => 0,
|
||||
'utc_offset' => 0,
|
||||
'time_zone' => 'UTC',
|
||||
|
@ -535,8 +533,8 @@
|
|||
'contributors_enabled' => false,
|
||||
'is_translator' => false,
|
||||
'is_translation_enabled' => false,
|
||||
'profile_image_url' => $r[0]["avatar"],
|
||||
'profile_image_url_https' => $r[0]["avatar"],
|
||||
'profile_image_url' => $r[0]["photo"],
|
||||
'profile_image_url_https' => $r[0]["photo"],
|
||||
'following' => false,
|
||||
'follow_request_sent' => false,
|
||||
'notifications' => false,
|
||||
|
@ -546,7 +544,7 @@
|
|||
'uid' => 0,
|
||||
'cid' => 0,
|
||||
'self' => 0,
|
||||
'network' => '',
|
||||
'network' => $r[0]["network"],
|
||||
);
|
||||
|
||||
return $ret;
|
||||
|
@ -617,22 +615,14 @@
|
|||
$uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
|
||||
}
|
||||
|
||||
// Fetching unique id
|
||||
$r = q("SELECT id FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
|
||||
|
||||
// If not there, then add it
|
||||
if (count($r) == 0) {
|
||||
q("INSERT INTO `unique_contacts` (`url`, `name`, `nick`, `avatar`) VALUES ('%s', '%s', '%s', '%s')",
|
||||
dbesc(normalise_link($uinfo[0]['url'])), dbesc($uinfo[0]['name']),dbesc($uinfo[0]['nick']), dbesc($uinfo[0]['micro']));
|
||||
|
||||
$r = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
|
||||
}
|
||||
|
||||
$network_name = network_to_name($uinfo[0]['network'], $uinfo[0]['url']);
|
||||
|
||||
$gcontact_id = get_gcontact_id(array("url" => $uinfo[0]['url'], "network" => $uinfo[0]['network'],
|
||||
"photo" => $uinfo[0]['micro'], "name" => $uinfo[0]['name']));
|
||||
|
||||
$ret = Array(
|
||||
'id' => intval($r[0]['id']),
|
||||
'id_str' => (string) intval($r[0]['id']),
|
||||
'id' => intval($gcontact_id),
|
||||
'id_str' => (string) intval($gcontact_id),
|
||||
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
|
||||
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
|
||||
'location' => ($usr) ? $usr[0]['default-location'] : $network_name,
|
||||
|
@ -666,45 +656,12 @@
|
|||
|
||||
function api_item_get_user(&$a, $item) {
|
||||
|
||||
$author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($item['author-link'])));
|
||||
// Make sure that there is an entry in the global contacts for author and owner
|
||||
get_gcontact_id(array("url" => $item['author-link'], "network" => $item['network'],
|
||||
"photo" => $item['author-avatar'], "name" => $item['author-name']));
|
||||
|
||||
if (count($author) == 0) {
|
||||
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`) VALUES ('%s', '%s', '%s')",
|
||||
dbesc(normalise_link($item["author-link"])), dbesc($item["author-name"]), dbesc($item["author-avatar"]));
|
||||
|
||||
$author = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($item['author-link'])));
|
||||
} else if ($item["author-link"].$item["author-name"] != $author[0]["url"].$author[0]["name"]) {
|
||||
$r = q("SELECT `id` FROM `unique_contacts` WHERE `name` = '%s' AND `avatar` = '%s' AND url = '%s'",
|
||||
dbesc($item["author-name"]), dbesc($item["author-avatar"]),
|
||||
dbesc(normalise_link($item["author-link"])));
|
||||
|
||||
if (!$r)
|
||||
q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
|
||||
dbesc($item["author-name"]), dbesc($item["author-avatar"]),
|
||||
dbesc(normalise_link($item["author-link"])));
|
||||
}
|
||||
|
||||
$owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($item['owner-link'])));
|
||||
|
||||
if (count($owner) == 0) {
|
||||
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`) VALUES ('%s', '%s', '%s')",
|
||||
dbesc(normalise_link($item["owner-link"])), dbesc($item["owner-name"]), dbesc($item["owner-avatar"]));
|
||||
|
||||
$owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($item['owner-link'])));
|
||||
} else if ($item["owner-link"].$item["owner-name"] != $owner[0]["url"].$owner[0]["name"]) {
|
||||
$r = q("SELECT `id` FROM `unique_contacts` WHERE `name` = '%s' AND `avatar` = '%s' AND url = '%s'",
|
||||
dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
|
||||
dbesc(normalise_link($item["owner-link"])));
|
||||
|
||||
if (!$r)
|
||||
q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
|
||||
dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
|
||||
dbesc(normalise_link($item["owner-link"])));
|
||||
}
|
||||
get_gcontact_id(array("url" => $item['owner-link'], "network" => $item['network'],
|
||||
"photo" => $item['owner-avatar'], "name" => $item['owner-name']));
|
||||
|
||||
// Comments in threads may appear as wall-to-wall postings.
|
||||
// So only take the owner at the top posting.
|
||||
|
@ -1073,7 +1030,7 @@
|
|||
$in_reply_to_status_id= intval($lastwall['parent']);
|
||||
$in_reply_to_status_id_str = (string) intval($lastwall['parent']);
|
||||
|
||||
$r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($lastwall['item-author'])));
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($lastwall['item-author'])));
|
||||
if ($r) {
|
||||
if ($r[0]['nick'] == "")
|
||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||
|
@ -1195,7 +1152,7 @@
|
|||
$in_reply_to_status_id = intval($lastwall['parent']);
|
||||
$in_reply_to_status_id_str = (string) intval($lastwall['parent']);
|
||||
|
||||
$r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($reply[0]['item-author'])));
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($reply[0]['item-author'])));
|
||||
if ($r) {
|
||||
if ($r[0]['nick'] == "")
|
||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||
|
@ -1256,9 +1213,9 @@
|
|||
$userlist = array();
|
||||
|
||||
if (isset($_GET["q"])) {
|
||||
$r = q("SELECT id FROM `unique_contacts` WHERE `name`='%s'", dbesc($_GET["q"]));
|
||||
$r = q("SELECT id FROM `gcontact` WHERE `name`='%s'", dbesc($_GET["q"]));
|
||||
if (!count($r))
|
||||
$r = q("SELECT `id` FROM `unique_contacts` WHERE `nick`='%s'", dbesc($_GET["q"]));
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nick`='%s'", dbesc($_GET["q"]));
|
||||
|
||||
if (count($r)) {
|
||||
foreach ($r AS $user) {
|
||||
|
@ -2341,7 +2298,7 @@
|
|||
intval(api_user()),
|
||||
intval($in_reply_to_status_id));
|
||||
if ($r) {
|
||||
$r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($r[0]['author-link'])));
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `url` = '%s'", dbesc(normalise_link($r[0]['author-link'])));
|
||||
|
||||
if ($r) {
|
||||
if ($r[0]['nick'] == "")
|
||||
|
@ -2596,7 +2553,7 @@
|
|||
|
||||
$stringify_ids = (x($_REQUEST,'stringify_ids')?$_REQUEST['stringify_ids']:false);
|
||||
|
||||
$r = q("SELECT `unique_contacts`.`id` FROM `contact`, `unique_contacts` WHERE `contact`.`nurl` = `unique_contacts`.`url` AND `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` $sql_extra",
|
||||
$r = q("SELECT `gcontact`.`id` FROM `contact`, `gcontact` WHERE `contact`.`nurl` = `gcontact`.`nurl` AND `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` $sql_extra",
|
||||
intval(api_user())
|
||||
);
|
||||
|
||||
|
@ -3094,11 +3051,8 @@
|
|||
|
||||
//}
|
||||
|
||||
if ($nick != "") {
|
||||
q("UPDATE `unique_contacts` SET `nick` = '%s' WHERE `nick` != '%s' AND url = '%s'",
|
||||
dbesc($nick), dbesc($nick), dbesc(normalise_link($profile)));
|
||||
if ($nick != "")
|
||||
return($nick);
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ require_once("include/oembed.php");
|
|||
require_once('include/event.php');
|
||||
require_once('include/map.php');
|
||||
require_once('mod/proxy.php');
|
||||
require_once('include/Contact.php');
|
||||
|
||||
function bb_PictureCacheExt($matches) {
|
||||
if (strpos($matches[3], "data:image/") === 0)
|
||||
|
@ -541,9 +542,24 @@ function bb_ShareAttributes($share, $simplehtml) {
|
|||
$reldate = (($posted) ? " " . relative_date($posted) : '');
|
||||
}
|
||||
|
||||
$userid = GetProfileUsername($profile,$author, false);
|
||||
$data = get_contact_details_by_url($profile);
|
||||
|
||||
if (isset($data["name"]) AND isset($data["addr"]))
|
||||
$userid_compact = $data["name"]." (".$data["addr"].")";
|
||||
else
|
||||
$userid_compact = GetProfileUsername($profile,$author, true);
|
||||
|
||||
if (isset($data["addr"]))
|
||||
$userid = $data["addr"];
|
||||
else
|
||||
$userid = GetProfileUsername($profile,$author, false);
|
||||
|
||||
if (isset($data["name"]))
|
||||
$author = $data["name"];
|
||||
|
||||
if (isset($data["photo"]))
|
||||
$avatar = $data["photo"];
|
||||
|
||||
$preshare = trim($share[1]);
|
||||
|
||||
if ($preshare != "")
|
||||
|
|
|
@ -133,9 +133,8 @@ function cron_run(&$argv, &$argc){
|
|||
// Check every conversation
|
||||
check_conversations(false);
|
||||
|
||||
// Follow your friends from your legacy OStatus account
|
||||
// Doesn't work
|
||||
// ostatus_check_follow_friends();
|
||||
// Set the gcontact-id in the item table if missing
|
||||
item_set_gcontact();
|
||||
|
||||
// update nodeinfo data
|
||||
nodeinfo_cron();
|
||||
|
|
|
@ -666,9 +666,14 @@ function db_definition() {
|
|||
"about" => array("type" => "text", "not null" => "1"),
|
||||
"keywords" => array("type" => "text", "not null" => "1"),
|
||||
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
|
||||
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"notify" => array("type" => "text", "not null" => "1"),
|
||||
"alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
|
||||
"server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
),
|
||||
|
@ -795,6 +800,7 @@ function db_definition() {
|
|||
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||
"contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
|
@ -871,6 +877,7 @@ function db_definition() {
|
|||
"uid_thrparent" => array("uid","thr-parent"),
|
||||
"uid_parenturi" => array("uid","parent-uri"),
|
||||
"uid_contactid_created" => array("uid","contact-id","created"),
|
||||
"gcontactid_uid_created" => array("gcontact-id","uid","created"),
|
||||
"wall_body" => array("wall","body(6)"),
|
||||
"uid_visible_moderated_created" => array("uid","visible","moderated","created"),
|
||||
"uid_uri" => array("uid","uri"),
|
||||
|
@ -1287,6 +1294,7 @@ function db_definition() {
|
|||
"iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
|
||||
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||
"contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
|
@ -1316,6 +1324,8 @@ function db_definition() {
|
|||
"uid_network_created" => array("uid","network","created"),
|
||||
"uid_contactid_commented" => array("uid","contact-id","commented"),
|
||||
"uid_contactid_created" => array("uid","contact-id","created"),
|
||||
"uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
|
||||
"uid_gcontactid_created" => array("uid","gcontact-id","created"),
|
||||
"wall_private_received" => array("wall","private","received"),
|
||||
"uid_created" => array("uid","created"),
|
||||
"uid_commented" => array("uid","commented"),
|
||||
|
@ -1334,21 +1344,6 @@ function db_definition() {
|
|||
"PRIMARY" => array("id"),
|
||||
)
|
||||
);
|
||||
$database["unique_contacts"] = array(
|
||||
"fields" => array(
|
||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"about" => array("type" => "text", "not null" => "1"),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
"url" => array("url"),
|
||||
)
|
||||
);
|
||||
$database["user"] = array(
|
||||
"fields" => array(
|
||||
"uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
|
|
|
@ -2407,10 +2407,10 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
if(! $contact)
|
||||
return;
|
||||
|
||||
if($contact['blocked']) {
|
||||
logger('diaspora_post: Ignoring this author.');
|
||||
return 202;
|
||||
}
|
||||
//if($contact['blocked']) {
|
||||
// logger('diaspora_post: Ignoring this author.');
|
||||
// return 202;
|
||||
//}
|
||||
|
||||
$name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : '');
|
||||
$image_url = unxmlify($xml->image_url);
|
||||
|
@ -2418,6 +2418,8 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
$location = diaspora2bb(unxmlify($xml->location));
|
||||
$about = diaspora2bb(unxmlify($xml->bio));
|
||||
$gender = unxmlify($xml->gender);
|
||||
$searchable = (unxmlify($xml->searchable) == "true");
|
||||
$nsfw = (unxmlify($xml->nsfw) == "true");
|
||||
$tags = unxmlify($xml->tag_string);
|
||||
|
||||
$tags = explode("#", $tags);
|
||||
|
@ -2432,6 +2434,8 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
$keywords = implode(", ", $keywords);
|
||||
|
||||
$handle_parts = explode("@", $diaspora_handle);
|
||||
$nick = $handle_parts[0];
|
||||
|
||||
if($name === '') {
|
||||
$name = $handle_parts[0];
|
||||
}
|
||||
|
@ -2466,10 +2470,12 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
/// @TODO Update name on item['author-name'] if the name changed. See consume_feed()
|
||||
/// (Not doing this currently because D* protocol is scheduled for revision soon).
|
||||
|
||||
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||
$r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($diaspora_handle),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($images[0]),
|
||||
dbesc($image_url),
|
||||
dbesc($images[1]),
|
||||
dbesc($images[2]),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -2482,26 +2488,17 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
intval($importer['uid'])
|
||||
);
|
||||
|
||||
if (unxmlify($xml->searchable) == "true") {
|
||||
if ($searchable) {
|
||||
require_once('include/socgraph.php');
|
||||
poco_check($contact['url'], $name, NETWORK_DIASPORA, $images[0], $about, $location, $gender, $keywords, "",
|
||||
poco_check($contact['url'], $name, NETWORK_DIASPORA, $image_url, $about, $location, $gender, $keywords, "",
|
||||
datetime_convert(), 2, $contact['id'], $importer['uid']);
|
||||
}
|
||||
|
||||
$profileurl = "";
|
||||
$author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact['url'])));
|
||||
|
||||
if (count($author) == 0) {
|
||||
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`, `location`, `about`) VALUES ('%s', '%s', '%s', '%s', '%s')",
|
||||
dbesc(normalise_link($contact['url'])), dbesc($name), dbesc($location), dbesc($about), dbesc($images[0]));
|
||||
|
||||
$author = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact['url'])));
|
||||
} else if (normalise_link($contact['url']).$name.$location.$about != normalise_link($author[0]["url"]).$author[0]["name"].$author[0]["location"].$author[0]["about"]) {
|
||||
q("UPDATE unique_contacts SET name = '%s', avatar = '%s', `location` = '%s', `about` = '%s' WHERE url = '%s'",
|
||||
dbesc($name), dbesc($images[0]), dbesc($location), dbesc($about), dbesc(normalise_link($contact['url'])));
|
||||
}
|
||||
update_gcontact(array("url" => $contact['url'], "network" => NETWORK_DIASPORA, "generation" => 2,
|
||||
"photo" => $image_url, "name" => $name, "location" => $location,
|
||||
"about" => $about, "birthday" => $birthday, "gender" => $gender,
|
||||
"addr" => $diaspora_handle, "nick" => $nick, "keywords" => $keywords,
|
||||
"hide" => !$searchable, "nsfw" => $nsfw));
|
||||
|
||||
/* if($r) {
|
||||
if($oldphotos) {
|
||||
|
@ -2643,11 +2640,12 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
|||
}
|
||||
|
||||
logger('diaspora_send_status: '.$owner['username'].' -> '.$contact['name'].' base message: '.$msg, LOGGER_DATA);
|
||||
logger('send guid '.$item['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
$return_code = diaspora_transmit($owner,$contact,$slap,$public_batch);
|
||||
$return_code = diaspora_transmit($owner,$contact,$slap,$public_batch,false,$item['guid']);
|
||||
|
||||
logger('diaspora_send_status: guid: '.$item['guid'].' result '.$return_code, LOGGER_DEBUG);
|
||||
|
||||
|
@ -2758,10 +2756,12 @@ function diaspora_send_images($item,$owner,$contact,$images,$public_batch = fals
|
|||
|
||||
|
||||
logger('diaspora_send_photo: base message: ' . $msg, LOGGER_DATA);
|
||||
logger('send guid '.$r[0]['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
diaspora_transmit($owner,$contact,$slap,$public_batch);
|
||||
diaspora_transmit($owner,$contact,$slap,$public_batch,false,$r[0]['guid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2832,11 +2832,12 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
|
|||
));
|
||||
|
||||
logger('diaspora_followup: base message: ' . $msg, LOGGER_DATA);
|
||||
logger('send guid '.$item['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch));
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch,false,$item['guid']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2968,12 +2969,12 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
|
|||
));
|
||||
|
||||
logger('diaspora_send_relay: base message: ' . $msg, LOGGER_DATA);
|
||||
|
||||
logger('send guid '.$item['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch));
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch,false,$item['guid']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -3005,10 +3006,12 @@ function diaspora_send_retraction($item,$owner,$contact,$public_batch = false) {
|
|||
'$signature' => xmlify(base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256')))
|
||||
));
|
||||
|
||||
logger('send guid '.$item['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch));
|
||||
return(diaspora_transmit($owner,$contact,$slap,$public_batch,false,$item['guid']));
|
||||
}
|
||||
|
||||
function diaspora_send_mail($item,$owner,$contact) {
|
||||
|
@ -3065,16 +3068,17 @@ function diaspora_send_mail($item,$owner,$contact) {
|
|||
}
|
||||
|
||||
logger('diaspora_conversation: ' . print_r($xmsg,true), LOGGER_DATA);
|
||||
logger('send guid '.$item['guid'], LOGGER_DEBUG);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($xmsg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],false)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($xmsg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],false));
|
||||
|
||||
return(diaspora_transmit($owner,$contact,$slap,false));
|
||||
return(diaspora_transmit($owner,$contact,$slap,false,false,$item['guid']));
|
||||
|
||||
|
||||
}
|
||||
|
||||
function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false) {
|
||||
function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false,$guid = "") {
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
|
@ -3089,7 +3093,7 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false)
|
|||
return 0;
|
||||
}
|
||||
|
||||
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
|
||||
logger('diaspora_transmit: '.$logid.'-'.$guid.' '.$dest_url);
|
||||
|
||||
if( (! $queue_run) && (was_recently_delayed($contact['id'])) ) {
|
||||
$return_code = 0;
|
||||
|
@ -3104,7 +3108,7 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false)
|
|||
}
|
||||
}
|
||||
|
||||
logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
|
||||
logger('diaspora_transmit: '.$logid.'-'.$guid.' returns: '.$return_code);
|
||||
|
||||
if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
|
||||
logger('diaspora_transmit: queue message');
|
||||
|
|
|
@ -297,17 +297,26 @@ function group_side($every="contacts",$each="group",$editmode = "standard", $gro
|
|||
return $o;
|
||||
}
|
||||
|
||||
function expand_groups($a,$check_dead = false) {
|
||||
function expand_groups($a,$check_dead = false, $use_gcontact = false) {
|
||||
if(! (is_array($a) && count($a)))
|
||||
return array();
|
||||
$groups = implode(',', $a);
|
||||
$groups = dbesc($groups);
|
||||
|
||||
if ($use_gcontact)
|
||||
$r = q("SELECT `gcontact`.`id` AS `contact-id` FROM `group_member`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
|
||||
INNER JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
|
||||
WHERE `gid` IN ($groups)");
|
||||
else
|
||||
$r = q("SELECT `contact-id` FROM `group_member` WHERE `gid` IN ( $groups )");
|
||||
|
||||
|
||||
$ret = array();
|
||||
if(count($r))
|
||||
foreach($r as $rr)
|
||||
$ret[] = $rr['contact-id'];
|
||||
if($check_dead) {
|
||||
if($check_dead AND !$use_gcontact) {
|
||||
require_once('include/acl_selectors.php');
|
||||
$ret = prune_deadguys($ret);
|
||||
}
|
||||
|
|
|
@ -300,6 +300,7 @@ function profile_sidebar($profile, $block = 0) {
|
|||
$account_type = "";
|
||||
|
||||
if((x($profile,'address') == 1)
|
||||
|| (x($profile,'location') == 1)
|
||||
|| (x($profile,'locality') == 1)
|
||||
|| (x($profile,'region') == 1)
|
||||
|| (x($profile,'postal-code') == 1)
|
||||
|
@ -368,6 +369,8 @@ function profile_sidebar($profile, $block = 0) {
|
|||
|
||||
if (isset($p["address"]))
|
||||
$p["address"] = bbcode($p["address"]);
|
||||
else
|
||||
$p["address"] = bbcode($p["location"]);
|
||||
|
||||
if (isset($p["photo"]))
|
||||
$p["photo"] = proxy_url($p["photo"], false, PROXY_SIZE_SMALL);
|
||||
|
|
|
@ -1338,6 +1338,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
logger("item_store: Set network to ".$arr["network"]." for ".$arr["uri"], LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
if ($arr["gcontact-id"] == 0)
|
||||
$arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['author-link'], "network" => $arr['network'],
|
||||
"photo" => $arr['author-avatar'], "name" => $arr['author-name']));
|
||||
|
||||
if ($arr['guid'] != "") {
|
||||
// Checking if there is already an item with the same guid
|
||||
logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
|
||||
|
|
|
@ -129,9 +129,14 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
|
|||
|
||||
if ($r AND !$onlyfetch) {
|
||||
// Update contact data
|
||||
$update_contact = ($r[0]['name-date'] < datetime_convert('','','now -12 hours'));
|
||||
if ($update_contact) {
|
||||
logger("Update contact data for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
|
||||
$value = $xpath->query("atom:link[@rel='salmon']", $context)->item(0)->nodeValue;
|
||||
if ($value != "")
|
||||
$contact["notify"] = $value;
|
||||
|
||||
$value = $xpath->evaluate('atom:author/uri/text()', $context)->item(0)->nodeValue;
|
||||
if ($value != "")
|
||||
$contact["alias"] = $value;
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
|
||||
if ($value != "")
|
||||
|
@ -149,6 +154,10 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
|
|||
if ($value != "")
|
||||
$contact["location"] = $value;
|
||||
|
||||
if (($contact["name"] != $r[0]["name"]) OR ($contact["nick"] != $r[0]["nick"]) OR ($contact["about"] != $r[0]["about"]) OR ($contact["location"] != $r[0]["location"])) {
|
||||
|
||||
logger("Update contact data for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
|
||||
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s', `name-date` = '%s' WHERE `id` = %d AND `network` = '%s'",
|
||||
dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["about"]), dbesc($contact["location"]),
|
||||
dbesc(datetime_convert()), intval($contact["id"]), dbesc(NETWORK_OSTATUS));
|
||||
|
@ -157,17 +166,20 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
|
|||
"", "", "", datetime_convert(), 2, $contact["id"], $contact["uid"]);
|
||||
}
|
||||
|
||||
$update_photo = ($r[0]['avatar-date'] < datetime_convert('','','now -12 hours'));
|
||||
|
||||
if ($update_photo AND isset($author["author-avatar"])) {
|
||||
if (isset($author["author-avatar"]) AND ($author["author-avatar"] != $r[0]['photo'])) {
|
||||
logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
|
||||
$photos = import_profile_photo($author["author-avatar"], $importer["uid"], $contact["id"]);
|
||||
|
||||
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d AND `network` = '%s'",
|
||||
dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]),
|
||||
dbesc($author["author-avatar"]), dbesc($photos[1]), dbesc($photos[2]),
|
||||
dbesc(datetime_convert()), intval($contact["id"]), dbesc(NETWORK_OSTATUS));
|
||||
}
|
||||
|
||||
/// @todo Add the "addr" field
|
||||
$contact["generation"] = 2;
|
||||
$contact["photo"] = $author["author-avatar"];
|
||||
update_gcontact($contact);
|
||||
}
|
||||
|
||||
return($author);
|
||||
|
@ -1447,9 +1459,12 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
|
|||
$repeated_owner["about"] = "";
|
||||
$repeated_owner["uid"] = 0;
|
||||
|
||||
$r =q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($repeated_item["author-link"]));
|
||||
// Fetch the missing data from the global contacts
|
||||
$r =q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($repeated_item["author-link"]));
|
||||
if ($r) {
|
||||
if ($r[0]["nick"] != "")
|
||||
$repeated_owner["nick"] = $r[0]["nick"];
|
||||
|
||||
$repeated_owner["location"] = $r[0]["location"];
|
||||
$repeated_owner["about"] = $r[0]["about"];
|
||||
}
|
||||
|
|
|
@ -227,6 +227,8 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
$server_url = $x[0]["server_url"];
|
||||
$nick = $x[0]["nick"];
|
||||
$addr = $x[0]["addr"];
|
||||
$alias = $x[0]["alias"];
|
||||
$notify = $x[0]["notify"];
|
||||
} else {
|
||||
$created = "0000-00-00 00:00:00";
|
||||
$server_url = "";
|
||||
|
@ -234,6 +236,8 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
$urlparts = parse_url($profile_url);
|
||||
$nick = end(explode("/", $urlparts["path"]));
|
||||
$addr = "";
|
||||
$alias = "";
|
||||
$notify = "";
|
||||
}
|
||||
|
||||
if ((($network == "") OR ($name == "") OR ($addr == "") OR ($profile_photo == "") OR ($server_url == "") OR $alternate)
|
||||
|
@ -246,6 +250,8 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
$name = $data["name"];
|
||||
$nick = $data["nick"];
|
||||
$addr = $data["addr"];
|
||||
$alias = $data["alias"];
|
||||
$notify = $data["notify"];
|
||||
$profile_url = $data["url"];
|
||||
$profile_photo = $data["photo"];
|
||||
$server_url = $data["baseurl"];
|
||||
|
@ -301,12 +307,19 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
if (($addr == "") AND ($x[0]['addr'] != ""))
|
||||
$addr = $x[0]['addr'];
|
||||
|
||||
if (($alias == "") AND ($x[0]['alias'] != ""))
|
||||
$alias = $x[0]['alias'];
|
||||
|
||||
if (($notify == "") AND ($x[0]['notify'] != ""))
|
||||
$notify = $x[0]['notify'];
|
||||
|
||||
if (($generation == 0) AND ($x[0]['generation'] > 0))
|
||||
$generation = $x[0]['generation'];
|
||||
|
||||
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) {
|
||||
q("UPDATE `gcontact` SET `name` = '%s', `addr` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s',
|
||||
`updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d
|
||||
`updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d,
|
||||
`alias` = '$s', `notify` = '%s'
|
||||
WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'",
|
||||
dbesc($name),
|
||||
dbesc($addr),
|
||||
|
@ -320,14 +333,21 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender),
|
||||
dbesc($alias),
|
||||
dbesc($notify),
|
||||
intval($generation),
|
||||
intval($generation),
|
||||
dbesc(normalise_link($profile_url))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
q("INSERT INTO `gcontact` (`name`, `nick`, `addr`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`)
|
||||
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
|
||||
// Maybe another process had inserted the entry after the first check, so it again
|
||||
$x = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($profile_url))
|
||||
);
|
||||
if(!$x) {
|
||||
q("INSERT INTO `gcontact` (`name`, `nick`, `addr`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `alias`, `notify`, `generation`)
|
||||
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
|
||||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($addr),
|
||||
|
@ -343,11 +363,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender),
|
||||
dbesc($alias),
|
||||
dbesc($notify),
|
||||
intval($generation)
|
||||
);
|
||||
$x = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
$x = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($profile_url))
|
||||
);
|
||||
}
|
||||
if(count($x))
|
||||
$gcid = $x[0]['id'];
|
||||
}
|
||||
|
@ -380,11 +403,11 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
}
|
||||
|
||||
// For unknown reasons there are sometimes duplicates
|
||||
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d AND
|
||||
NOT EXISTS (SELECT `gcid` FROM `glink` WHERE `gcid` = `gcontact`.`id`)",
|
||||
dbesc(normalise_link($profile_url)),
|
||||
intval($gcid)
|
||||
);
|
||||
//q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d AND
|
||||
// NOT EXISTS (SELECT `gcid` FROM `glink` WHERE `gcid` = `gcontact`.`id`)",
|
||||
// dbesc(normalise_link($profile_url)),
|
||||
// intval($gcid)
|
||||
//);
|
||||
|
||||
return $gcid;
|
||||
}
|
||||
|
@ -778,6 +801,8 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
$version = trim(str_replace("X-Diaspora-Version:", "", $line));
|
||||
$version = trim(str_replace("x-diaspora-version:", "", $version));
|
||||
$network = NETWORK_DIASPORA;
|
||||
$versionparts = explode("-", $version);
|
||||
$version = $versionparts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1481,4 +1506,154 @@ function poco_discover_server($data, $default_generation = 0) {
|
|||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fetch the gcontact id, add an entry if not existed
|
||||
*
|
||||
* @param arr $contact contact array
|
||||
* @return bool|int Returns false if not found, integer if contact was found
|
||||
*/
|
||||
function get_gcontact_id($contact) {
|
||||
|
||||
$gcontact_id = 0;
|
||||
|
||||
if ($contact["network"] == NETWORK_STATUSNET)
|
||||
$contact["network"] = NETWORK_OSTATUS;
|
||||
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"])));
|
||||
|
||||
if ($r)
|
||||
$gcontact_id = $r[0]["id"];
|
||||
else {
|
||||
q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `generation`)
|
||||
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
|
||||
dbesc($contact["name"]),
|
||||
dbesc($contact["nick"]),
|
||||
dbesc($contact["addr"]),
|
||||
dbesc($contact["network"]),
|
||||
dbesc($contact["url"]),
|
||||
dbesc(normalise_link($contact["url"])),
|
||||
dbesc($contact["photo"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($contact["location"]),
|
||||
dbesc($contact["about"]),
|
||||
intval($contact["generation"])
|
||||
);
|
||||
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"])));
|
||||
|
||||
if ($r)
|
||||
$gcontact_id = $r[0]["id"];
|
||||
}
|
||||
|
||||
return $gcontact_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the gcontact table from a given array
|
||||
*
|
||||
* @param arr $contact contact array
|
||||
* @return bool|int Returns false if not found, integer if contact was found
|
||||
*/
|
||||
function update_gcontact($contact) {
|
||||
|
||||
/// @todo update contact table as well
|
||||
|
||||
$gcontact_id = get_gcontact_id($contact);
|
||||
|
||||
if (!$gcontact_id)
|
||||
return false;
|
||||
|
||||
$r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`, `hide`, `nsfw`, `network`, `alias`, `notify`, `url`
|
||||
FROM `gcontact` WHERE `id` = %d LIMIT 1",
|
||||
intval($gcontact_id));
|
||||
|
||||
if ($contact["generation"] == 0)
|
||||
$contact["generation"] = $r[0]["generation"];
|
||||
|
||||
if ($contact["photo"] == "")
|
||||
$contact["photo"] = $r[0]["photo"];
|
||||
|
||||
if ($contact["name"] == "")
|
||||
$contact["name"] = $r[0]["name"];
|
||||
|
||||
if ($contact["nick"] == "")
|
||||
$contact["nick"] = $r[0]["nick"];
|
||||
|
||||
if ($contact["addr"] == "")
|
||||
$contact["addr"] = $r[0]["addr"];
|
||||
|
||||
if ($contact["location"] =="")
|
||||
$contact["location"] = $r[0]["location"];
|
||||
|
||||
if ($contact["about"] =="")
|
||||
$contact["about"] = $r[0]["about"];
|
||||
|
||||
if ($contact["birthday"] =="")
|
||||
$contact["birthday"] = $r[0]["birthday"];
|
||||
|
||||
if ($contact["gender"] =="")
|
||||
$contact["gender"] = $r[0]["gender"];
|
||||
|
||||
if ($contact["keywords"] =="")
|
||||
$contact["keywords"] = $r[0]["keywords"];
|
||||
|
||||
if (!isset($contact["hide"]))
|
||||
$contact["hide"] = $r[0]["hide"];
|
||||
|
||||
if (!isset($contact["nsfw"]))
|
||||
$contact["nsfw"] = $r[0]["nsfw"];
|
||||
|
||||
if ($contact["network"] =="")
|
||||
$contact["network"] = $r[0]["network"];
|
||||
|
||||
if ($contact["alias"] =="")
|
||||
$contact["alias"] = $r[0]["alias"];
|
||||
|
||||
if ($contact["url"] =="")
|
||||
$contact["url"] = $r[0]["url"];
|
||||
|
||||
if ($contact["notify"] =="")
|
||||
$contact["notify"] = $r[0]["notify"];
|
||||
|
||||
if ($contact["network"] == NETWORK_STATUSNET)
|
||||
$contact["network"] = NETWORK_OSTATUS;
|
||||
|
||||
if (($contact["photo"] != $r[0]["photo"]) OR ($contact["name"] != $r[0]["name"]) OR ($contact["nick"] != $r[0]["nick"]) OR ($contact["addr"] != $r[0]["addr"]) OR
|
||||
($contact["birthday"] != $r[0]["birthday"]) OR ($contact["gender"] != $r[0]["gender"]) OR ($contact["keywords"] != $r[0]["keywords"]) OR
|
||||
($contact["hide"] != $r[0]["hide"]) OR ($contact["nsfw"] != $r[0]["nsfw"]) OR ($contact["network"] != $r[0]["network"]) OR
|
||||
($contact["alias"] != $r[0]["alias"]) OR ($contact["notify"] != $r[0]["notify"]) OR ($contact["url"] != $r[0]["url"]) OR
|
||||
($contact["location"] != $r[0]["location"]) OR ($contact["about"] != $r[0]["about"]) OR ($contact["generation"] < $r[0]["generation"])) {
|
||||
|
||||
q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s', `network` = '%s',
|
||||
`birthday` = '%s', `gender` = '%s', `keywords` = %d, `hide` = %d, `nsfw` = %d,
|
||||
`alias` = '%s', `notify` = '%s', `url` = '%s',
|
||||
`location` = '%s', `about` = '%s', `generation` = %d, `updated` = '%s'
|
||||
WHERE `nurl` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
|
||||
dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]),
|
||||
dbesc($contact["addr"]), dbesc($contact["network"]), dbesc($contact["birthday"]),
|
||||
dbesc($contact["gender"]), dbesc($contact["keywords"]), intval($contact["hide"]),
|
||||
intval($contact["nsfw"]), dbesc($contact["alias"]), dbesc($contact["notify"]),
|
||||
dbesc($contact["url"]), dbesc($contact["location"]), dbesc($contact["about"]),
|
||||
intval($contact["generation"]), dbesc(datetime_convert()),
|
||||
dbesc(normalise_link($contact["url"])), intval($contact["generation"]));
|
||||
}
|
||||
|
||||
return $gcontact_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the gcontact entry from probe
|
||||
*
|
||||
* @param str $url profile link
|
||||
*/
|
||||
function update_gcontact_from_probe($url) {
|
||||
$data = probe_url($url);
|
||||
|
||||
if ($data["network"] != NETWORK_PHANTOM)
|
||||
update_gcontact($data);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
function add_thread($itemid, $onlyshadow = false) {
|
||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,
|
||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
|
||||
`deleted`, `origin`, `forum_mode`, `mention`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||
|
||||
if (!$items)
|
||||
|
@ -111,7 +111,7 @@ function update_thread_uri($itemuri, $uid) {
|
|||
}
|
||||
|
||||
function update_thread($itemid, $setmention = false) {
|
||||
$items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,
|
||||
$items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
|
||||
`deleted`, `origin`, `forum_mode`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||
|
||||
if (!$items)
|
||||
|
|
|
@ -341,7 +341,7 @@ function admin_page_site_post(&$a){
|
|||
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
|
||||
update_table("term", array('url'), $old_url, $new_url);
|
||||
update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
|
||||
update_table("unique_contacts", array('url'), $old_url, $new_url);
|
||||
update_table("gcontact", array('photo','url','nurl','server_url'), $old_url, $new_url);
|
||||
update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
|
||||
|
||||
// update config
|
||||
|
|
|
@ -143,14 +143,13 @@ function community_getpublicitems($start, $itemspage) {
|
|||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
FROM `item` WHERE `item`.`uid` = 0 AND `item`.`id` = `item`.`parent`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
ORDER BY `item`.`received` DESC LIMIT %d, %d",
|
||||
FROM `thread`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
WHERE `thread`.`uid` = 0
|
||||
ORDER BY `thread`.`created` DESC LIMIT %d, %d",
|
||||
intval($start),
|
||||
intval($itemspage)
|
||||
);
|
||||
|
||||
return($r);
|
||||
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ function _contact_update_profile($contact_id) {
|
|||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s'
|
||||
WHERE `id` = %d",
|
||||
dbesc($photos[0]),
|
||||
dbesc($data["photo"]),
|
||||
dbesc($photos[1]),
|
||||
dbesc($photos[2]),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -311,6 +311,8 @@ function _contact_update_profile($contact_id) {
|
|||
intval($contact_id)
|
||||
);
|
||||
|
||||
// Update the entry in the gcontact table
|
||||
update_gcontact_from_probe($data["url"]);
|
||||
}
|
||||
|
||||
function _contact_block($contact_id, $orig_record) {
|
||||
|
@ -345,7 +347,6 @@ function _contact_archive($contact_id, $orig_record) {
|
|||
return $r;
|
||||
}
|
||||
function _contact_drop($contact_id, $orig_record) {
|
||||
require_once('include/Contact.php');
|
||||
$a = get_app();
|
||||
|
||||
terminate_friendship($a->user,$a->contact,$orig_record);
|
||||
|
@ -890,50 +891,24 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
|
||||
function contact_posts($a, $contact_id) {
|
||||
|
||||
require_once('include/conversation.php');
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
if ($r) {
|
||||
$contact = $r[0];
|
||||
$a->page['aside'] = "";
|
||||
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
|
||||
}
|
||||
|
||||
if(get_config('system', 'old_pager')) {
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `item`
|
||||
WHERE `item`.`uid` = %d AND `author-link` IN ('%s', '%s')",
|
||||
intval(local_user()),
|
||||
dbesc(str_replace("https://", "http://", $contact["url"])),
|
||||
dbesc(str_replace("http://", "https://", $contact["url"])));
|
||||
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
FROM `item` FORCE INDEX (uid_contactid_created)
|
||||
WHERE `item`.`uid` = %d AND `contact-id` = %d
|
||||
AND `author-link` IN ('%s', '%s')
|
||||
ORDER BY `item`.`created` DESC LIMIT %d, %d",
|
||||
intval(local_user()),
|
||||
intval($contact_id),
|
||||
dbesc(str_replace("https://", "http://", $contact["url"])),
|
||||
dbesc(str_replace("http://", "https://", $contact["url"])),
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
} else
|
||||
$profile = "";
|
||||
|
||||
$tab_str = contacts_tab($a, $contact_id, 1);
|
||||
|
||||
$o .= $tab_str;
|
||||
|
||||
$o .= conversation($a,$r,'community',false);
|
||||
if ($contact["url"]) {
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"])));
|
||||
|
||||
if(!get_config('system', 'old_pager')) {
|
||||
$o .= alt_pager($a,count($r));
|
||||
} else {
|
||||
$o .= paginate($a);
|
||||
if ($r[0]["id"] <> 0)
|
||||
$o .= posts_from_gcontact($a, $r[0]["id"]);
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -94,9 +94,15 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
else
|
||||
$ostatus = NETWORK_DFRN;
|
||||
|
||||
$count = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND
|
||||
(`url` REGEXP '%s' OR `name` REGEXP '%s' OR `location` REGEXP '%s' OR
|
||||
`about` REGEXP '%s' OR `keywords` REGEXP '%s')".$extra_sql,
|
||||
$count = q("SELECT count(*) AS `total` FROM `gcontact`
|
||||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
|
||||
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)))) AND
|
||||
(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR
|
||||
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql",
|
||||
intval(local_user()), dbesc(CONTACT_IS_SHARING), dbesc(CONTACT_IS_FRIEND),
|
||||
dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora),
|
||||
dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)),
|
||||
dbesc(escape_tags($search)), dbesc(escape_tags($search)));
|
||||
|
@ -106,8 +112,8 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
|
||||
WHERE `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)) AND
|
||||
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)))) AND
|
||||
(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR
|
||||
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql
|
||||
GROUP BY `gcontact`.`nurl`
|
||||
|
|
|
@ -154,42 +154,53 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["about"] = "";
|
||||
}
|
||||
|
||||
// Don't show details from Diaspora contacts if you don't follow the contact
|
||||
$showdetails = ($profiledata["network"] != NETWORK_DIASPORA);
|
||||
|
||||
// Fetching further contact data from the contact table
|
||||
$r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'",
|
||||
dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]));
|
||||
|
||||
$r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
|
||||
dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]),
|
||||
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
|
||||
if (!count($r))
|
||||
$r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
dbesc(normalise_link($profiledata["url"])), intval($item["uid"]));
|
||||
|
||||
if (!count($r))
|
||||
$r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
|
||||
dbesc(normalise_link($profiledata["url"])));
|
||||
$r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)",
|
||||
dbesc(normalise_link($profiledata["url"])), intval(local_user()),
|
||||
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
|
||||
|
||||
if (count($r)) {
|
||||
if ((($r[0]["uid"] != local_user()) OR !local_user()) AND ($profiledata["network"] == NETWORK_DIASPORA)) {
|
||||
$r[0]["location"] = "";
|
||||
$r[0]["about"] = "";
|
||||
}
|
||||
|
||||
$profiledata["name"] = $r[0]["name"];
|
||||
$profiledata["photo"] = $r[0]["photo"];
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
$profiledata["network"] = $r[0]["network"];
|
||||
|
||||
if (local_user() OR $showdetails) {
|
||||
$showdetails = true;
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
}
|
||||
}
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
|
||||
// Fetching profile data from global contacts
|
||||
if ($profiledata["network"] != NETWORK_FEED) {
|
||||
$r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
|
||||
if (count($r)) {
|
||||
if ($profiledata["photo"] == "")
|
||||
$profiledata["photo"] = $r[0]["avatar"];
|
||||
if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
|
||||
$profiledata["name"] = $r[0]["name"];
|
||||
$profiledata["photo"] = $r[0]["photo"];
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
$profiledata["network"] = $r[0]["network"];
|
||||
|
||||
if ($showdetails) {
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_once('include/Scrape.php');
|
||||
require_once('include/follow.php');
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
|
||||
function follow_content(&$a) {
|
||||
|
@ -75,15 +76,18 @@ function follow_content(&$a) {
|
|||
}
|
||||
|
||||
$myaddr = $r[0]["url"];
|
||||
$gcontact_id = 0;
|
||||
|
||||
// Makes the connection request for friendica contacts easier
|
||||
$_SESSION["fastlane"] = $ret["url"];
|
||||
|
||||
$r = q("SELECT `location`, `about`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
$r = q("SELECT `id`, `location`, `about`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
normalise_link($ret["url"]));
|
||||
|
||||
if (!$r)
|
||||
$r = array(array("location" => "", "about" => "", "keywords" => ""));
|
||||
else
|
||||
$gcontact_id = $r[0]["id"];
|
||||
|
||||
if($ret['network'] === NETWORK_DIASPORA) {
|
||||
$r[0]["location"] = "";
|
||||
|
@ -95,11 +99,12 @@ function follow_content(&$a) {
|
|||
if ($ret["addr"] != "")
|
||||
$header .= " <".$ret["addr"].">";
|
||||
|
||||
$header .= " (".network_to_name($ret['network'], $ret['url']).")";
|
||||
//$header .= " (".network_to_name($ret['network'], $ret['url']).")";
|
||||
$header = t("Connect/Follow");
|
||||
|
||||
$o = replace_macros($tpl,array(
|
||||
'$header' => htmlentities($header),
|
||||
'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL),
|
||||
//'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL),
|
||||
'$desc' => "",
|
||||
'$pls_answer' => t('Please answer the following:'),
|
||||
'$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'),t('Yes'))),
|
||||
|
@ -121,13 +126,26 @@ function follow_content(&$a) {
|
|||
'$url_label' => t("Profile URL"),
|
||||
'$myaddr' => $myaddr,
|
||||
'$request' => $request,
|
||||
'$location' => bbcode($r[0]["location"]),
|
||||
/*'$location' => bbcode($r[0]["location"]),
|
||||
'$location_label' => t("Location:"),
|
||||
'$about' => bbcode($r[0]["about"], false, false),
|
||||
'$about_label' => t("About:"),
|
||||
'$about_label' => t("About:"), */
|
||||
'$keywords' => $r[0]["keywords"],
|
||||
'$keywords_label' => t("Tags:")
|
||||
));
|
||||
|
||||
$a->page['aside'] = "";
|
||||
profile_load($a, "", 0, get_contact_details_by_url($ret["url"]));
|
||||
|
||||
// Show last public posts
|
||||
if ($gcontact_id <> 0) {
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'),
|
||||
array('$title' => t('Status Messages and Posts')
|
||||
));
|
||||
|
||||
$o .= posts_from_gcontact($a, $gcontact_id);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
195
mod/item.php
195
mod/item.php
|
@ -137,6 +137,16 @@ function item_post(&$a) {
|
|||
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
|
||||
$parent_contact = null;
|
||||
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($thrparent[0]["author-link"])));
|
||||
if (count($r)) {
|
||||
$parent_contact = $r[0];
|
||||
$parent_contact["thumb"] = $parent_contact["photo"];
|
||||
$parent_contact["micro"] = $parent_contact["photo"];
|
||||
unset($parent_contact["id"]);
|
||||
}
|
||||
|
||||
if (!isset($parent_contact["nick"])) {
|
||||
require_once("include/Scrape.php");
|
||||
$probed_contact = probe_url($thrparent[0]["author-link"]);
|
||||
if ($probed_contact["network"] != NETWORK_FEED) {
|
||||
|
@ -146,6 +156,7 @@ function item_post(&$a) {
|
|||
$parent_contact["micro"] = $probed_contact["photo"];
|
||||
$parent_contact["addr"] = $probed_contact["addr"];
|
||||
}
|
||||
}
|
||||
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG);
|
||||
} else
|
||||
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
||||
|
@ -693,7 +704,8 @@ function item_post(&$a) {
|
|||
$datarray['postopts'] = $postopts;
|
||||
$datarray['origin'] = $origin;
|
||||
$datarray['moderated'] = $allow_moderated;
|
||||
|
||||
$datarray['gcontact-id'] = get_gcontact_id(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
||||
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
|
||||
/**
|
||||
* These fields are for the convenience of plugins...
|
||||
* 'self' if true indicates the owner is posting on their own wall
|
||||
|
@ -1060,6 +1072,8 @@ function item_content(&$a) {
|
|||
* @return boolean true if replaced, false if not replaced
|
||||
*/
|
||||
function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
|
||||
require_once("include/Scrape.php");
|
||||
require_once("include/socgraph.php");
|
||||
|
||||
$replaced = false;
|
||||
$r = null;
|
||||
|
@ -1094,122 +1108,115 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
$stat = false;
|
||||
//get the person's name
|
||||
$name = substr($tag,1);
|
||||
//is it a link or a full dfrn address?
|
||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
$newname = $name;
|
||||
//get the profile links
|
||||
$links = @lrdd($name);
|
||||
if(count($links)) {
|
||||
//for all links, collect how is to inform and how's profile is to link
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
|
||||
$profile = $link['@attributes']['href'];
|
||||
if($link['@attributes']['rel'] === 'salmon') {
|
||||
if(strlen($inform))
|
||||
$inform .= ',';
|
||||
$inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
|
||||
|
||||
// Sometimes the tag detection doesn't seem to work right
|
||||
// This is some workaround
|
||||
$nameparts = explode(" ", $name);
|
||||
$name = $nameparts[0];
|
||||
|
||||
// Try to detect the contact in various ways
|
||||
if ((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
// Is it in format @user@domain.tld or @http://domain.tld/...?
|
||||
|
||||
// First check the contact table for the address
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact` WHERE `addr` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
||||
// Then check in the contact table for the url
|
||||
if (!$r)
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `notify`, `network` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc(normalise_link($name)),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
||||
// Then check in the global contacts for the address
|
||||
if (!$r)
|
||||
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `addr` = '%s' LIMIT 1", dbesc($name));
|
||||
|
||||
// Then check in the global contacts for the url
|
||||
if (!$r)
|
||||
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", dbesc(normalise_link($name)));
|
||||
|
||||
// If the data isn't complete then refetch the data
|
||||
if ($r AND ($r[0]["network"] == NETWORK_OSTATUS) AND (($r[0]["notify"] == "") OR ($r[0]["alias"] == "")))
|
||||
$r = false;
|
||||
|
||||
if (!$r) {
|
||||
$probed = probe_url($name);
|
||||
if (isset($probed["url"])) {
|
||||
update_gcontact($probed);
|
||||
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($probed["url"])));
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (($network != NETWORK_OSTATUS) AND ($network != NETWORK_TWITTER) AND
|
||||
($network != NETWORK_STATUSNET) AND ($network != NETWORK_APPNET)) {
|
||||
//if it is a name rather than an address
|
||||
$newname = $name;
|
||||
$alias = '';
|
||||
$tagcid = 0;
|
||||
//is it some generated name?
|
||||
if(strrpos($newname,'+')) {
|
||||
//get the id
|
||||
$tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
|
||||
//remove the next word from tag's name
|
||||
if(strpos($name,' ')) {
|
||||
$name = substr($name,0,strpos($name,' '));
|
||||
}
|
||||
}
|
||||
if($tagcid) { //if there was an id
|
||||
//select contact with that id from the logged in user's contact list
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
} else {
|
||||
$r = false;
|
||||
if (strrpos($name,'+')) {
|
||||
// Is it in format @nick+number?
|
||||
$tagcid = intval(substr($name,strrpos($name,'+') + 1));
|
||||
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($tagcid),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$newname = str_replace('_',' ',$name);
|
||||
|
||||
// At first try to fetch a contact according to the given network
|
||||
if ($network != "") {
|
||||
//select someone from this user's contacts by name
|
||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
dbesc($network),
|
||||
intval($profile_uid)
|
||||
);
|
||||
if(! $r) {
|
||||
//select someone by attag or nick and the name passed in
|
||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
//select someone by attag or nick and the name passed in the current network
|
||||
if(!$r AND ($network != ""))
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
dbesc($network),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}
|
||||
} else
|
||||
$r = false;
|
||||
|
||||
if(! $r) {
|
||||
//select someone from this user's contacts by name in the current network
|
||||
if (!$r AND ($network != ""))
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
dbesc($network),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
||||
//select someone by attag or nick and the name passed in
|
||||
if(!$r)
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
||||
|
||||
//select someone from this user's contacts by name
|
||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
if(!$r)
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}
|
||||
|
||||
if(! $r) {
|
||||
//select someone by attag or nick and the name passed in
|
||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}
|
||||
}
|
||||
/* } elseif(strstr($name,'_') || strstr($name,' ')) { //no id
|
||||
//get the real name
|
||||
$newname = str_replace('_',' ',$name);
|
||||
//select someone from this user's contacts by name
|
||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
intval($profile_uid)
|
||||
);
|
||||
} else {
|
||||
//select someone by attag or nick and the name passed in
|
||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}*/
|
||||
//$r is set, if someone could be selected
|
||||
if(count($r)) {
|
||||
$profile = $r[0]['url'];
|
||||
//set newname to nick, find alias
|
||||
if(($r[0]['network'] === NETWORK_OSTATUS) OR ($r[0]['network'] === NETWORK_TWITTER)
|
||||
OR ($r[0]['network'] === NETWORK_STATUSNET) OR ($r[0]['network'] === NETWORK_APPNET)) {
|
||||
$newname = $r[0]['nick'];
|
||||
$stat = true;
|
||||
if($r[0]['alias'])
|
||||
$alias = $r[0]['alias'];
|
||||
}
|
||||
else
|
||||
$newname = $r[0]['name'];
|
||||
//add person's id to $inform
|
||||
if(strlen($inform))
|
||||
if ($r) {
|
||||
if(strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"])))
|
||||
$inform .= ',';
|
||||
$inform .= 'cid:' . $r[0]['id'];
|
||||
}
|
||||
|
||||
if (isset($r[0]["id"]))
|
||||
$inform .= 'cid:' . $r[0]["id"];
|
||||
elseif (isset($r[0]["notify"]))
|
||||
$inform .= $r[0]["notify"];
|
||||
|
||||
$profile = $r[0]["url"];
|
||||
$alias = $r[0]["alias"];
|
||||
$newname = $r[0]["nick"];
|
||||
if (($newname == "") OR (($r[0]["network"] != NETWORK_OSTATUS) AND ($r[0]["network"] != NETWORK_TWITTER)
|
||||
AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET)))
|
||||
$newname = $r[0]["name"];
|
||||
}
|
||||
|
||||
//if there is an url for this persons profile
|
||||
if(isset($profile)) {
|
||||
|
||||
$replaced = true;
|
||||
//create profile link
|
||||
$profile = str_replace(',','%2c',$profile);
|
||||
|
|
|
@ -312,6 +312,9 @@ function network_content(&$a, $update = 0) {
|
|||
return login(false);
|
||||
}
|
||||
|
||||
// Rawmode is used for fetching new content at the end of the page
|
||||
$rawmode = (isset($_GET["mode"]) AND ($_GET["mode"] == "raw"));
|
||||
|
||||
/// @TODO Is this really necessary? $a is already available to hooks
|
||||
$arr = array('query' => $a->query_string);
|
||||
call_hooks('network_content_init', $arr);
|
||||
|
@ -470,7 +473,7 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
set_pconfig(local_user(), 'network.view', 'net.selected', ($nets ? $nets : 'all'));
|
||||
|
||||
if(! $update) {
|
||||
if(!$update AND !$rawmode) {
|
||||
if($group) {
|
||||
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
|
||||
notice( sprintf( tt('Warning: This group contains %s member from an insecure network.',
|
||||
|
@ -549,27 +552,30 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
|
||||
$contacts = expand_groups(array($group));
|
||||
|
||||
$contact_str_self = "";
|
||||
$gcontacts = expand_groups(array($group), false, true);
|
||||
|
||||
if((is_array($contacts)) && count($contacts)) {
|
||||
$contact_str_self = "";
|
||||
$gcontact_str_self = "";
|
||||
|
||||
$contact_str = implode(',',$contacts);
|
||||
$self = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($_SESSION['uid']));
|
||||
if (count($self))
|
||||
$contact_str_self = ",".$self[0]["id"];
|
||||
$gcontact_str = implode(',',$gcontacts);
|
||||
$self = q("SELECT `contact`.`id`, `gcontact`.`id` AS `gid` FROM `contact`
|
||||
INNER JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
|
||||
WHERE `uid` = %d AND `self`", intval($_SESSION['uid']));
|
||||
if (count($self)) {
|
||||
$contact_str_self = $self[0]["id"];
|
||||
$gcontact_str_self = $self[0]["gid"];
|
||||
}
|
||||
else {
|
||||
$contact_str = ' 0 ';
|
||||
|
||||
$sql_post_table = " INNER JOIN `item` AS `temp1` ON `temp1`.`id` = ".$sql_table.".".$sql_parent;
|
||||
$sql_extra3 .= " AND ($sql_table.`contact-id` IN ($contact_str) ";
|
||||
$sql_extra3 .= " OR ($sql_table.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '".protect_sprintf('%<'.intval($group).'>%')."' AND `temp1`.`private`))";
|
||||
} else {
|
||||
$sql_extra3 .= " AND false ";
|
||||
info( t('Group is empty'));
|
||||
}
|
||||
|
||||
//$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` WHERE (`contact-id` IN ($contact_str) OR `allow_gid` like '".protect_sprintf('%<'.intval($group).'>%')."') and deleted = 0 ORDER BY `created` DESC) AS `temp1` ON $sql_table.$sql_parent = `temp1`.`parent` ";
|
||||
|
||||
$sql_extra3 .= " AND `contact-id` IN ($contact_str$contact_str_self) ";
|
||||
$sql_extra3 .= " AND EXISTS (SELECT `id` FROM `item` WHERE (`contact-id` IN ($contact_str)
|
||||
OR `allow_gid` LIKE '".protect_sprintf('%<'.intval($group).'>%')."') AND `deleted` = 0
|
||||
AND `parent` = $sql_table.$sql_parent) ";
|
||||
|
||||
$o = replace_macros(get_markup_template("section_title.tpl"),array(
|
||||
'$title' => sprintf( t('Group: %s'), $r[0]['name'])
|
||||
)) . $o;
|
||||
|
@ -582,11 +588,7 @@ function network_content(&$a, $update = 0) {
|
|||
intval($cid)
|
||||
);
|
||||
if(count($r)) {
|
||||
$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item`
|
||||
WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." AND `deleted` = 0
|
||||
ORDER BY `item`.`received` DESC) AS `temp1`
|
||||
ON $sql_table.$sql_parent = `temp1`.`parent` ";
|
||||
$sql_extra = "";
|
||||
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
|
||||
|
||||
$entries[0] = array(
|
||||
'id' => 'network',
|
||||
|
@ -668,7 +670,7 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
|
||||
if($conv)
|
||||
$sql_extra3 .= " AND `mention`";
|
||||
$sql_extra3 .= " AND $sql_table.`mention`";
|
||||
|
||||
if($update) {
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ function poco_init(&$a) {
|
|||
$update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
|
||||
|
||||
if ($global) {
|
||||
//$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND ((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND `network` IN ('%s')",
|
||||
$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND `network` IN ('%s', '%s', '%s')",
|
||||
$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
|
||||
dbesc($update_limit),
|
||||
dbesc(NETWORK_DFRN),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
|
@ -94,8 +93,7 @@ function poco_init(&$a) {
|
|||
|
||||
if ($global) {
|
||||
logger("Start global query", LOGGER_DEBUG);
|
||||
//$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s') AND ((`last_contact` >= `last_failure`) OR (`updated` > `last_failure`)) LIMIT %d, %d",
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
|
||||
ORDER BY `updated` DESC LIMIT %d, %d",
|
||||
dbesc($update_limit),
|
||||
dbesc(NETWORK_DFRN),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1191 );
|
||||
define( 'UPDATE_VERSION' , 1192 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -323,3 +323,7 @@ ul.credits li {
|
|||
.p-addr {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#live-community {
|
||||
clear: both;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue