File size: 7,622 Bytes
27cd9bf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | diff --git a/concrete/controllers/backend/file.php b/concrete/controllers/backend/file.php
index 7f2b62b5dfd..94fa737c991 100644
--- a/concrete/controllers/backend/file.php
+++ b/concrete/controllers/backend/file.php
@@ -790,15 +790,15 @@ protected function checkRemoteURlsToImport(array $urls)
try {
$url = Url::createFromUrl($u);
} catch (RuntimeException $x) {
- throw new UserMessageException(t('The URL "%s" is not valid: %s', $u, $x->getMessage()));
+ throw new UserMessageException(h(t('The URL "%s" is not valid: %s', $u, $x->getMessage())));
}
$scheme = (string)$url->getScheme();
if ($scheme === '') {
- throw new UserMessageException(t('The URL "%s" is not valid.', $u));
+ throw new UserMessageException(h(t('The URL "%s" is not valid.', $u)));
}
$host = trim((string)$url->getHost());
if (in_array(strtolower($host), ['', '0', 'localhost'], true)) {
- throw new UserMessageException(t('The URL "%s" is not valid.', $u));
+ throw new UserMessageException(h(t('The URL "%s" is not valid.', $u)));
}
// If we've already validated this hostname just skip it.
@@ -813,7 +813,7 @@ protected function checkRemoteURlsToImport(array $urls)
foreach ($ipFormatBlocks as $block) {
if (preg_match($block, $host) !== 0) {
- throw new UserMessageException(t('The URL "%s" is not valid.', $u));
+ throw new UserMessageException(h(t('The URL "%s" is not valid.', $u)));
}
}
@@ -828,7 +828,7 @@ protected function checkRemoteURlsToImport(array $urls)
}
if ($ip !== null && $ip->getRangeType() !== IPRangeType::T_PUBLIC) {
- throw new UserMessageException(t('The URL "%s" is not valid.', $u));
+ throw new UserMessageException(h(t('The URL "%s" is not valid.', $u)));
}
$validIps[$host] = $ip->toString();
diff --git a/concrete/elements/groups/roles_list.php b/concrete/elements/groups/roles_list.php
index 7b10e8b78d0..051f2eccd62 100644
--- a/concrete/elements/groups/roles_list.php
+++ b/concrete/elements/groups/roles_list.php
@@ -81,7 +81,7 @@
<input type="hidden" name="roles[<%=id%>][id]" value="<%=id%>" />
<td>
- <input type="text" name="roles[<%=id%>][name]" value="<%=name%>" class="form-control ccm-role-name"
+ <input type="text" name="roles[<%=id%>][name]" value="<%-name%>" class="form-control ccm-role-name"
placeholder="<?php echo t("Please enter a role name..."); ?>"/>
</td>
@@ -162,13 +162,13 @@
var addRole = function (role) {
$rolesContainer.find("tbody").append(_.template($("#ccm-roles-row").html())(role));
- $rolesContainer.find("select[name=defaultRole]").append($("<option/>").attr("value", role.id).html(role.name));
+ $rolesContainer.find("select[name=defaultRole]").append($("<option/>").attr("value", role.id).text(role.name));
var $row = $("#ccm-row-" + role.id);
$row.find(".ccm-role-name").change(function () {
var $option = $rolesContainer.find("select[name=defaultRole] option[value=" + role.id + "]");
- $option.html($(this).val());
+ $option.text($(this).val());
});
$row.find(".ccm-remove-role").click(function () {
diff --git a/concrete/views/dialogs/file/properties.php b/concrete/views/dialogs/file/properties.php
index 3f9cb0dda4c..2fa326df24b 100644
--- a/concrete/views/dialogs/file/properties.php
+++ b/concrete/views/dialogs/file/properties.php
@@ -10,15 +10,15 @@
<legend><?= t('Basic Information'); ?></legend>
<div class="form-group">
<?= $form->label('title', t('Title')); ?>
- <?= $form->text('title', $file->getTitle()); ?>
+ <?= $form->text('title', h($file->getTitle())); ?>
</div>
<div class="form-group">
<?= $form->label('description', t('Description')); ?>
- <?= $form->textarea('description', $file->getDescription()); ?>
+ <?= $form->textarea('description', h($file->getDescription())); ?>
</div>
<div class="form-group">
<?= $form->label('tags', t('Tags')); ?>
- <?= $form->textarea('tags', $file->getTags()); ?>
+ <?= $form->textarea('tags', h($file->getTags())); ?>
</div>
</fieldset>
<fieldset>
diff --git a/tests/tests/Controller/Backend/FileTest.php b/tests/tests/Controller/Backend/FileTest.php
index f6c7b4bf4db..b863661d62e 100644
--- a/tests/tests/Controller/Backend/FileTest.php
+++ b/tests/tests/Controller/Backend/FileTest.php
@@ -52,12 +52,12 @@ public function remoteUrlsToTry(): iterable
$integer = '2130706433';
// Test hexadecimal IPs get caught as local
- yield ['https://' . $simpleIp, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['https://' . $hex, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['https://' . $octal, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['https://' . $octal2, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['https://' . $octal3, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['https://' . $integer, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $simpleIp, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $hex, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $octal, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $octal2, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $octal3, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['https://' . $integer, UserMessageException::class, '/The URL ".+?" is not valid./'];
// Remote IP
$simpleIp = '8.8.8.8';
@@ -69,11 +69,11 @@ public function remoteUrlsToTry(): iterable
// Test hexadecimal IPs get caught as local
yield ['http://' . $simpleIp]; // This is allowed because it's an external IP
- yield ['http://' . $hex, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['http://' . $hex, UserMessageException::class, '/The URL ".+?" is not valid./'];
yield ['http://' . $octal]; // This form is allowed because it at least converts properly in ip-lib
yield ['http://' . $octal2]; // Same as the first octal
- yield ['http://' . $octal3, UserMessageException::class, '/The URL ".+?" is not valid./'];
- yield ['http://' . $integer, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['http://' . $octal3, UserMessageException::class, '/The URL ".+?" is not valid./'];
+ yield ['http://' . $integer, UserMessageException::class, '/The URL ".+?" is not valid./'];
}
}
|