Skip to content

Commit

Permalink
Output cleanup (concretecms#11988)
Browse files Browse the repository at this point in the history
* Cleanup output

- presets
- file block output
- style customizer

* Output cleanup in colors
  • Loading branch information
KorvinSzanto authored Mar 27, 2024
1 parent e993ce0 commit 822e689
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion concrete/blocks/file/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
?>
<div class="ccm-block-file">
<a href="<?php echo (!empty($forceDownload)) ? $f->getForceDownloadURL() : $f->getDownloadURL(); ?>">
<?php echo stripslashes($controller->getLinkText()) ?>
<?php echo h(stripslashes($controller->getLinkText())) ?>
</a>
</div>
<?php
Expand Down
2 changes: 1 addition & 1 deletion concrete/controllers/dialog/express/preset/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function remove_search_preset()
}
if (!$this->error->has()) {
$response = new EditResponse();
$response->setMessage(t('%s deleted successfully.', $searchPreset->getPresetName()));
$response->setMessage(t('%s deleted successfully.', h($searchPreset->getPresetName())));
$response->setAdditionalDataAttribute('presetID', $presetID);
$em = $this->app->make(\Doctrine\ORM\EntityManager::class);
$em->remove($searchPreset);
Expand Down
2 changes: 1 addition & 1 deletion concrete/controllers/dialog/file/preset/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function remove_search_preset()
}
if (!$this->error->has()) {
$response = new EditResponse();
$response->setMessage(t('%s deleted successfully.', $searchPreset->getPresetName()));
$response->setMessage(t('%s deleted successfully.', h($searchPreset->getPresetName())));
$response->setAdditionalDataAttribute('presetID', $presetID);
$node = TreeNodeSearchPreset::getNodeBySavedSearchID($presetID);
if (is_object($node)) {
Expand Down
2 changes: 1 addition & 1 deletion concrete/controllers/dialog/search/preset/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function remove_search_preset()
}
if (!$this->error->has()) {
$response = new EditResponse();
$response->setMessage(t('%s deleted successfully.', $searchPreset->getPresetName()));
$response->setMessage(t('%s deleted successfully.', h($searchPreset->getPresetName())));
$response->setAdditionalDataAttribute('presetID', $presetID);
$em = $this->app->make(EntityManager::class);
$em->remove($searchPreset);
Expand Down
2 changes: 1 addition & 1 deletion concrete/controllers/dialog/search/preset/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function edit_search_preset()
}
if (!$this->error->has()) {
$response = new EditResponse();
$response->setMessage(t('%s edited successfully.', $newPresetName));
$response->setMessage(t('%s edited successfully.', h($newPresetName)));
$response->setAdditionalDataAttribute('presetID', $presetID);
$response->setAdditionalDataAttribute('actionURL', (string) $this->getSavedSearchBaseURL($searchPreset));
$searchPreset->setPresetName($newPresetName);
Expand Down
10 changes: 5 additions & 5 deletions concrete/single_pages/dashboard/system/calendar/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<legend><?=t('Default Colors')?></legend>
<div class="form-group">
<?=$form->label('defaultBackgroundColor', t('Background'))?>
<?=$color->output('defaultBackgroundColor', $defaultBackgroundColor)?>
<?=$color->output('defaultBackgroundColor', h($defaultBackgroundColor))?>
</div>
<div class="form-group">
<?=$form->label('defaultTextColor', t('Text'))?>
<?=$color->output('defaultTextColor', $defaultTextColor)?>
<?=$color->output('defaultTextColor', h($defaultTextColor))?>
</div>
</fieldset>

Expand Down Expand Up @@ -45,10 +45,10 @@
<tr>
<td style="text-align: center; width: 10px"><?=$form->checkbox('override[]', $topic->getTreeNodeID(), $checked)?></td>
<td style="width: 50%"><?=$topic->getTreeNodeDisplayName()?></td>
<td><?=$color->output('backgroundColor[' . $topic->getTreeNodeID() . ']', $backgroundColor)?></td>
<td><?=$color->output('textColor[' . $topic->getTreeNodeID() . ']', $textColor)?></td>
<td><?=$color->output('backgroundColor[' . $topic->getTreeNodeID() . ']', h($backgroundColor))?></td>
<td><?=$color->output('textColor[' . $topic->getTreeNodeID() . ']', h($textColor))?></td>
</tr>
<?php
<?php
}
?>
</table>
Expand Down
10 changes: 8 additions & 2 deletions concrete/src/StyleCustomizer/Inline/StyleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,14 @@ public static function populateFromRequest(Request $request)

$v = $post->get('customClass');
if (is_array($v)) {
$set->setCustomClass(implode(' ', $v));
$return = true;
$v = array_filter($v, function ($class) {
return preg_match('/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/', $class);
});

if (count($v) > 0) {
$set->setCustomClass(implode(' ', $v));
$return = true;
}
}

$v = trim($post->get('customID', ''));
Expand Down
2 changes: 1 addition & 1 deletion concrete/views/dialogs/search/preset/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<form method="post" data-dialog-form="remove-search-preset" class="form-horizontal" action="<?= $controller->getDeleteSearchPresetAction(); ?>">
<?= $token->output('remove_search_preset'); ?>
<?= $form->hidden('presetID', $searchPreset->getId()); ?>
<p><?= t('Are you sure you want to remove the "%s" search preset?', $searchPreset->getPresetName()); ?></p>
<p><?= t('Are you sure you want to remove the "%s" search preset?', h($searchPreset->getPresetName())); ?></p>

<div class="dialog-buttons clearfix">
<button class="btn btn-secondary" data-dialog-action="cancel"><?= t('Cancel'); ?></button>
Expand Down
2 changes: 1 addition & 1 deletion concrete/views/dialogs/search/preset/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<?= $form->hidden('presetID', $searchPreset->getId()); ?>
<div class="form-group">
<?= $form->label('presetName', t('Name')); ?>
<?= $form->text('presetName', $searchPreset->getPresetName()); ?>
<?= $form->text('presetName', h($searchPreset->getPresetName())); ?>
</div>

<div class="dialog-buttons clearfix">
Expand Down

0 comments on commit 822e689

Please sign in to comment.