handle escaped file chars in display and search

This commit is contained in:
friendica 2012-03-31 15:25:17 -07:00
parent 7581b32bb3
commit 53f799f2bc
5 changed files with 10 additions and 13 deletions

View file

@ -920,7 +920,7 @@ function prepare_body($item,$attach = false) {
foreach($matches as $mtch) {
if(strlen($x))
$x .= ',';
$x .= file_tag_decode($mtch[1]);
$x .= xmlify(file_tag_decode($mtch[1]));
}
if(strlen($x))
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
@ -935,7 +935,7 @@ function prepare_body($item,$attach = false) {
foreach($matches as $mtch) {
if(strlen($x))
$x .= '&nbsp;&nbsp;&nbsp;';
$x .= file_tag_decode($mtch[1]). ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . file_tag_decode($mtch[1]) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
$x .= xmlify(file_tag_decode($mtch[1])) . ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
}
if(strlen($x) && (local_user() == $item['uid']))
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
@ -1307,13 +1307,10 @@ function file_tag_decode($s) {
function file_tag_file_query($table,$s,$type = 'file') {
// this is ultimately going into a vsprintf
$s = str_replace('%','%%',$s);
if($type == 'file')
$str = preg_quote( '[' . file_tag_encode($s) . ']' );
$str = preg_quote( '[' . str_replace('%','%%',file_tag_encode($s)) . ']' );
else
$str = preg_quote( '<' . file_tag_encode($s) . '>' );
$str = preg_quote( '<' . str_replace('%','%%',file_tag_encode($s)) . '>' );
return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' ";
}