From dd69539ab2ed7888d04a4ec321e3c229b9fb9727 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 4 Jan 2022 20:12:45 +0200 Subject: [PATCH] update post filtering --- src/application/controller/api/post/get.php | 8 ++++---- src/system/helper/format.php | 20 -------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/application/controller/api/post/get.php b/src/application/controller/api/post/get.php index d7a491e..543dfda 100644 --- a/src/application/controller/api/post/get.php +++ b/src/application/controller/api/post/get.php @@ -28,14 +28,14 @@ if (isset($_SESSION['userName'])) { foreach ($result as $post) { // Split message parts - $messages = [Filter::string($post['userpost']['msg'])]; + $messages = [Filter::post($post['userpost']['msg'])]; for ($i = 0; $i <= APPLICATION_MAX_POST_SPLIT; $i++) { $n = sprintf('msg%s', $i); if (isset($post['userpost'][$n])) { - $messages[] = Filter::string($post['userpost'][$n]); + $messages[] = Filter::post($post['userpost'][$n]); } } @@ -44,14 +44,14 @@ if (isset($_SESSION['userName'])) { if (isset($post['userpost']['rt'])) { // Split reTwists parts - $reTwists = [Filter::string($post['userpost']['rt']['msg'])]; + $reTwists = [Filter::post($post['userpost']['rt']['msg'])]; for ($i = 0; $i <= APPLICATION_MAX_POST_SPLIT; $i++) { $n = sprintf('msg%s', $i); if (isset($post['userpost']['rt'][$n])) { - $reTwists[] = Filter::string($post['userpost']['rt'][$n]); + $reTwists[] = Filter::post($post['userpost']['rt'][$n]); } } diff --git a/src/system/helper/format.php b/src/system/helper/format.php index 0c3da1a..6b70d0f 100644 --- a/src/system/helper/format.php +++ b/src/system/helper/format.php @@ -79,24 +79,4 @@ class Format { return $string; } - - // @TODO REPLACE - public static function text(string $string) { - - $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8'); - $string = htmlentities($string, ENT_QUOTES, 'UTF-8'); - - $string = preg_replace("|([\s])\*([\S]+)\*([\s]?)|i", "$1$2$3", $string); - $string = preg_replace("|([\s])\~([\S]+)\~([\s]?)|i", "$1$2$3", $string); - $string = preg_replace("|([\s])\_([\S]+)\_([\s]?)|i", "$1$2$3", $string); - $string = preg_replace("|([\s])\-([\S]+)\-([\s]?)|i", "$1$2$3", $string); - $string = preg_replace("|([\s])\`([\S]+)\`([\s]?)|i", "$1$2$3", $string); - - $string = preg_replace("|@([a-zA-Z0-9_]+)|i", "@$1", $string); - $string = preg_replace("|((https?://)+([\d\w\.-]+\.[\w\.]{2,6})[^\s\]\[\<\>]*/?)|i", "$3", $string); - - $string = nl2br($string); - - return $string; - } } \ No newline at end of file