Popraw walidację zewnętrznych linków aplikacyjnych oraz dodaj .serena do .gitignore

Dodaj automatyczne uzupełnianie https:// dla linków bez protokołu w aplication_link,
aby adresy typu www.example.pl były traktowane jako zewnętrzne.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 23:05:55 +01:00
parent f7dcc61c83
commit ae0681a016
3 changed files with 16 additions and 5 deletions

View File

@@ -1,4 +1,11 @@
<? global $lang; ?>
<? global $lang;
$fixUrl = function($url) {
if ($url !== '' && !preg_match('#^https?://#i', $url)) {
return 'https://' . $url;
}
return $url;
};
?>
<div class="row">
<div class="col-12 col-lg-9" style="padding: 0 5px;">
<div class="advert-details">
@@ -224,11 +231,11 @@
<? endif;?>
</div>
<? endif; ?>
<a href="<?= $this->advert['aplication_link'] != '' ? $this->advert['aplication_link'] : '/aplikuj/' . $this -> advert['id'];?>" class="aplication-link btn btn-red mt15 btn_aplikuj">Aplikuj teraz</a>
<a href="<?= $this->advert['aplication_link'] != '' ? $fixUrl($this->advert['aplication_link']) : '/aplikuj/' . $this -> advert['id'];?>" class="aplication-link btn btn-red mt15 btn_aplikuj" <?= $this->advert['aplication_link'] ? 'target="_blank"' : '';?>>Aplikuj teraz</a>
</div>
</div>
<div class="col-12 col-lg-3" style="padding: 0 5px;">
<a href="<?= $this->advert['aplication_link'] != '' ? $this->advert['aplication_link'] : '/aplikuj/' . $this -> advert['id'];?>" class="btn btn-red btn_aplikuj" <?= $this -> advert['aplication_link'] ? 'target="_blank"' : '';?>>Aplikuj</a>
<a href="<?= $this->advert['aplication_link'] != '' ? $fixUrl($this->advert['aplication_link']) : '/aplikuj/' . $this -> advert['id'];?>" class="btn btn-red btn_aplikuj" <?= $this->advert['aplication_link'] ? 'target="_blank"' : '';?>>Aplikuj</a>
<div class="row advert_details_boxes">
<div class="col-12">
<div class="mini-box mt10 text-center">
@@ -301,7 +308,7 @@
</div>
<div class="_bottom">
<!-- button aplikuj -->
<a href="<?= $advert['aplication_link'] != '' ? $advert['aplication_link'] : '/aplikuj/' . $advert['id'];?>">Aplikuj szybko</a>
<a href="<?= $advert['aplication_link'] != '' ? $fixUrl($advert['aplication_link']) : '/aplikuj/' . $advert['id'];?>">Aplikuj szybko</a>
</div>
</li>
<? endforeach; ?>