diff --git a/hwe/join_post.php b/hwe/join_post.php index 9d6068d3..59957e4d 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -44,7 +44,7 @@ $session = Session::requireLogin()->setReadOnly(); //NOTE: 이 페이지에서는 세션에 데이터를 등록하지 않음. 로그인은 이후에. $name = $_POST['name']; -$name = StringUtil::NoSpecialCharacter($name); +$name = StringUtil::removeSpecialCharacter($name); $pic = (int)Util::array_get($_POST['pic'], 0); $character = (int)Util::array_get($_POST['character'], 0); diff --git a/src/sammo/Json.php b/src/sammo/Json.php index e2f109fc..3c0d7d92 100644 --- a/src/sammo/Json.php +++ b/src/sammo/Json.php @@ -17,10 +17,6 @@ class Json{ return json_encode($value, $rawFlag); } - public static function encodePack($value, $pretty = false){ - - } - public static function decode($value){ return json_decode($value, true); } diff --git a/src/sammo/StringUtil.php b/src/sammo/StringUtil.php index 6f8e3d39..011a1d26 100644 --- a/src/sammo/StringUtil.php +++ b/src/sammo/StringUtil.php @@ -212,52 +212,19 @@ class StringUtil { public static function EscapeTag($str) { $str = htmlspecialchars($str); - $str = str_replace("\r\n", "
", $str); - $str = str_replace("\n", "
", $str); + $str = str_replace(["\r\n", "\r", "\n"], '
', $str); // return nl2br(htmlspecialchars($str)); // return htmlspecialchars($str); return $str; } - public static function NoSpecialCharacter($str) { - $str = str_replace(" ", "", $str); - $str = str_replace("\"", "", $str); - $str = str_replace("'", "", $str); - $str = str_replace("ⓝ", "", $str); - $str = str_replace("ⓜ", "", $str); - $str = str_replace("ⓖ", "", $str); - $str = str_replace("\\", "", $str); - $str = str_replace("/", "", $str); - $str = str_replace("`", "", $str); - $str = str_replace("-", "", $str); - $str = str_replace("=", "", $str); - $str = str_replace("[", "", $str); - $str = str_replace("]", "", $str); - $str = str_replace(";", "", $str); - $str = str_replace(",", "", $str); - $str = str_replace(".", "", $str); - $str = str_replace("~", "", $str); - $str = str_replace("!", "", $str); - $str = str_replace("@", "", $str); - $str = str_replace("#", "", $str); - $str = str_replace("$", "", $str); - $str = str_replace("%", "", $str); - $str = str_replace("^", "", $str); - $str = str_replace("&", "", $str); - $str = str_replace("*", "", $str); - $str = str_replace("(", "", $str); - $str = str_replace(")", "", $str); - $str = str_replace("_", "", $str); - $str = str_replace("+", "", $str); - $str = str_replace("|", "", $str); - $str = str_replace("{", "", $str); - $str = str_replace("}", "", $str); - $str = str_replace(":", "", $str); - $str = str_replace("", "", $str); - $str = str_replace("<", "", $str); - $str = str_replace(">", "", $str); - $str = str_replace("?", "", $str); - $str = str_replace(" ", "", $str); - return $str; + public static function removeSpecialCharacter($str) { + return str_replace([ + ' ', '"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', '\\', '/', '`', + '-', '=', '[', ']', ';', ',', '.', '~', '!', '@', + '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', + '|', '{', '}', ':', '', '<', '>', '?', ' ' + ], '', $str); } + }