X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ftext.php;h=d6a9ef5d3a03a33dbd8b2008e50392ac9cfb1c06;hb=abb9fecf0954e883f19b3cf16279dfa2d8c20271;hp=1b5b0afd44e0b589eeb00e0c38db2107b1f628b4;hpb=0c4099966a5ac1f1ff5dc568a600aa57776fb752;p=friendica.git diff --git a/include/text.php b/include/text.php index 1b5b0afd44..d6a9ef5d3a 100644 --- a/include/text.php +++ b/include/text.php @@ -646,7 +646,7 @@ function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); $o = '
'; $o .= '
'; - $o .= ''; + $o .= ''; $o .= ''; if($save) $o .= ''; @@ -901,24 +901,30 @@ function prepare_body($item,$attach = false) { foreach($arr as $r) { $matches = false; $icon = ''; - $cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches); + $cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches, PREG_SET_ORDER); if($cnt) { - $icontype = strtolower(substr($matches[3],0,strpos($matches[3],'/'))); - switch($icontype) { - case 'video': - case 'audio': - case 'image': - case 'text': - $icon = '
'; - break; - default: - $icon = '
'; - break; + foreach($matches as $mtch) { + $icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/'))); + switch($icontype) { + case 'video': + case 'audio': + case 'image': + case 'text': + $icon = '
'; + break; + default: + $icon = '
'; + break; + } + $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1])); + $title .= ' ' . $mtch[2] . ' ' . t('bytes'); + if((local_user() == $item['uid']) && $item['contact-id'] != $a->contact['id']) + $the_url = $a->get_baseurl() . '/redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1]; + else + $the_url = $mtch[1]; + + $s .= '' . $icon . ''; } - $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1])); - $title .= ' ' . $matches[2] . ' ' . t('bytes'); - - $s .= '' . $icon . ''; } } $s .= '
'; @@ -1524,3 +1530,9 @@ function fix_mce_lf($s) { $s = str_replace("\n\n","\n",$s); return $s; } + + +function protect_sprintf($s) { + return(str_replace('%','%%',$s)); +} +