aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorVasudev Kamath <kamathvasudev@gmail.com>2012-06-11 20:47:11 +0530
committerVasudev Kamath <kamathvasudev@gmail.com>2012-06-11 20:47:11 +0530
commit11974b4d948ae5d9b9fb53970838463bd88bb9f6 (patch)
tree426724e218a2fcaf3a1a2eedf6ffa591299755ee /include/items.php
parent079fdecff1f4daa534045f4bd857e6ae6324474d (diff)
parentafa88154114d5632cb13e7c3f56143cccdfd7daa (diff)
downloadvolse-hubzilla-11974b4d948ae5d9b9fb53970838463bd88bb9f6.tar.gz
volse-hubzilla-11974b4d948ae5d9b9fb53970838463bd88bb9f6.tar.bz2
volse-hubzilla-11974b4d948ae5d9b9fb53970838463bd88bb9f6.zip
Merge branch 'master' of git://github.com/friendica/friendica
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php43
1 files changed, 33 insertions, 10 deletions
diff --git a/include/items.php b/include/items.php
index 4513db1db..95a885a1b 100755
--- a/include/items.php
+++ b/include/items.php
@@ -693,6 +693,8 @@ function encode_rel_links($links) {
return xmlify($o);
}
+
+
function item_store($arr,$force_parent = false) {
// If a Diaspora signature structure was passed in, pull it out of the
@@ -806,6 +808,14 @@ function item_store($arr,$force_parent = false) {
$deny_cid = $r[0]['deny_cid'];
$deny_gid = $r[0]['deny_gid'];
$arr['wall'] = $r[0]['wall'];
+
+ // if the parent is private, force privacy for the entire conversation
+ // This differs from the above settings as it subtly allows comments from
+ // email correspondents to be private even if the overall thread is not.
+
+ if($r[0]['private'])
+ $arr['private'] = 1;
+
}
else {
@@ -1304,6 +1314,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$birthday = '';
$hubs = $feed->get_links('hub');
+ logger('consume_feed: hubs: ' . print_r($hubs,true), LOGGER_DATA);
if(count($hubs))
$hub = implode(',', $hubs);
@@ -1346,7 +1357,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
$img_str = fetch_url($photo_url,true);
- $img = new Photo($img_str);
+ // guess mimetype from headers or filename
+ $type = guess_image_type($photo_url,true);
+
+
+ $img = new Photo($img_str, $type);
if($img->is_valid()) {
if($have_photo) {
q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `contact-id` = %d AND `uid` = %d",
@@ -1372,9 +1387,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc(datetime_convert()),
- dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.jpg'),
- dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.jpg'),
- dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.jpg'),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.'.$img->getExt()),
intval($contact['uid']),
intval($contact['id'])
);
@@ -1830,9 +1845,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$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) {
+ if(! strlen($contact['notify'])) {
+ // one way feed - no remote comment ability
+ $datarray['last-child'] = 0;
+ }
+ $datarray['private'] = 1;
}
// This is my contact on another system, but it's really me.
@@ -2777,6 +2795,8 @@ function lose_sharer($importer,$contact,$datarray,$item) {
function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
+ $a = get_app();
+
if(is_array($importer)) {
$r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
@@ -2807,7 +2827,10 @@ function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
);
}
- post_url($url,$params);
+ post_url($url,$params);
+
+ logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG);
+
return;
}
@@ -2943,7 +2966,7 @@ function fix_private_photos($s,$uid, $item = null, $cid = 0) {
if(stristr($image , $site . '/photo/')) {
$replace = false;
$i = basename($image);
- $i = str_replace('.jpg','',$i);
+ $i = str_replace(array('.jpg','.png'),array('',''),$i);
$x = strpos($i,'-');
if($x) {
$res = substr($i,$x+1);
@@ -2985,7 +3008,7 @@ function fix_private_photos($s,$uid, $item = null, $cid = 0) {
}
if($replace) {
logger('fix_private_photos: replacing photo', LOGGER_DEBUG);
- $s = str_replace($image, 'data:image/jpg;base64,' . base64_encode($r[0]['data']), $s);
+ $s = str_replace($image, 'data:' . $r[0]['type'] . ';base64,' . base64_encode($r[0]['data']), $s);
logger('fix_private_photos: replaced: ' . $s, LOGGER_DATA);
}
}