diff --git a/boot.php b/boot.php
index be47184aa2..973e3578a6 100644
--- a/boot.php
+++ b/boot.php
@@ -10,9 +10,9 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '3.0.1382' );
+define ( 'FRIENDICA_VERSION', '3.0.1388' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1149 );
+define ( 'DB_UPDATE_VERSION', 1151 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -434,6 +434,8 @@ if(! class_exists('App')) {
$this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);
$this->pager['itemspage'] = 50;
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
+ if($this->pager['start'] < 1)
+ $this->pager['start'] = 1;
$this->pager['total'] = 0;
}
@@ -1252,6 +1254,9 @@ if(! function_exists('get_birthdays')) {
'$event_reminders' => t('Birthday Reminders'),
'$event_title' => t('Birthdays this week:'),
'$events' => $r,
+ '$lbr' => '{', // raw brackets mess up if/endif macro processing
+ '$rbr' => '}'
+
));
}
}
@@ -1374,9 +1379,9 @@ if(! function_exists('proc_run')) {
if(count($args) && $args[0] === 'php')
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- foreach ($args as $arg){
- $arg = escapeshellarg($arg);
- }
+ for($x = 0; $x < count($args); $x ++)
+ $args[$x] = escapeshellarg($args[$x]);
+
$cmdline = implode($args," ");
proc_close(proc_open($cmdline." &",array(),$foo));
}
diff --git a/database.sql b/database.sql
index 53dc0c5b21..b3b8c3a060 100644
--- a/database.sql
+++ b/database.sql
@@ -254,6 +254,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`edited` datetime NOT NULL,
`start` datetime NOT NULL,
`finish` datetime NOT NULL,
+ `summary` text NOT NULL,
`desc` text NOT NULL,
`location` text NOT NULL,
`type` char(255) NOT NULL,
@@ -263,7 +264,14 @@ CREATE TABLE IF NOT EXISTS `event` (
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
`deny_gid` mediumtext NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `uid` ( `uid` ),
+ KEY `cid` ( `cid` ),
+ KEY `uri` ( `uri` ),
+ KEY `type` ( `type` ),
+ KEY `start` ( `start` ),
+ KEY `finish` ( `finish` ),
+ KEY `adjust` ( `adjust` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -831,6 +839,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
`religion` char(255) NOT NULL,
`pub_keywords` text NOT NULL,
`prv_keywords` text NOT NULL,
+ `likes` text NOT NULL,
+ `dislikes` text NOT NULL,
`about` text NOT NULL,
`summary` char(255) NOT NULL,
`music` text NOT NULL,
diff --git a/include/api.php b/include/api.php
index b77156dfae..d790b4b875 100644
--- a/include/api.php
+++ b/include/api.php
@@ -565,18 +565,19 @@
if(requestdata('lat') && requestdata('long'))
$_REQUEST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long'));
$_REQUEST['profile_uid'] = local_user();
- if(requestdata('parent'))
+
+ if($parent)
$_REQUEST['type'] = 'net-comment';
else {
$_REQUEST['type'] = 'wall';
- if(x($_FILES,'media')) {
- // upload the image if we have one
- $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
- require_once('mod/wall_upload.php');
- $media = wall_upload_post($a);
- if(strlen($media)>0)
- $_REQUEST['body'] .= "\n\n".$media;
- }
+ if(x($_FILES,'media')) {
+ // upload the image if we have one
+ $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+ require_once('mod/wall_upload.php');
+ $media = wall_upload_post($a);
+ if(strlen($media)>0)
+ $_REQUEST['body'] .= "\n\n".$media;
+ }
}
// set this so that the item_post() function is quiet and doesn't redirect or emit json
@@ -864,8 +865,13 @@
logger('API: api_statuses_show: '.$id);
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
- //$sql_extra = "";
- if ($_GET["conversation"] == "true") $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC "; else $sql_extra .= " AND `item`.`id` = %d";
+ $conversation = (x($_REQUEST,'conversation')?1:0);
+
+ $sql_extra = '';
+ if ($conversation)
+ $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC ";
+ else
+ $sql_extra .= " AND `item`.`id` = %d";
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@@ -875,16 +881,15 @@
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra
- ",
+ $sql_extra",
intval($id)
);
-//var_dump($r);
+
$ret = api_format_items($r,$user_info);
-//var_dump($ret);
- if ($_GET["conversation"] == "true") {
+
+ if ($conversation) {
$data = array('$statuses' => $ret);
- return api_apply_template("timeline", $type, $data);
+ return api_apply_template("timeline", $type, $data);
} else {
$data = array('$status' => $ret[0]);
/*switch($type){
@@ -1233,6 +1238,40 @@
return($as);
}
+ function api_format_messages($item, $recipient, $sender) {
+ // standard meta information
+ $ret=Array(
+ 'id' => $item['id'],
+ 'created_at' => api_date($item['created']),
+ 'sender_id' => $sender['id'] ,
+ 'sender_screen_name' => $sender['screen_name'],
+ 'sender' => $sender,
+ 'recipient_id' => $recipient['id'],
+ 'recipient_screen_name' => $recipient['screen_name'],
+ 'recipient' => $recipient,
+ );
+
+ //don't send title to regular StatusNET requests to avoid confusing these apps
+ if (x($_GET, 'getText')) {
+ $ret['title'] = $item['title'] ;
+ if ($_GET["getText"] == "html") {
+ $ret['text'] = bbcode($item['body']);
+ }
+ elseif ($_GET["getText"] == "plain") {
+ $ret['text'] = html2plain(bbcode($item['body']), 0);
+ }
+ }
+ else {
+ $ret['text'] = $item['title']."\n".html2plain(bbcode($item['body']), 0);
+ }
+ if (isset($_GET["getUserObjects"]) && $_GET["getUserObjects"] == "false") {
+ unset($ret['sender']);
+ unset($ret['recipient']);
+ }
+
+ return $ret;
+ }
+
function api_format_items($r,$user_info) {
//logger('api_format_items: ' . print_r($r,true));
@@ -1429,7 +1468,13 @@
'logo' => $logo, 'fancy' => 'true', 'language' => 'en', 'email' => $email, 'broughtby' => '',
'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false',
'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
- 'shorturllength' => '30'
+ 'shorturllength' => '30',
+ 'friendica' => array(
+ 'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM,
+ 'FRIENDICA_VERSION' => FRIENDICA_VERSION,
+ 'DFRN_PROTOCOL_VERSION' => DFRN_PROTOCOL_VERSION,
+ 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION
+ )
),
);
@@ -1503,37 +1548,39 @@
if (local_user()===false) return false;
if (!x($_POST, "text") || !x($_POST,"screen_name")) return;
-
+
$sender = api_get_user($a);
+ require_once("include/message.php");
+
$r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
intval(local_user()),
dbesc($_POST['screen_name']));
-
- $recipient = api_get_user($a, $r[0]['id']);
-
- require_once("include/message.php");
- $sub = ( (strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
- $id = send_message($recipient['id'], $_POST['text'], $sub);
-
-
+ $recipient = api_get_user($a, $r[0]['id']);
+ $replyto = '';
+ $sub = '';
+ if (x($_REQUEST,'replyto')) {
+ $r = q('SELECT `parent-uri`, `title` FROM `mail` WHERE `uid`=%d AND `id`=%d',
+ intval(local_user()),
+ intval($_REQUEST['replyto']));
+ $replyto = $r[0]['parent-uri'];
+ $sub = $r[0]['title'];
+ }
+ else {
+ if (x($_REQUEST,'title')) {
+ $sub = $_REQUEST['title'];
+ }
+ else {
+ $sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
+ }
+ }
+
+ $id = send_message($recipient['id'], $_POST['text'], $sub, $replyto);
+
if ($id>-1) {
$r = q("SELECT * FROM `mail` WHERE id=%d", intval($id));
- $item = $r[0];
- $ret=Array(
- 'id' => $item['id'],
- 'created_at'=> api_date($item['created']),
- 'sender_id'=> $sender['id'] ,
- 'sender_screen_name'=> $sender['screen_name'],
- 'sender'=> $sender,
- 'recipient_id'=> $recipient['id'],
- 'recipient_screen_name'=> $recipient['screen_name'],
- 'recipient'=> $recipient,
-
- 'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
-
- );
+ $ret = api_format_messages($r[0], $recipient, $sender);
} else {
$ret = array("error"=>$id);
@@ -1552,7 +1599,7 @@
}
api_register_func('api/direct_messages/new','api_direct_messages_new',true);
- function api_direct_messages_box(&$a, $type, $box) {
+ function api_direct_messages_box(&$a, $type, $box) {
if (local_user()===false) return false;
$user_info = api_get_user($a);
@@ -1564,46 +1611,37 @@
$start = $page*$count;
-
+ $profile_url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
if ($box=="sentbox") {
- $sql_extra = "`from-url`='%s'";
- } else {
- $sql_extra = "`from-url`!='%s'";
+ $sql_extra = "`from-url`='".dbesc( $profile_url )."'";
+ }
+ elseif ($box=="conversation") {
+ $sql_extra = "`parent-uri`='".dbesc( $_GET["uri"] ) ."'";
+ }
+ elseif ($box=="all") {
+ $sql_extra = "true";
+ }
+ elseif ($box=="inbox") {
+ $sql_extra = "`from-url`!='".dbesc( $profile_url )."'";
}
$r = q("SELECT * FROM `mail` WHERE uid=%d AND $sql_extra ORDER BY created DESC LIMIT %d,%d",
intval(local_user()),
- dbesc( $a->get_baseurl() . '/profile/' . $a->user['nickname'] ),
intval($start), intval($count)
- );
+ );
$ret = Array();
- foreach($r as $item){
- switch ($box){
- case "inbox":
- $recipient = $user_info;
- $sender = api_get_user($a,$item['contact-id']);
- break;
- case "sentbox":
- $recipient = api_get_user($a,$item['contact-id']);
- $sender = $user_info;
- break;
+ foreach($r as $item) {
+ if ($box == "inbox" || $item['from-url'] != $profile_url){
+ $recipient = $user_info;
+ $sender = api_get_user($a,$item['contact-id']);
}
-
- $ret[]=Array(
- 'id' => $item['id'],
- 'created_at'=> api_date($item['created']),
- 'sender_id'=> $sender['id'] ,
- 'sender_screen_name'=> $sender['screen_name'],
- 'sender'=> $sender,
- 'recipient_id'=> $recipient['id'],
- 'recipient_screen_name'=> $recipient['screen_name'],
- 'recipient'=> $recipient,
-
- 'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
-
- );
-
+ elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
+ $recipient = api_get_user($a,$item['contact-id']);
+ $sender = $user_info;
+ }
+
+ $ret[]=api_format_messages($item, $recipient, $sender);
}
@@ -1624,6 +1662,14 @@
function api_direct_messages_inbox(&$a, $type){
return api_direct_messages_box($a, $type, "inbox");
}
+ function api_direct_messages_all(&$a, $type){
+ return api_direct_messages_box($a, $type, "all");
+ }
+ function api_direct_messages_conversation(&$a, $type){
+ return api_direct_messages_box($a, $type, "conversation");
+ }
+ api_register_func('api/direct_messages/conversation','api_direct_messages_conversation',true);
+ api_register_func('api/direct_messages/all','api_direct_messages_all',true);
api_register_func('api/direct_messages/sent','api_direct_messages_sentbox',true);
api_register_func('api/direct_messages','api_direct_messages_inbox',true);
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 96cc735bdb..77a5f5c2a0 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -68,9 +68,14 @@ function stripdcode_br_cb($s) {
function diaspora_ul($s) {
- // Replace "[\\*]" followed by any number (including zero) of
+ // Replace "[*]" followed by any number (including zero) of
// spaces by "* " to match Diaspora's list format
- return preg_replace("/\[\\\\\*\]( *)/", "* ", $s[1]);
+ if( strpos($s[0], "[list]") === 0 )
+ return '
' . bbcode($ev['summary']) . '
' . "\r\n"; + $o .= '' . bbcode($ev['desc']) . '
' . "\r\n"; $o .= '' . t('Starts:') . ' get_item_tags(NAMESPACE_DFRN,'private');
- if($private && $private[0]['data'] == 1)
- $res['private'] = 1;
+ if($private && intval($private[0]['data']) > 0)
+ $res['private'] = intval($private[0]['data']);
else
$res['private'] = 0;
@@ -817,7 +817,7 @@ function item_store($arr,$force_parent = false) {
// email correspondents to be private even if the overall thread is not.
if($r[0]['private'])
- $arr['private'] = 1;
+ $arr['private'] = $r[0]['private'];
// Edge case. We host a public forum that was originally posted to privately.
// The original author commented, but as this is a comment, the permissions
@@ -1460,11 +1460,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
*
*/
- $bdtext = t('Birthday:') . ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ;
+ $bdtext = sprintf( t('%s\'s birthday'), $contact['name']);
+ $bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ) ;
- $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`)
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+ $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`)
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($contact['uid']),
intval($contact['id']),
dbesc(datetime_convert()),
@@ -1472,6 +1473,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
dbesc(datetime_convert('UTC','UTC', $birthday)),
dbesc(datetime_convert('UTC','UTC', $birthday . ' + 1 day ')),
dbesc($bdtext),
+ dbesc($bdtext2),
dbesc('birthday')
);
@@ -1660,6 +1662,21 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
continue;
}
+ $force_parent = false;
+ if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
+ if($contact['network'] === NETWORK_OSTATUS)
+ $force_parent = true;
+ if(strlen($datarray['title']))
+ unset($datarray['title']);
+ $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
+ dbesc(datetime_convert()),
+ dbesc($parent_uri),
+ intval($importer['uid'])
+ );
+ $datarray['last-child'] = 1;
+ }
+
+
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
@@ -1703,19 +1720,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
continue;
}
- $force_parent = false;
- if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
- if($contact['network'] === NETWORK_OSTATUS)
- $force_parent = true;
- if(strlen($datarray['title']))
- unset($datarray['title']);
- $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
- dbesc(datetime_convert()),
- dbesc($parent_uri),
- intval($importer['uid'])
- );
- $datarray['last-child'] = 1;
- }
if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) {
// one way feed - no remote comment ability
@@ -1728,10 +1732,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
// only one like or dislike per person
- $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
+ $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
- dbesc($datarray['verb'])
+ dbesc($datarray['verb']),
+ dbesc($parent_uri),
+ dbesc($parent_uri)
);
if($r && count($r))
continue;
@@ -1811,6 +1817,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
}
+ if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
+ if(strlen($datarray['title']))
+ unset($datarray['title']);
+ $datarray['last-child'] = 1;
+ }
+
+
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
@@ -1873,24 +1886,23 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(! is_array($contact))
return;
- if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
- if(strlen($datarray['title']))
- unset($datarray['title']);
- $datarray['last-child'] = 1;
- }
if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) {
// one way feed - no remote comment ability
$datarray['last-child'] = 0;
}
if($contact['network'] === NETWORK_FEED)
- $datarray['private'] = 1;
+ $datarray['private'] = 2;
// This is my contact on another system, but it's really me.
// Turn this into a wall post.
- if($contact['remote_self'])
+ if($contact['remote_self']) {
$datarray['wall'] = 1;
+ if($contact['network'] === NETWORK_FEED) {
+ $datarray['private'] = 0;
+ }
+ }
$datarray['parent-uri'] = $item_id;
$datarray['uid'] = $importer['uid'];
@@ -2148,6 +2160,67 @@ function local_delivery($importer,$data) {
}
if($deleted) {
+ // check for relayed deletes to our conversation
+
+ $is_reply = false;
+ $r = q("select * from item where uri = '%s' and uid = %d limit 1",
+ dbesc($uri),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ $parent_uri = $r[0]['parent-uri'];
+ if($r[0]['id'] != $r[0]['parent'])
+ $is_reply = true;
+ }
+
+ if($is_reply) {
+ $community = false;
+
+ if($importer['page-flags'] == PAGE_COMMUNITY || $importer['page-flags'] == PAGE_PRVGROUP ) {
+ $sql_extra = '';
+ $community = true;
+ logger('local_delivery: possible community delete');
+ }
+ else
+ $sql_extra = " and contact.self = 1 and item.wall = 1 ";
+
+ // was the top-level post for this reply written by somebody on this site?
+ // Specifically, the recipient?
+
+ $is_a_remote_delete = false;
+
+ $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
+ `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
+ LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
+ AND `item`.`uid` = %d
+ $sql_extra
+ LIMIT 1",
+ dbesc($parent_uri),
+ dbesc($parent_uri),
+ dbesc($parent_uri),
+ intval($importer['importer_uid'])
+ );
+ if($r && count($r))
+ $is_a_remote_delete = true;
+
+ // Does this have the characteristics of a community or private group comment?
+ // If it's a reply to a wall post on a community/prvgroup page it's a
+ // valid community comment. Also forum_mode makes it valid for sure.
+ // If neither, it's not.
+
+ if($is_a_remote_delete && $community) {
+ if((! $r[0]['forum_mode']) && (! $r[0]['wall'])) {
+ $is_a_remote_delete = false;
+ logger('local_delivery: not a community delete');
+ }
+ }
+
+ if($is_a_remote_delete) {
+ logger('local_delivery: received remote delete');
+ }
+ }
+
$r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join contact on `item`.`contact-id` = `contact`.`id`
WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
dbesc($uri),
@@ -2235,7 +2308,11 @@ function local_delivery($importer,$data) {
);
}
}
- }
+ // if this is a relayed delete, propagate it to other recipients
+
+ if($is_a_remote_delete)
+ proc_run('php',"include/notifier.php","drop",$item['id']);
+ }
}
}
}
@@ -2268,15 +2345,17 @@ function local_delivery($importer,$data) {
$is_a_remote_comment = false;
+ // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
+ WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
AND `item`.`uid` = %d
$sql_extra
LIMIT 1",
dbesc($parent_uri),
dbesc($parent_uri),
+ dbesc($parent_uri),
intval($importer['importer_uid'])
);
if($r && count($r))
@@ -2364,10 +2443,13 @@ function local_delivery($importer,$data) {
$datarray['gravity'] = GRAVITY_LIKE;
$datarray['last-child'] = 0;
// only one like or dislike per person
- $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
+ $r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s' or `parent-uri` = '%s') and deleted = 0 limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
- dbesc($datarray['verb'])
+ dbesc($datarray['verb']),
+ dbesc($datarray['parent-uri']),
+ dbesc($datarray['parent-uri'])
+
);
if($r && count($r))
continue;
@@ -2535,10 +2617,12 @@ function local_delivery($importer,$data) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
// only one like or dislike per person
- $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
+ $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
- dbesc($datarray['verb'])
+ dbesc($datarray['verb']),
+ dbesc($parent_uri),
+ dbesc($parent_uri)
);
if($r && count($r))
continue;
@@ -2933,8 +3017,10 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
if(strlen($item['owner-name']))
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
- if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']))
- $o .= '
t |