Continued a bit:

- opps, cherry-pick/rebase/what-ever did not take all over
- used x() for array key check

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-05-22 13:09:07 +02:00
parent 291af19f25
commit e9c9c47a84
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -1352,8 +1352,9 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$update = (!local_user() and !remote_user() and ($item["uid"] == 0)); $update = (!local_user() and !remote_user() and ($item["uid"] == 0));
// Or update it if the current viewer is the intented viewer // Or update it if the current viewer is the intented viewer
if (($item["uid"] == local_user()) AND ($item["uid"] != 0)) if (($item["uid"] == local_user()) AND ($item["uid"] != 0)) {
$update = true; $update = true;
}
put_item_in_cache($item, $update); put_item_in_cache($item, $update);
$s = $item["rendered-html"]; $s = $item["rendered-html"];
@ -1371,7 +1372,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$as = ''; $as = '';
$vhead = false; $vhead = false;
$arr = explode('[/attach],',$item['attach']); $arr = explode('[/attach],', $item['attach']);
if (count($arr)) { if (count($arr)) {
$as .= '<div class="body-attach">'; $as .= '<div class="body-attach">';
foreach ($arr as $r) { foreach ($arr as $r) {
@ -1382,10 +1383,11 @@ function prepare_body(&$item, $attach = false, $preview = false) {
foreach ($matches as $mtch) { foreach ($matches as $mtch) {
$mime = $mtch[3]; $mime = $mtch[3];
if ((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) if ((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) {
$the_url = 'redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1]; $the_url = 'redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1];
else } else {
$the_url = $mtch[1]; $the_url = $mtch[1];
}
if (strpos($mime, 'video') !== false) { if (strpos($mime, 'video') !== false) {
if (!$vhead) { if (!$vhead) {
@ -1400,11 +1402,11 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$id = end(explode('/', $the_url)); $id = end(explode('/', $the_url));
$as .= replace_macros(get_markup_template('video_top.tpl'), array( $as .= replace_macros(get_markup_template('video_top.tpl'), array(
'$video' => array( '$video' => array(
'id' => $id, 'id' => $id,
'title' => t('View Video'), 'title' => t('View Video'),
'src' => $the_url, 'src' => $the_url,
'mime' => $mime, 'mime' => $mime,
), ),
)); ));
} }
@ -1444,7 +1446,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$s = $s . $as; $s = $s . $as;
// map // map
if (strpos($s, '<div class="map">') !== false && $item['coord']) { if (strpos($s, '<div class="map">') !== false && x($item, 'coord')) {
$x = generate_map(trim($item['coord'])); $x = generate_map(trim($item['coord']));
if ($x) { if ($x) {
$s = preg_replace('/\<div class\=\"map\"\>/','$0' . $x,$s); $s = preg_replace('/\<div class\=\"map\"\>/','$0' . $x,$s);
@ -1934,14 +1936,13 @@ function file_tag_list_to_file($list,$type = 'file') {
if ($type == 'file') { if ($type == 'file') {
$lbracket = '['; $lbracket = '[';
$rbracket = ']'; $rbracket = ']';
} } else {
else {
$lbracket = '<'; $lbracket = '<';
$rbracket = '>'; $rbracket = '>';
} }
foreach ($list_array as $item) { foreach ($list_array as $item) {
if (strlen($item)) { if (strlen($item)) {
$tag_list .= $lbracket . file_tag_encode(trim($item)) . $rbracket; $tag_list .= $lbracket . file_tag_encode(trim($item)) . $rbracket;
} }
} }
@ -1960,8 +1961,9 @@ function file_tag_file_to_list($file,$type = 'file') {
} }
if ($cnt) { if ($cnt) {
foreach ($matches as $mtch) { foreach ($matches as $mtch) {
if (strlen($list)) if (strlen($list)) {
$list .= ','; $list .= ',';
}
$list .= file_tag_decode($mtch[1]); $list .= file_tag_decode($mtch[1]);
} }
} }