forked from ZwiiCMS-Team/ZwiiCMS
Module External
Créer des pages constituées par des pages php externes
This commit is contained in:
parent
4dacf60277
commit
9ed51ecc5c
75
module/external/External.php
vendored
Normal file
75
module/external/External.php
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of Zwii.
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
|
* @license GNU General Public License, version 3
|
||||||
|
* @link http://zwiicms.com/
|
||||||
|
*
|
||||||
|
* @author Module Frédéric Tempez <ftempez@gmail.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class redirection extends common {
|
||||||
|
|
||||||
|
public static $actions = [
|
||||||
|
'config' => self::GROUP_MODERATOR,
|
||||||
|
'index' => self::GROUP_VISITOR
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration
|
||||||
|
*/
|
||||||
|
public function config() {
|
||||||
|
// Soumission du formulaire
|
||||||
|
if($this->isPost()) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'url', $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true)]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||||
|
'notification' => 'Modifications enregistrées',
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
}s
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'title' => 'Configuration du module',
|
||||||
|
'view' => 'config'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accueil
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
// Message si l'utilisateur peut éditer la page
|
||||||
|
if(
|
||||||
|
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||||
|
AND $this->getUser('group') >= self::GROUP_MODERATOR
|
||||||
|
AND $this->getUrl(1) !== 'force'
|
||||||
|
) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'display' => self::DISPLAY_LAYOUT_BLANK,
|
||||||
|
'title' => '',
|
||||||
|
'view' => 'index'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// Sinon redirection
|
||||||
|
else {
|
||||||
|
// 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)]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => $this->getData(['module', $this->getUrl(0), 'url']),
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
module/external/view/config/config.php
vendored
Normal file
37
module/external/view/config/config.php
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php echo template::formOpen('redirectionConfig'); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::button('redirectionConfigBack', [
|
||||||
|
'class' => 'buttonGrey',
|
||||||
|
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||||
|
'ico' => 'left',
|
||||||
|
'value' => 'Retour'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2 offset8">
|
||||||
|
<?php echo template::submit('redirectionConfigSubmit'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
|
<div class="block">
|
||||||
|
<h4>Redirection</h4>
|
||||||
|
<?php echo template::text('redirectionConfigUrl', [
|
||||||
|
'label' => 'Lien de redirection',
|
||||||
|
'placeholder' => 'http://',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'url'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col6">
|
||||||
|
<div class="block">
|
||||||
|
<h4>Statistiques</h4>
|
||||||
|
<?php echo template::text('redirectionConfigCount', [
|
||||||
|
'disabled' => true,
|
||||||
|
'label' => 'Nombre de redirection',
|
||||||
|
'value' => helper::filter($this->getData(['module', $this->getUrl(0), 'count']), helper::FILTER_INT)
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo template::formClose(); ?>
|
32
module/external/view/index/index.js.php
vendored
Normal file
32
module/external/view/index/index.js.php
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of Zwii.
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
|
* @license GNU General Public License, version 3
|
||||||
|
* @link http://zwiicms.com/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
if (document.referrer.indexOf("edit") === -1)
|
||||||
|
{
|
||||||
|
core.confirm(
|
||||||
|
"Souhaitez-vous accéder à l'interface de modification de la page ? En cas de refus, vous serez redirigé vers l'URL saisie dans le module de redirection.",
|
||||||
|
function() {
|
||||||
|
$(location).attr("href", "<?php echo helper::baseUrl(); ?>page/edit/<?php echo $this->getUrl(0); ?>");
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
$(location).attr("href", "<?php echo helper::baseUrl() . $this->getUrl(); ?>/force");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$(location).attr("href", "<?php echo helper::baseUrl(); ?>");
|
||||||
|
}
|
1
module/external/view/index/index.php
vendored
Normal file
1
module/external/view/index/index.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- Page vide avec un commentaire pour ne pas afficher d'erreur 404 -->
|
Loading…
Reference in New Issue
Block a user