From 1bf58aa8ba76fda89d9f3064641eca6ed3b5c370 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Tue, 2 May 2023 21:05:32 +0200 Subject: [PATCH] ticket system clean tags --- www/pages/ticket.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/pages/ticket.php b/www/pages/ticket.php index e1ddb2e3..ac60a064 100644 --- a/www/pages/ticket.php +++ b/www/pages/ticket.php @@ -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 = "";