X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=733cd8048410911943cc79d867b3c306e85695ac;hb=a0179235d2d4672ba9dc79b33505555766b3228a;hp=501f2f94478717ecdd92d19aae01de43d06b0cac;hpb=6728a11ee38e890a0ce9b8b6d96dba98a7238129;p=friendica.git diff --git a/include/items.php b/include/items.php index 501f2f9447..733cd80484 100644 --- a/include/items.php +++ b/include/items.php @@ -477,10 +477,12 @@ function get_atom_elements($feed,$item) { if($attach) { $att_arr = array(); foreach($attach as $att) { - $len = intval($att->get_length()); - $link = str_replace(',','%2D', notags(trim($att->get_link()))); - $title = str_replace(',','%2D',notags(trim($att->get_title()))); - $type = notags(trim($att->get_type())); + $len = intval($att->get_length()); + $link = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_link())))); + $title = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_title())))); + $type = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_type())))); + if(strpos($type,';')) + $type = substr($type,0,strpos($type,';')); if((! $link) || (strpos($link,'http') !== 0)) continue; @@ -489,9 +491,7 @@ function get_atom_elements($feed,$item) { if(! $type) $type = 'application/octet-stream'; - // this isn't legal html - there is no size in an 'a' tag, remember to strip it before display - - $att_arr[] = '' . $title . ''; + $att_arr[] = '[attach]href="' . $link . '" size="' . $len . '" type="' . $type . '" title="' . $title . '"[/attach]'; } $res['attach'] = implode(',', $att_arr); } @@ -653,6 +653,7 @@ function item_store($arr,$force_parent = false) { $arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 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'])) : ''); if($arr['parent-uri'] === $arr['uri']) { $parent_id = 0; @@ -866,14 +867,14 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if($dissolve) $postvars['dissolve'] = '1'; - if(($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked']) && (! $contact['readonly'])) { - $postvars['data'] = $atom; - } - elseif($owner['page-flags'] == PAGE_COMMUNITY) { + + if((($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { $postvars['data'] = $atom; + $postvars['perm'] = 'rw'; } else { $postvars['data'] = str_replace('1','0',$atom); + $postvars['perm'] = 'r'; } if($rino && $rino_allowed && (! $dissolve)) { @@ -915,7 +916,6 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if((! $curl_stat) || (! strlen($xml))) return(-1); // timed out - if(strpos($xml,'status; - + return $res->status; } @@ -1368,8 +1367,8 @@ function new_follower($importer,$contact,$datarray,$item) { // create contact record - set to readonly $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`, - `blocked`, `readonly`, `pending` ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1 ) ", + `blocked`, `readonly`, `pending`, `writable` ) + VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1, 1 ) ", intval($importer['uid']), dbesc(datetime_convert()), dbesc($url), @@ -1416,7 +1415,9 @@ function new_follower($importer,$contact,$datarray,$item) { $res = mail($r[0]['email'], t("You have a new follower at ") . $a->config['sitename'], $email, - 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] ); + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); } } @@ -1584,18 +1585,18 @@ function item_getfeedtags($item) { } function item_getfeedattach($item) { - $ret = array(); + $ret = ''; $arr = explode(',',$item['attach']); if(count($arr)) { foreach($arr as $r) { $matches = false; - $cnt = preg_match('|\(.+?)|',$item['attach'],$matches); + $cnt = preg_match('|\[attach\]href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" title=\"(.+?)\"\[\/attach\]|',$r,$matches); if($cnt) { - $ret .= '