aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-08-22 22:14:29 +0200
committerMario Vavti <mario@mariovavti.com>2020-08-22 22:14:29 +0200
commit4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be (patch)
treeeb8d2ffd4840b2cfa50499ac522c3cd276eb8b04 /include
parent3b865d432ff24532b4a5e6917e23fc42b0d7fcaf (diff)
downloadvolse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.tar.gz
volse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.tar.bz2
volse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.zip
move cryptojs to addon
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 535e4ac33..e5b2a068a 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -233,7 +233,7 @@ function bb_replace_images($body, $images) {
*/
function bb_parse_crypt($match) {
- $matches = array();
+ $matches = [];
$attributes = $match[1];
$algorithm = "";
@@ -257,9 +257,17 @@ function bb_parse_crypt($match) {
$x = random_string();
- $f = ((in_array($algorithm, ['AES-128-CCM', 'rot13', 'triple-rot13'])) ? 'hz_decrypt' : 'red_decrypt');
+ $f = 'hz_decrypt';
+
+ //legacy cryptojs support
+ if(plugin_is_installed('cryptojs')) {
+ $f = ((in_array($algorithm, ['AES-128-CCM', 'rot13', 'triple-rot13'])) ? 'hz_decrypt' : 'red_decrypt');
+ }
+
+ $onclick = 'onclick="' . $f . '(\'' . $algorithm . '\',\'' . $hint . '\',\'' . $match[2] . '\',\'#' . $x . '\');"';
+ $label = t('Encrypted content');
- $Text = '<br /><div id="' . $x . '"><img class="cursor-pointer" src="' . z_root() . '/images/lock_icon.svg" onclick="' . $f . '(\'' . $algorithm . '\',\'' . $hint . '\',\'' . $match[2] . '\',\'#' . $x . '\');" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /></div><br />';
+ $Text = '<br /><div id="' . $x . '"><img class="cursor-pointer" src="' . z_root() . '/images/lock_icon.svg" ' . $onclick . ' alt="' . $label . '" title="' . $label . '" /></div><br />';
return $Text;
}