handle escaped file chars in display and search
This commit is contained in:
parent
7581b32bb3
commit
53f799f2bc
|
@ -87,7 +87,7 @@ function fileas_widget($baseurl,$selected = '') {
|
||||||
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
||||||
if($cnt) {
|
if($cnt) {
|
||||||
foreach($matches as $mtch) {
|
foreach($matches as $mtch) {
|
||||||
$unescaped = file_tag_decode($mtch[1]);
|
$unescaped = xmlify(file_tag_decode($mtch[1]));
|
||||||
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -920,7 +920,7 @@ function prepare_body($item,$attach = false) {
|
||||||
foreach($matches as $mtch) {
|
foreach($matches as $mtch) {
|
||||||
if(strlen($x))
|
if(strlen($x))
|
||||||
$x .= ',';
|
$x .= ',';
|
||||||
$x .= file_tag_decode($mtch[1]);
|
$x .= xmlify(file_tag_decode($mtch[1]));
|
||||||
}
|
}
|
||||||
if(strlen($x))
|
if(strlen($x))
|
||||||
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
|
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
|
||||||
|
@ -935,7 +935,7 @@ function prepare_body($item,$attach = false) {
|
||||||
foreach($matches as $mtch) {
|
foreach($matches as $mtch) {
|
||||||
if(strlen($x))
|
if(strlen($x))
|
||||||
$x .= ' ';
|
$x .= ' ';
|
||||||
$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']))
|
if(strlen($x) && (local_user() == $item['uid']))
|
||||||
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
|
$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') {
|
function file_tag_file_query($table,$s,$type = 'file') {
|
||||||
|
|
||||||
// this is ultimately going into a vsprintf
|
|
||||||
$s = str_replace('%','%%',$s);
|
|
||||||
|
|
||||||
if($type == 'file')
|
if($type == 'file')
|
||||||
$str = preg_quote( '[' . file_tag_encode($s) . ']' );
|
$str = preg_quote( '[' . str_replace('%','%%',file_tag_encode($s)) . ']' );
|
||||||
else
|
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) . "' ";
|
return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ function filer_content(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$term = notags(trim($_GET['term']));
|
$term = unxmlify(trim($_GET['term']));
|
||||||
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
|
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||||
|
|
||||||
logger('filer: tag ' . $term . ' item ' . $item_id);
|
logger('filer: tag ' . $term . ' item ' . $item_id);
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ function filerm_content(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$term = notags(trim($_GET['term']));
|
$term = unxmlify(trim($_GET['term']));
|
||||||
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
|
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||||
|
|
||||||
logger('filerm: tag ' . $term . ' item ' . $item_id);
|
logger('filerm: tag ' . $term . ' item ' . $item_id);
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ function network_content(&$a, $update = 0) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(strlen($file)) {
|
if(strlen($file)) {
|
||||||
$sql_extra .= file_tag_file_query('item',$file);
|
$sql_extra .= file_tag_file_query('item',unxmlify($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($conv) {
|
if($conv) {
|
||||||
|
|
Loading…
Reference in a new issue