From e9c9c47a84c671ecf2bb4cf98efb3728e1f1fb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2017 13:09:07 +0200 Subject: [PATCH] Continued a bit: - opps, cherry-pick/rebase/what-ever did not take all over - used x() for array key check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- include/text.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/include/text.php b/include/text.php index 3b04c86637..c0a71cc784 100644 --- a/include/text.php +++ b/include/text.php @@ -1352,8 +1352,9 @@ function prepare_body(&$item, $attach = false, $preview = false) { $update = (!local_user() and !remote_user() and ($item["uid"] == 0)); // 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; + } put_item_in_cache($item, $update); $s = $item["rendered-html"]; @@ -1371,7 +1372,7 @@ function prepare_body(&$item, $attach = false, $preview = false) { $as = ''; $vhead = false; - $arr = explode('[/attach],',$item['attach']); + $arr = explode('[/attach],', $item['attach']); if (count($arr)) { $as .= '
'; foreach ($arr as $r) { @@ -1382,10 +1383,11 @@ function prepare_body(&$item, $attach = false, $preview = false) { foreach ($matches as $mtch) { $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]; - else + } else { $the_url = $mtch[1]; + } if (strpos($mime, 'video') !== false) { if (!$vhead) { @@ -1400,11 +1402,11 @@ function prepare_body(&$item, $attach = false, $preview = false) { $id = end(explode('/', $the_url)); $as .= replace_macros(get_markup_template('video_top.tpl'), array( - '$video' => array( - 'id' => $id, - 'title' => t('View Video'), - 'src' => $the_url, - 'mime' => $mime, + '$video' => array( + 'id' => $id, + 'title' => t('View Video'), + 'src' => $the_url, + 'mime' => $mime, ), )); } @@ -1444,7 +1446,7 @@ function prepare_body(&$item, $attach = false, $preview = false) { $s = $s . $as; // map - if (strpos($s, '
') !== false && $item['coord']) { + if (strpos($s, '
') !== false && x($item, 'coord')) { $x = generate_map(trim($item['coord'])); if ($x) { $s = preg_replace('/\
/','$0' . $x,$s); @@ -1934,14 +1936,13 @@ function file_tag_list_to_file($list,$type = 'file') { if ($type == 'file') { $lbracket = '['; $rbracket = ']'; - } - else { + } else { $lbracket = '<'; $rbracket = '>'; } foreach ($list_array as $item) { - if (strlen($item)) { + if (strlen($item)) { $tag_list .= $lbracket . file_tag_encode(trim($item)) . $rbracket; } } @@ -1960,8 +1961,9 @@ function file_tag_file_to_list($file,$type = 'file') { } if ($cnt) { foreach ($matches as $mtch) { - if (strlen($list)) + if (strlen($list)) { $list .= ','; + } $list .= file_tag_decode($mtch[1]); } }