Ist das nicht etwas unsicher?
Hier wird ist im Prinzip möglich JEDE Datei herunterzuladen, wenn man die GET Parameter in der Browserleiste anpasst. Oder?
Ich würde im Template noch abfragen, ob "Input->get('file')" auch in dem Array der ausgegebenen Bilder befindet.
Also vielleicht so ungefähr:
PHP-Code:
<?php
// Erlaubte Dateien
$allowedFiles=array();
?>
<ul>
<?php foreach ($this->body as $class=>$row): ?>
<?php foreach ($row as $col): ?>
<?php $allowedFiles[]=$col->href; ?>
<?php if ($col->addImage): ?>
<li class="<?php echo $class; ?> <?php echo $col->class; ?>">
<figure class="image_container"<?php if ($col->margin): ?> style="<?php echo $col->margin; ?>"<?php endif; ?>>
<?php if ($col->href): ?>
<a href="{{env::path}}{{page::alias}}.html?file=<?php echo $col->href; ?>"<?php echo $col->attributes; ?> title="<?php echo $col->alt; ?>"><img src="<?php echo $col->src; ?>"<?php echo $col->imgSize; ?> alt="<?php echo $col->alt; ?>"></a>
<?php else: ?>
<img src="<?php echo $col->src; ?>"<?php echo $col->imgSize; ?> alt="<?php echo $col->alt; ?>">
<?php endif; ?>
<?php if ($col->caption): ?>
<figcaption class="caption" style="width:<?php echo $col->arrSize[0]; ?>px"><?php echo $col->caption; ?></figcaption>
<?php endif; ?>
</figure>
</li>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
<?php
// Send the file to the browser
// if allowed
if (strlen($this->Input->get('file', true))){
if(in_array($this->Input->get('file'),$allowedFiles)){
$this->sendFileToBrowser($this->Input->get('file', true));
}
}
?>
Zitat von
delirius
Ich habe im Template "gallery_default.html5" am Anfang noch folgender Code eingefügt:
Code:
<?php
// Send the file to the browser
if (strlen($this->Input->get('file', true)))
{
$this->sendFileToBrowser($this->Input->get('file', true));
}
?>
Lesezeichen