Skip to content

Commit

Permalink
Release 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Jan 8, 2024
1 parent 9077f70 commit 4bca07f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Changelog
=========

1.1.2 (January 6, 2024)
1.1.3 (January 8, 2024)
----------------------
- Fix: Missing Twig SecurityPolicy rule

- 1.1.2 (January 6, 2024)
----------------------
- Enh: Added Twig SecurityPolicy

Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Virtual Card Popover",
"description": "Shows a virtual business card displaying brief information about the user when hovering over a user's profile picture or name",
"keywords": ["business card, popover, hover, profile information"],
"version": "1.1.2",
"version": "1.1.3",
"humhub": {
"minVersion": "1.12"
},
Expand Down
2 changes: 1 addition & 1 deletion widgets/VCardSpace.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function run()
$memberCount = Membership::getSpaceMembersQuery($this->space)->count();

$twig = new Environment(new ArrayLoader());
$twig->addExtension(new SandboxExtension(new SecurityPolicy(['if', 'for'], ['escape']), true));
$twig->addExtension(new SandboxExtension(new SecurityPolicy(['if', 'for'], ['escape', 'e']), true));

$templateParams = ['space' => $this->space, 'memberCount' => $memberCount];

Expand Down
5 changes: 3 additions & 2 deletions widgets/VCardUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use humhub\components\Widget;
use humhub\modules\popovervcard\Module;
use humhub\modules\user\models\Profile;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
Expand All @@ -33,14 +34,14 @@ public function run()
$module = Yii::$app->getModule('popover-vcard');

$twig = new Environment(new ArrayLoader());
$twig->addExtension(new SandboxExtension(new SecurityPolicy(['if', 'for'], ['escape']), true));
$twig->addExtension(new SandboxExtension(new SecurityPolicy(['if', 'for'], ['escape', 'e'], [Profile::class => 'about']), true));

$templateParams = ['user' => $this->user, 'profile' => $this->user->profile];

try {
$description = $twig->createTemplate($module->getConfiguration()->userContent)
->render($templateParams);
} catch (LoaderError | RuntimeError | SyntaxError $e) {
} catch (LoaderError|RuntimeError|SyntaxError $e) {
$description = $e->getMessage();
}

Expand Down

0 comments on commit 4bca07f

Please sign in to comment.