aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_notify.php18
-rw-r--r--mod/item.php28
-rw-r--r--mod/network.php12
-rw-r--r--mod/profile.php10
4 files changed, 36 insertions, 32 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index ed2222d6a..1d7ca3a50 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -54,7 +54,7 @@ dbg(3);
$rawthread = $item->get_item_tags("http://purl.org/syndication/thread/1.0",'in-reply-to');
if(isset($rawthread[0]['attribs']['']['ref'])) {
$is_reply = true;
- $parent_urn = $rawthread[0]['attribs']['']['ref'];
+ $parent_uri = $rawthread[0]['attribs']['']['ref'];
}
@@ -64,7 +64,7 @@ dbg(3);
$datarray = get_atom_elements($item);
$urn = explode(':',$parent_urn);
$datarray['type'] = 'remote-comment';
- $datarray['parent_hash'] = $urn[5];
+ $datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$posted_id = post_remote($a,$datarray);
@@ -84,7 +84,7 @@ dbg(3);
intval($posted_id)
);
- $url = bin2hex($a->get_baseurl());
+ $url = $a->get_baseurl();
proc_close(proc_open("php include/notifier.php $url comment-import $posted_id > remote-notify.log &", array(),$foo));
@@ -97,7 +97,7 @@ dbg(3);
$item_id = $item->get_id();
- $r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
@@ -105,7 +105,7 @@ dbg(3);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
- $r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@@ -114,7 +114,7 @@ dbg(3);
continue;
}
$datarray = get_atom_elements($item);
- $datarray['parent_urn'] = $parent_urn;
+ $datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);
@@ -125,14 +125,14 @@ dbg(3);
// Head post of a conversation. Have we seen it? If not, import it.
$item_id = $item->get_id();
- $r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
- $r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@@ -143,7 +143,7 @@ dbg(3);
$datarray = get_atom_elements($item);
- $datarray['parent_urn'] = $item_id;
+ $datarray['parent-uri'] = $item['uri']
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);
diff --git a/mod/item.php b/mod/item.php
index 1584c7ddb..e0497af7a 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -99,26 +99,28 @@ function item_post(&$a) {
do {
$dups = false;
$hash = random_string();
- $r = q("SELECT `id` FROM `item` WHERE `hash` = '%s' LIMIT 1",
- dbesc($hash));
+
+ $uri = "urn:X-dfrn:" . $a->get_hostname() . ':' . $profile_uid . ':' . $hash;
+
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
+ dbesc($uri));
if(count($r))
$dups = true;
} while($dups == true);
- $r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `remote-id`, `created`,`edited`,`hash`,`body`,
- `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
- VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ $r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `created`,
+ `edited`, `uri`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
+ VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($profile_uid),
dbesc($_POST['type']),
intval($contact_id),
dbesc($contact_record['name']),
dbesc($contact_record['url']),
dbesc($contact_record['thumb']),
- dbesc("urn:X-dfrn:" . $a->get_baseurl() . ':' . intval($profile_uid) . ':' . $hash),
datetime_convert(),
datetime_convert(),
- dbesc($hash),
+ dbesc($uri),
dbesc(escape_tags(trim($_POST['body']))),
dbesc($str_contact_allow),
dbesc($str_group_allow),
@@ -126,8 +128,8 @@ function item_post(&$a) {
dbesc($str_group_deny)
);
- $r = q("SELECT `id` FROM `item` WHERE `hash` = '%s' LIMIT 1",
- dbesc($hash));
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
+ dbesc($uri));
if(count($r)) {
$post_id = $r[0]['id'];
@@ -154,13 +156,15 @@ function item_post(&$a) {
$parent = $post_id;
}
- $r = q("UPDATE `item` SET `parent` = %d, `last-child` = 1, `visible` = 1
+ $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `last-child` = 1, `visible` = 1
WHERE `id` = %d LIMIT 1",
intval($parent),
- intval($post_id));
+ dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
+ intval($post_id)
+ );
}
- $url = bin2hex($a->get_baseurl());
+ $url = $a->get_baseurl();
proc_close(proc_open("php include/notifier.php \"$url\" \"$notify_type\" \"$post_id\" > notify.log &",
array(),$foo));
diff --git a/mod/network.php b/mod/network.php
index aa662c79c..3ccd8be48 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -92,7 +92,7 @@ function network_content(&$a) {
$template = $wallwall;
$commentww = 'ww';
}
- if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) {
+ if($item['type'] == 'remote' && ($item['owner-link'] != $item['author-link'])) {
// Could be anybody.
$owner_url = $item['owner-link'];
$owner_photo = $item['owner-avatar'];
@@ -125,18 +125,18 @@ function network_content(&$a) {
// Post was remotely authored.
- $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
- $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb);
+ $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
+ $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $thumb);
$profile_link = $profile_url;
// Can we use our special contact URL for this author?
- if(strlen($item['remote-link'])) {
- if($item['remote-link'] == $item['url'])
+ if(strlen($item['author-link'])) {
+ if($item['author-link'] == $item['url'])
$profile_link = $redirect_url;
else
- $profile_link = $item['remote-link'];
+ $profile_link = $item['author-link'];
}
// Build the HTML
diff --git a/mod/profile.php b/mod/profile.php
index f14cdbd11..7a3858ba2 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -141,9 +141,9 @@ function profile_content(&$a) {
}
$sql_extra = sprintf(
" AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' )
- AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
- AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
- AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s') ",
+ AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
+ AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
+ AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s') ",
intval($_SESSION['visitor_id']),
intval($_SESSION['visitor_id']),
@@ -224,8 +224,8 @@ function profile_content(&$a) {
// known to us and is reflected in the contact-id for this item. We can use the contact url or redirect rather than
// use the link in the feed. This is different than on the network page where we may not know the author.
- $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
- $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $item['thumb']);
+ $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
+ $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
$profile_link = $profile_url;
$o .= replace_macros($template,array(