X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=include%2Fitems.php;h=32f0728c33fa5b16f9119477c20be8815ed59079;hb=8bfd405beef2224628e1666c1a1248e3c5a2205c;hp=1603dec601c0c10cd6521a40e0405b6034dbd35d;hpb=d0926240a87327a7e38b822802ac192336f68791;p=friendica.git
diff --git a/include/items.php b/include/items.php
index 1603dec601..32f0728c33 100644
--- a/include/items.php
+++ b/include/items.php
@@ -20,6 +20,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
for($x = 2; $x < $a->argc; $x++) {
if($a->argv[$x] == 'converse')
$converse = true;
+ if($a->argv[$x] == 'starred')
+ $starred = true;
}
}
@@ -376,6 +378,10 @@ function get_atom_elements($feed,$item) {
if($dguid)
$res['guid'] = unxmlify($dguid[0]['data']);
+ $bm = $item->get_item_tags(NAMESPACE_DFRN,'bookmark');
+ if($bm)
+ $res['bookmark'] = ((unxmlify($bm[0]['data']) === 'true') ? 1 : 0);
+
/**
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
@@ -711,6 +717,7 @@ function item_store($arr,$force_parent = false) {
$arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
+ $arr['commented'] = datetime_convert();
$arr['received'] = datetime_convert();
$arr['changed'] = datetime_convert();
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
@@ -731,6 +738,7 @@ function item_store($arr,$force_parent = false) {
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0 );
+ $arr['bookmark'] = ((x($arr,'bookmark')) ? intval($arr['bookmark']) : 0 );
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
$arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : '');
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
@@ -858,6 +866,14 @@ function item_store($arr,$force_parent = false) {
intval($current_post)
);
+ // update the commented timestamp on the parent
+
+ q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ intval($parent_id)
+ );
+
if($dsprsig) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($current_post),
@@ -1026,6 +1042,9 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if((! $curl_stat) || (! strlen($xml)))
return(-1); // timed out
+ if(($curl_stat == 503) && (stristr($a->get_curl_headers(),'retry-after')))
+ return(-1);
+
if(strpos($xml,' $a->config['sitename']
));
$res = mail($r[0]['email'],
- t("You have a new follower at ") . $a->config['sitename'],
+ (($sharing) ? t('A new person is sharing with you at ') : t("You have a new follower at ")) . $a->config['sitename'],
$email,
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
@@ -1598,14 +1630,32 @@ function lose_follower($importer,$contact,$datarray,$item) {
}
}
+function lose_sharer($importer,$contact,$datarray,$item) {
+
+ if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
+ q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d LIMIT 1",
+ intval(CONTACT_IS_FOLLOWER),
+ intval($contact['id'])
+ );
+ }
+ else {
+ contact_remove($contact['id']);
+ }
+}
-function subscribe_to_hub($url,$importer,$contact) {
+
+function subscribe_to_hub($url,$importer,$contact,$submode = 'subscribe') {
if(is_array($importer)) {
$r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
);
}
+
+ // Diaspora has different message-ids in feeds than they do
+ // through the direct Diaspora protocol. If we try and use
+ // the feed, we'll get duplicates. So don't.
+
if((! count($r)) || $contact['network'] === NETWORK_DIASPORA)
return;
@@ -1615,7 +1665,7 @@ function subscribe_to_hub($url,$importer,$contact) {
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
- $params= 'hub.mode=subscribe&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;
+ $params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;
logger('subscribe_to_hub: subscribing ' . $contact['name'] . ' to hub ' . $url . ' with verifier ' . $verify_token);
@@ -1704,6 +1754,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
if($item['extid'])
$o .= '' . xmlify($item['extid']) . '' . "\r\n";
+ if($item['bookmark'])
+ $o .= 'true' . "\r\n";
if($item['app'])
$o .= '' . "\r\n";