add _ in regular expression when selected kownlink

This commit is contained in:
Nicolas Debrigode 2020-01-02 15:53:39 +01:00
parent 23fa0de20f
commit 02bc0fb0f7

View File

@ -34,13 +34,18 @@ if(isset($_GET['selected_links'])){
$reverse = array(); $reverse = array();
foreach($knownlinks as $link) foreach($knownlinks as $link)
$reverse[$link['tag']] = array('color' => $link['color'], 'descr' => $link['descr']); $reverse[$link['tag']] = array('color' => $link['color'], 'descr' => $link['descr']);
$links = array(); $links = array();
foreach(explode(',', $_GET['selected_links']) as $tag){ foreach(explode(',', $_GET['selected_links']) as $tag){
if (preg_match('/[^a-zA-Z0-9]/', $tag)) if (preg_match('/[^a-zA-Z0-9_]/', $tag))
continue; continue;
$link = array('tag' => $tag,
$link = array(
'tag' => $tag,
'color' => $reverse[$tag]['color'], 'color' => $reverse[$tag]['color'],
'descr' => $reverse[$tag]['descr']); 'descr' => $reverse[$tag]['descr']
);
$links[] = $link; $links[] = $link;
} }
$knownlinks = $links; $knownlinks = $links;