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