@@ -647,10 +647,11 @@ function setPostKey()
647647
648648 $ cdata ['comname ' ] = $ commentres ->fields ['comname ' ];
649649 $ cdata ['added ' ] = Config::time ($ commentres ->fields ['added ' ]);
650- $ cdata [ ' commenttxt ' ] = htmlspecialchars ($ commentres ->fields ['commenttxt ' ]);
651- $ cdata [ ' commenttxt ' ] = str_replace ( "\n" , " <br /> " , $ cdata [ ' commenttxt ' ] );
650+ $ commentText = html_entity_decode ($ commentres ->fields ['commenttxt ' ], ENT_QUOTES | ENT_HTML5 , ' UTF-8 ' );
651+ $ commentText = encodePreservingBr ( $ commentText );
652652 // Parse links and wrap them in a <a href=""></a> tag to be easily clickable
653- $ cdata ['commenttxt ' ] = preg_replace ('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@ ' , '<a href="$1" target="_blank">$1</a> ' , $ cdata ['commenttxt ' ]);
653+ $ commentText = preg_replace ('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@ ' , '<a href="\$1" target="_blank">\$1</a> ' , $ commentText );
654+ $ cdata ['commenttxt ' ] = $ commentText ;
654655
655656 if (!empty ($ commentres ->fields ['edittime ' ])) {
656657 $ cdata ['edittime ' ] = Config::time ($ commentres ->fields ['edittime ' ]);
@@ -742,7 +743,8 @@ function setPostKey()
742743 if (isset ($ _GET ["cid " ])) {
743744 $ _GET ["cid " ] = (int ) $ _GET ["cid " ];
744745 $ ceditdata = $ GLOBALS ['db ' ]->GetRow ("SELECT * FROM " . DB_PREFIX . "_comments WHERE cid = ' " . $ _GET ["cid " ] . "' " );
745- $ ctext = htmlspecialchars ($ ceditdata ['commenttxt ' ]);
746+ $ ctext = html_entity_decode ($ ceditdata ['commenttxt ' ], ENT_QUOTES | ENT_HTML5 , 'UTF-8 ' );
747+ $ ctext = htmlspecialchars ($ ctext , ENT_QUOTES | ENT_HTML5 , 'UTF-8 ' );
746748 $ cotherdataedit = " AND cid != ' " . $ _GET ["cid " ] . "' " ;
747749 } else {
748750 $ cotherdataedit = "" ;
@@ -765,10 +767,12 @@ function setPostKey()
765767 $ coment = [];
766768 $ coment ['comname ' ] = $ cotherdata ->fields ['comname ' ];
767769 $ coment ['added ' ] = Config::time ($ cotherdata ->fields ['added ' ]);
768- $ coment [ ' commenttxt ' ] = htmlspecialchars ($ cotherdata ->fields ['commenttxt ' ]);
769- $ coment [ ' commenttxt ' ] = str_replace ( "\n" , " <br /> " , $ coment [ ' commenttxt ' ] );
770+ $ commentText = html_entity_decode ($ cotherdata ->fields ['commenttxt ' ], ENT_QUOTES | ENT_HTML5 , ' UTF-8 ' );
771+ $ commentText = encodePreservingBr ( $ commentText );
770772 // Parse links and wrap them in a <a href=""></a> tag to be easily clickable
771- $ coment ['commenttxt ' ] = preg_replace ('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@ ' , '<a href="$1" target="_blank">$1</a> ' , $ coment ['commenttxt ' ]);
773+ $ commentText = preg_replace ('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@ ' , '<a href="\$1" target="_blank">\$1</a> ' , $ commentText );
774+ $ coment ['commenttxt ' ] = $ commentText ;
775+
772776 if ($ cotherdata ->fields ['editname ' ] != "" ) {
773777 $ coment ['edittime ' ] = Config::time ($ cotherdata ->fields ['edittime ' ]);
774778 $ coment ['editname ' ] = $ cotherdata ->fields ['editname ' ];
@@ -812,4 +816,4 @@ function setPostKey()
812816$ theme ->assign ('can_delete ' , $ userbank ->HasAccess (ADMIN_DELETE_BAN ));
813817$ theme ->assign ('view_bans ' , ($ userbank ->HasAccess (ADMIN_OWNER | ADMIN_EDIT_ALL_BANS | ADMIN_EDIT_OWN_BANS | ADMIN_EDIT_GROUP_BANS | ADMIN_UNBAN | ADMIN_UNBAN_OWN_BANS | ADMIN_UNBAN_GROUP_BANS | ADMIN_DELETE_BAN )));
814818$ theme ->assign ('can_export ' , ($ userbank ->HasAccess (ADMIN_OWNER ) || Config::getBool ('config.exportpublic ' )));
815- $ theme ->display ('page_bans.tpl ' );
819+ $ theme ->display ('page_bans.tpl ' );
0 commit comments