diff options
-rw-r--r-- | index.php | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1207,15 +1207,15 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1207 | $needle = trim($_POST['fromtag']); | 1207 | $needle = trim($_POST['fromtag']); |
1208 | // True for case-sensitive tag search. | 1208 | // True for case-sensitive tag search. |
1209 | $linksToAlter = $LINKSDB->filterSearch(array('searchtags' => $needle), true); | 1209 | $linksToAlter = $LINKSDB->filterSearch(array('searchtags' => $needle), true); |
1210 | foreach($linksToAlter as $key=>$value) | 1210 | foreach($linksToAlter as $key=>$value) { |
1211 | { | 1211 | $tags = preg_split('/\s+/', trim($value['tags'])); |
1212 | $tags = explode(' ',trim($value['tags'])); | 1212 | // Replace tags value. |
1213 | $tags[array_search($needle,$tags)] = trim($_POST['totag']); // Replace tags value. | 1213 | $tags[array_search($needle, $tags)] = trim($_POST['totag']); |
1214 | $value['tags']=trim(implode(' ',$tags)); | 1214 | $value['tags'] = implode(' ', array_unique($tags)); |
1215 | $LINKSDB[$key]=$value; | 1215 | $LINKSDB[$key] = $value; |
1216 | } | 1216 | } |
1217 | $LINKSDB->save($conf->get('resource.page_cache')); // Save to disk. | 1217 | $LINKSDB->save($conf->get('resource.page_cache')); // Save to disk. |
1218 | echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode($_POST['totag']).'\';</script>'; | 1218 | echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode(escape($_POST['totag'])).'\';</script>'; |
1219 | exit; | 1219 | exit; |
1220 | } | 1220 | } |
1221 | } | 1221 | } |