[9.2.13] Restaurer le module redirection dans la version 1.3 et le core
This commit is contained in:
parent
78722d949a
commit
dcde62917b
@ -1393,15 +1393,9 @@ class core extends common {
|
|||||||
}
|
}
|
||||||
// Redirection
|
// Redirection
|
||||||
if($output['redirect']) {
|
if($output['redirect']) {
|
||||||
if (!empty($output['script']) ) {
|
http_response_code(301);
|
||||||
$this->addOutput ([
|
header('Location:' . $output['redirect']);
|
||||||
'script' => $output['script']
|
exit();
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
http_response_code(301);
|
|
||||||
header('Location:' . $output['redirect']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Données en sortie applicables même lorsqu'une notice est présente
|
// Données en sortie applicables même lorsqu'une notice est présente
|
||||||
|
@ -18,14 +18,8 @@ class redirection extends common {
|
|||||||
'config' => self::GROUP_MODERATOR,
|
'config' => self::GROUP_MODERATOR,
|
||||||
'index' => self::GROUP_VISITOR
|
'index' => self::GROUP_VISITOR
|
||||||
];
|
];
|
||||||
public static $openIn = [
|
|
||||||
'tab' => 'Un nouvel onglet',
|
|
||||||
'lity' => 'Une popup intégrée',
|
|
||||||
'popup' => 'Une popup',
|
|
||||||
'window' => 'La fenêtre'
|
|
||||||
];
|
|
||||||
|
|
||||||
const REDIRECTION_VERSION = '1.4';
|
const REDIRECTION_VERSION = '1.3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
@ -33,10 +27,7 @@ class redirection extends common {
|
|||||||
public function config() {
|
public function config() {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
$this->setData(['module', $this->getUrl(0), [
|
$this->setData(['module', $this->getUrl(0), 'url', $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true)]);
|
||||||
'url' => $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true),
|
|
||||||
'target' => $this->getInput('redirectionConfigTarget'),
|
|
||||||
]]);
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||||
@ -72,33 +63,9 @@ class redirection extends common {
|
|||||||
else {
|
else {
|
||||||
// Incrémente le compteur de clics
|
// Incrémente le compteur de clics
|
||||||
$this->setData(['module', $this->getUrl(0), 'count', helper::filter($this->getData(['module', $this->getUrl(0), 'count']) + 1, helper::FILTER_INT)]);
|
$this->setData(['module', $this->getUrl(0), 'count', helper::filter($this->getData(['module', $this->getUrl(0), 'count']) + 1, helper::FILTER_INT)]);
|
||||||
|
|
||||||
switch ($this->getData(['module', $this->getUrl(0), 'target'])) {
|
|
||||||
case 'tab':
|
|
||||||
$script = ' window.history.back();
|
|
||||||
window.open("' . $this->getData(['module',$this->getUrl(0), 'url']) . '", "_blank");';
|
|
||||||
break;
|
|
||||||
case 'lity':
|
|
||||||
$script = '$(document).on("lity:close", function(event, instance) {
|
|
||||||
location.replace("' . helper::baseURl() . '");
|
|
||||||
});
|
|
||||||
// Open a URL in a lightbox
|
|
||||||
var lightbox = lity("'. $this->getData(['module',$this->getUrl(0), 'url']) .'");
|
|
||||||
|
|
||||||
// Bind as an event handler
|
|
||||||
$(document).on("click", "[data-lightbox]", lity);';
|
|
||||||
break;
|
|
||||||
case "popup":
|
|
||||||
$script = ' window.history.back();
|
|
||||||
window.open("' . $this->getData(['module',$this->getUrl(0), 'url']) . '", "_blank", "toolbar=0,location=0,menubar=0");';
|
|
||||||
break;
|
|
||||||
case 'window':
|
|
||||||
$script = '';
|
|
||||||
}
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => $this->getData(['module', $this->getUrl(0), 'url']),
|
'redirect' => $this->getData(['module', $this->getUrl(0), 'url']),
|
||||||
'script' => $script,
|
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
'placeholder' => 'http://',
|
'placeholder' => 'http://',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'url'])
|
'value' => $this->getData(['module', $this->getUrl(0), 'url'])
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::select('redirectionConfigTarget', $module::$openIn,[
|
|
||||||
'label' => 'Ouvrir dans',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'target'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user