ticket system clean tags

This commit is contained in:
OpenXE 2023-05-02 21:05:32 +02:00
parent 63dbedc1a8
commit 1bf58aa8ba

View File

@ -480,6 +480,22 @@ class Ticket {
$input['warteschlange'] = explode(" ",$input['warteschlange'])[0]; // Just the label
$input['zeit'] = date('Y-m-d H:i:s', time());
$tags = explode(',',$input['tags']);
// Replace multiple '!' and '?'
foreach ($tags as &$tag) {
$pos = strpos($tag, '?');
if ($pos !== false) {
$tag = substr($tag,0,$pos+1) . str_replace('?','',substr($tag,$pos+1));
}
$tag = preg_replace("/([?!])\\1+/", "$1", $tag);
}
$input['tags'] = implode(',',$tags);
$input['tags'] = str_replace(' ?','?',$input['tags']);
$input['tags'] = str_replace(' !','!',$input['tags']);
$input['tags'] = str_replace('?!','?',$input['tags']);
$input['tags'] = str_replace('!?','?',$input['tags']);
$columns = "id, ";
$values = "$id, ";
$update = "";