Browse Source

Test de redirection

pull/5/head
fredtempez 2 years ago
parent
commit
3e0525d2fe
  1. 17
      core/core.php
  2. 8
      module/redirection/redirection.php
  3. 4
      module/redirection/view/config/config.php

17
core/core.php

@ -1393,9 +1393,20 @@ class core extends common {
}
// Redirection
if($output['redirect']) {
http_response_code(301);
header('Location:' . $output['redirect']);
exit();
// Redirection Lity
if ($output['script'] === 'redirectdatality') {
$this->addOutput ([
'content' => '<a href="' . $output['redirect'] . '" class="displayNone" data-lity id="redirectdatality">Lien</a>',
'script' => '$(document).on("lity:close", function(event, instance) {
location.replace("' . helper::baseURl() . '");
});
document.getElementById("redirectdatality").click();'
]);
} else {
http_response_code(301);
header('Location:' . $output['redirect']);
exit();
}
}
}
// Données en sortie applicables même lorsqu'une notice est présente

8
module/redirection/redirection.php

@ -19,7 +19,7 @@ class redirection extends common {
'index' => self::GROUP_VISITOR
];
const REDIRECTION_VERSION = '1.3';
const REDIRECTION_VERSION = '1.4';
/**
* Configuration
@ -27,7 +27,10 @@ class redirection extends common {
public function config() {
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'url', $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true)]);
$this->setData(['module', $this->getUrl(0), [
'url' => $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true),
'openIn' => $this->getInput('redirectionConfigOpenIn', helper::FILTER_BOOLEAN)
]]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(),
@ -66,6 +69,7 @@ class redirection extends common {
// Valeurs en sortie
$this->addOutput([
'redirect' => $this->getData(['module', $this->getUrl(0), 'url']),
'script' => $this->getData(['module', $this->getUrl(0), 'openIn']) ? 'redirectdatality' : '',
'state' => true
]);
}

4
module/redirection/view/config/config.php

@ -21,6 +21,10 @@
'placeholder' => 'http://',
'value' => $this->getData(['module', $this->getUrl(0), 'url'])
]); ?>
<?php echo template::checkbox('redirectionConfigOpenIn', true , 'Ouvrir dans une popup intégrée', [
'checked' => $this->getData(['module', $this->getUrl(0), 'openIn'])
]);
?>
</div>
</div>
<div class="col6">

Loading…
Cancel
Save