more social graph stuff

This commit is contained in:
Friendika 2011-11-01 16:08:07 -07:00
parent ae7425dadb
commit 573670fa0c
8 changed files with 41 additions and 16 deletions

View file

@ -11,7 +11,7 @@ require_once('include/cache.php');
define ( 'FRIENDIKA_PLATFORM', 'Friendica'); define ( 'FRIENDIKA_PLATFORM', 'Friendica');
define ( 'FRIENDIKA_VERSION', '2.3.1152' ); define ( 'FRIENDIKA_VERSION', '2.3.1152' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1100 ); define ( 'DB_UPDATE_VERSION', 1101 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -66,6 +66,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`issued-id` char(255) NOT NULL, `issued-id` char(255) NOT NULL,
`dfrn-id` char(255) NOT NULL, `dfrn-id` char(255) NOT NULL,
`url` char(255) NOT NULL, `url` char(255) NOT NULL,
`nurl` char(255) NOT NULL,
`addr` char(255) NOT NULL, `addr` char(255) NOT NULL,
`alias` char(255) NOT NULL, `alias` char(255) NOT NULL,
`pubkey` text NOT NULL, `pubkey` text NOT NULL,
@ -106,6 +107,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `nick` (`nick`), KEY `nick` (`nick`),
KEY `attag` (`attag`), KEY `attag` (`attag`),
KEY `url` (`url`), KEY `url` (`url`),
KEY `nurl` (`nurl`),
KEY `addr` (`addr`), KEY `addr` (`addr`),
KEY `batch` (`batch`), KEY `batch` (`batch`),
KEY `issued-id` (`issued-id`), KEY `issued-id` (`issued-id`),

View file

@ -451,13 +451,14 @@ function diaspora_request($importer,$xml) {
$batch = (($ret['batch']) ? $ret['batch'] : implode('/', array_slice(explode('/',$ret['url']),0,3)) . '/receive/public'); $batch = (($ret['batch']) ? $ret['batch'] : implode('/', array_slice(explode('/',$ret['url']),0,3)) . '/receive/public');
$r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`) $r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`)
VALUES ( %d, '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ", VALUES ( %d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ",
intval($importer['uid']), intval($importer['uid']),
dbesc($ret['network']), dbesc($ret['network']),
dbesc($ret['addr']), dbesc($ret['addr']),
datetime_convert(), datetime_convert(),
dbesc($ret['url']), dbesc($ret['url']),
dbesc(normalise_link($ret['url'])),
dbesc($batch), dbesc($batch),
dbesc($ret['name']), dbesc($ret['name']),
dbesc($ret['nick']), dbesc($ret['nick']),

View file

@ -2388,12 +2388,13 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `name`, `nick`, `photo`, `network`, `rel`,
`blocked`, `readonly`, `pending`, `writable` ) `blocked`, `readonly`, `pending`, `writable` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, 1 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, 1 ) ",
intval($importer['uid']), intval($importer['uid']),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($url), dbesc($url),
dbesc(normalise_link($url)),
dbesc($name), dbesc($name),
dbesc($nick), dbesc($nick),
dbesc($photo), dbesc($photo),

View file

@ -142,12 +142,13 @@ function dfrn_request_post(&$a) {
* Create a contact record on our site for the other person * Create a contact record on our site for the other person
*/ */
$r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `name`, `nick`, `photo`, `site-pubkey`, $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site-pubkey`,
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`) `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`)
VALUES ( %d, '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
intval(local_user()), intval(local_user()),
datetime_convert(), datetime_convert(),
dbesc($dfrn_url), dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url)),
$parms['fn'], $parms['fn'],
$parms['nick'], $parms['nick'],
$parms['photo'], $parms['photo'],
@ -371,12 +372,13 @@ function dfrn_request_post(&$a) {
dbesc_array($parms); dbesc_array($parms);
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`,`name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
`request`, `confirm`, `notify`, `poll`, `poco`, `network` ) `request`, `confirm`, `notify`, `poll`, `poco`, `network` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($uid), intval($uid),
datetime_convert(), dbesc(datetime_convert()),
$parms['url'], $parms['url'],
dbesc(normalise_link($parms['url'])),
$parms['fn'], $parms['fn'],
$parms['nick'], $parms['nick'],
$parms['issued-id'], $parms['issued-id'],

View file

@ -100,12 +100,13 @@ function follow_post(&$a) {
$new_relation = CONTACT_IS_FOLLOWER; $new_relation = CONTACT_IS_FOLLOWER;
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `writable`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
intval(local_user()), intval(local_user()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($ret['url']), dbesc($ret['url']),
dbesc(normalise_link($ret['url'])),
dbesc($ret['addr']), dbesc($ret['addr']),
dbesc($ret['alias']), dbesc($ret['alias']),
dbesc($ret['batch']), dbesc($ret['batch']),

View file

@ -268,9 +268,9 @@ function register_post(&$a) {
intval($newuid)); intval($newuid));
return; return;
} }
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
`request`, `notify`, `poll`, `confirm`, `name-date`, `uri-date`, `avatar-date` ) `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($newuid), intval($newuid),
datetime_convert(), datetime_convert(),
dbesc($username), dbesc($username),
@ -279,10 +279,12 @@ function register_post(&$a) {
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"), dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"), dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/profile/$nickname"), dbesc($a->get_baseurl() . "/profile/$nickname"),
dbesc(normalise_link($a->get_baseurl() . "/profile/$nickname")),
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"), dbesc($a->get_baseurl() . "/dfrn_request/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"), dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"), dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"), dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"),
dbesc($a->get_baseurl() . "/poco/$nickname"),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()) dbesc(datetime_convert())

View file

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1100 ); define( 'UPDATE_VERSION' , 1101 );
/** /**
* *
@ -846,6 +846,22 @@ function update_1099() {
} }
function update_1100() {
q("ALTER TABLE `contact` ADD `nurl` CHAR( 255 ) NOT NULL AFTER `url` ");
q("alter table contact add index (`nurl`) ");
require_once('include/text.php');
$r = q("select id, url from contact where url != '' and nurl = '' ");
if(count($r)) {
foreach($r as $rr) {
q("update contact set nurl = '%s' where id = %d limit 1",
dbesc(normalise_link($rr['url'])),
intval($rr['id'])
);
}
}
}