Simplify htmlescape

This commit is contained in:
Dennis Eichhorn 2017-09-14 20:39:58 +02:00
parent 228774d176
commit faacf6911e
2 changed files with 23 additions and 23 deletions

View File

@ -40,11 +40,11 @@ echo $this->getData('nav')->render(); ?>
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::CANCELED) { $color = 'red'; }
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><span class="tag <?= htmlspecialchars($color, ENT_COMPAT, 'utf-8'); ?>"><?= $this->getHtml('S' . $ticket->getTask()->getStatus(), 'Tasks') ?></span></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getDue()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getTitle(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getCreatedBy()->getName1(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getCreatedAt()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('S' . $ticket->getTask()->getStatus(), 'Tasks') ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->getTask()->getDue()->format('Y-m-d H:i')); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->getTask()->getTitle()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->getTask()->getCreatedBy()->getName1()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->getTask()->getCreatedAt()->format('Y-m-d H:i')); ?></a>
<?php endforeach; if($c == 0) : ?>
<tr><td colspan="6" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?>

View File

@ -29,19 +29,19 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<header><h1><?= htmlspecialchars($ticket->getTask()->getTitle(), ENT_COMPAT, 'utf-8'); ?></h1></header>
<header><h1><?= $this->printHtml($ticket->getTask()->getTitle()); ?></h1></header>
<div class="inner">
<div class="floatRight">Due <?= htmlspecialchars($ticket->getTask()->getDue()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></div>
<div>Created <?= htmlspecialchars($ticket->getTask()->getCreatedAt()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></div>
<div class="floatRight">Due <?= $this->printHtml($ticket->getTask()->getDue()->format('Y-m-d H:i')); ?></div>
<div>Created <?= $this->printHtml($ticket->getTask()->getCreatedAt()->format('Y-m-d H:i')); ?></div>
</div>
<div class="inner">
<blockquote>
<?= htmlspecialchars($ticket->getTask()->getDescription(), ENT_COMPAT, 'utf-8'); ?>
<?= $this->printHtml($ticket->getTask()->getDescription()); ?>
</blockquote>
</div>
<div class="inner">
<div class="pAlignTable">
<div class="vCenterTable wf-100">Created <?= htmlspecialchars($ticket->getTask()->getCreatedBy()->getName1(), ENT_COMPAT, 'utf-8'); ?></div>
<div class="vCenterTable wf-100">Created <?= $this->printHtml($ticket->getTask()->getCreatedBy()->getName1()); ?></div>
<span class="vCenterTable nobreak tag"><?= $this->getHtml('S' . $ticket->getTask()->getStatus()) ?></span>
</div>
</div>
@ -56,27 +56,27 @@ echo $this->getData('nav')->render(); ?>
elseif($element->getStatus() === \Modules\Tasks\Models\TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
<section class="box wf-100">
<div class="inner pAlignTable">
<div class="vCenterTable wf-100"><?= htmlspecialchars($element->getCreatedBy()->getName1(), ENT_COMPAT, 'utf-8'); ?> - <?= htmlspecialchars($element->getCreatedAt()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></div>
<span class="vCenterTable tag <?= htmlspecialchars($color, ENT_COMPAT, 'utf-8'); ?>"><?= $this->getHtml('S' . $element->getStatus()) ?></span>
<div class="vCenterTable wf-100"><?= $this->printHtml($element->getCreatedBy()->getName1()); ?> - <?= $this->printHtml($element->getCreatedAt()->format('Y-m-d H:i')); ?></div>
<span class="vCenterTable tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('S' . $element->getStatus()) ?></span>
</div>
<?php if ($element->getDescription() !== '') : ?>
<div class="inner">
<blockquote>
<?= htmlspecialchars($element->getDescription(), ENT_COMPAT, 'utf-8'); ?>
<?= $this->printHtml($element->getDescription()); ?>
</blockquote>
</div>
<?php endif; ?>
<div class="inner pAlignTable">
<?php if ($element->getForwarded() !== 0) : ?>
<div class="vCenterTable wf-100">Forwarded <?= htmlspecialchars($element->getForwarded()->getName1(), ENT_COMPAT, 'utf-8'); ?></div>
<div class="vCenterTable wf-100">Forwarded <?= $this->printHtml($element->getForwarded()->getName1()); ?></div>
<?php endif; ?>
<?php if ($element->getStatus() !== \Modules\Tasks\Models\TaskStatus::CANCELED ||
$element->getStatus() !== \Modules\Tasks\Models\TaskStatus::DONE ||
$element->getStatus() !== \Modules\Tasks\Models\TaskStatus::SUSPENDED || $c != $cElements
) : ?>
<div class="vCenterTable nobreak">Due <?= htmlspecialchars($element->getDue()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></div>
<div class="vCenterTable nobreak">Due <?= $this->printHtml($element->getDue()->format('Y-m-d H:i')); ?></div>
<?php endif; ?>
</section>
<?php endforeach; ?>
@ -88,22 +88,22 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label>
<tr><td><textarea id="iMessage" name="description"></textarea>
<tr><td><label for="iDue"><?= $this->getHtml('Due') ?></label>
<tr><td><input type="datetime-local" id="iDue" name="due" value="<?= htmlspecialchars(!empty($elements) ? end($elements)->getDue()->format('Y-m-d\TH:i:s') : $ticket->getTask()->getDue()->format('Y-m-d\TH:i:s'), ENT_COMPAT, 'utf-8'); ?>">
<tr><td><input type="datetime-local" id="iDue" name="due" value="<?= $this->printHtml(!empty($elements) ? end($elements)->getDue()->format('Y-m-d\TH:i:s') : $ticket->getTask()->getDue()->format('Y-m-d\TH:i:s')); ?>">
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
<tr><td><select id="iStatus" name="status">
<option value="<?= htmlspecialchars(\Modules\Tasks\Models\TaskStatus::OPEN, ENT_COMPAT, 'utf-8'); ?>" selected>Open
<option value="<?= htmlspecialchars(\Modules\Tasks\Models\TaskStatus::WORKING, ENT_COMPAT, 'utf-8'); ?>">Working
<option value="<?= htmlspecialchars(\Modules\Tasks\Models\TaskStatus::SUSPENDED, ENT_COMPAT, 'utf-8'); ?>">Suspended
<option value="<?= htmlspecialchars(\Modules\Tasks\Models\TaskStatus::CANCELED, ENT_COMPAT, 'utf-8'); ?>">Canceled
<option value="<?= htmlspecialchars(\Modules\Tasks\Models\TaskStatus::DONE, ENT_COMPAT, 'utf-8'); ?>">Done
<option value="<?= $this->printHtml(\Modules\Tasks\Models\TaskStatus::OPEN); ?>" selected>Open
<option value="<?= $this->printHtml(\Modules\Tasks\Models\TaskStatus::WORKING); ?>">Working
<option value="<?= $this->printHtml(\Modules\Tasks\Models\TaskStatus::SUSPENDED); ?>">Suspended
<option value="<?= $this->printHtml(\Modules\Tasks\Models\TaskStatus::CANCELED); ?>">Canceled
<option value="<?= $this->printHtml(\Modules\Tasks\Models\TaskStatus::DONE); ?>">Done
</select>
<tr><td><label for="iReceiver"><?= $this->getHtml('To') ?></label>
<tr><td><input type="text" id="iReceiver" name="forward" value="<?= htmlspecialchars($this->request->getHeader()->getAccount(), ENT_COMPAT, 'utf-8'); ?>" placeholder="&#xf007; Guest">
<tr><td><input type="text" id="iReceiver" name="forward" value="<?= $this->printHtml($this->request->getHeader()->getAccount()); ?>" placeholder="&#xf007; Guest">
<tr><td colspan="2"><label for="iMedia"><?= $this->getHtml('Media') ?></label>
<tr><td><input type="text" id="iMedia" placeholder="&#xf15b; File"><td><button><?= $this->getHtml('Select') ?></button>
<tr><td colspan="2"><label for="iUpload"><?= $this->getHtml('Upload') ?></label>
<tr><td><input type="file" id="iUpload" form="fTask"><input form="fTask" type="hidden" name="type"><td>
<tr><td><input type="submit" value="<?= $this->getHtml('Create', 0, 0); ?>"><input type="hidden" name="task" value="<?= htmlspecialchars($this->request->getData('id')); ?>"><input type="hidden" name="type" value="1">
<tr><td><input type="submit" value="<?= $this->getHtml('Create', 0, 0); ?>"><input type="hidden" name="task" value="<?= $this->printHtml($this->request->getData('id')); ?>"><input type="hidden" name="type" value="1">
</table>
</form>
</div>