aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorHubzilla <hubzilla@hz.macgirvin.com>2017-01-19 15:37:30 -0800
committerHubzilla <hubzilla@hz.macgirvin.com>2017-01-19 15:37:30 -0800
commit96f196febda488e1db2d9a677fd5eb736aa76ae6 (patch)
tree8e97ca43e8f963b46effe4baee587ebd76892d6d /include/text.php
parent5ce96b9b95c6b3497bfb49fd086a23a2dedb4e2e (diff)
downloadvolse-hubzilla-96f196febda488e1db2d9a677fd5eb736aa76ae6.tar.gz
volse-hubzilla-96f196febda488e1db2d9a677fd5eb736aa76ae6.tar.bz2
volse-hubzilla-96f196febda488e1db2d9a677fd5eb736aa76ae6.zip
add gen_link_id() function to selectively encode/decode the message-id component of /display/ links for message-ids that contain troublesome characters
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index f5b1803c2..1beefc6eb 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3124,6 +3124,12 @@ function cleanup_bbcode($body) {
}
+function gen_link_id($mid) {
+ if(strpbrk($mid,':/&?<>"\'') !== false)
+ return 'b64.' . base64url_encode($mid);
+ return $mid;
+}
+
// callback for array_walk
function array_trim(&$v,$k) {
@@ -3132,4 +3138,5 @@ function array_trim(&$v,$k) {
function array_escape_tags(&$v,$k) {
$v = escape_tags($v);
-} \ No newline at end of file
+}
+