aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorHilmar R <u02@u29lx193>2021-02-28 21:06:16 +0100
committerHilmar R <u02@u29lx193>2021-03-01 18:48:11 +0100
commitc26dede97f626b52b7bf8962ed55d1dbda86abe8 (patch)
tree3c8c9bc97aa09f7ce9afe9bf467cf87bbf2c7d0b /include/text.php
parentea3390d626f85b7293a750958bfd1b5460958365 (diff)
downloadvolse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.gz
volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.bz2
volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.zip
get dev
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/text.php b/include/text.php
index 96e5c7882..df066a05d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -7,8 +7,9 @@ use Zotlabs\Lib as Zlib;
use Michelf\MarkdownExtra;
use Ramsey\Uuid\Uuid;
-use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
+use Ramsey\Uuid\Exception\UnableToBuildUuidException;
+use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\SvgSanitizer;
require_once("include/bbcode.php");
@@ -2848,7 +2849,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
// replace tag by the link. Make sure to not replace something in the middle of a word
- $body = preg_replace('/(?<![a-zA-Z0-9=])'.preg_quote($tag,'/').'/', $newtag, $body);
+ $body = preg_replace('/(?<![a-zA-Z0-9=\/])'.preg_quote($tag,'/').'/', $newtag, $body);
$replaced = true;
}
@@ -3260,7 +3261,7 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
$item['body'] = preg_replace("/(\[zrl=".preg_quote($old,'/')."\/(photo|photos|gallery)\/".$channel['channel_address'].".+\]\[zmg=\d+x\d+\])".preg_quote($old,'/')."\/(.+\[\/zmg\])/", '${1}'.$new.'/${3}', $item['body']);
$item['body'] = preg_replace("/".preg_quote($old,'/')."\/(search|\w+\/".$channel['channel_address'].")/", $new.'/${1}', $item['body']);
- $item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey']));
+ $item['sig'] = base64url_encode(Crypto::sign($item['body'],$channel['channel_prvkey']));
$item['item_verified'] = 1;
$item['plink'] = str_replace($old,$new,$item['plink']);
@@ -3836,7 +3837,7 @@ function new_uuid() {
try {
$hash = Uuid::uuid4()->toString();
- } catch (UnsatisfiedDependencyException $e) {
+ } catch (UnableToBuildUuidException $e) {
$hash = random_string(48);
}
@@ -3854,7 +3855,7 @@ function uuid_from_url($url) {
try {
$hash = Uuid::uuid5(Uuid::NAMESPACE_URL, $url)->toString();
- } catch (UnsatisfiedDependencyException $e) {
+ } catch (UnableToBuildUuidException $e) {
$hash = md5($url);
}
return $hash;
@@ -3893,6 +3894,14 @@ function unserialise($x) {
return ((is_array($y)) ? $y : $x);
}
+function obscurify($s) {
+ return str_rot47(base64url_encode($s));
+}
+
+function unobscurify($s) {
+ return base64url_decode(str_rot47($s));
+}
+
/**
* @brief Remove new lines and tabs from strings.
*