forked from ZwiiCMS-Team/ZwiiCMS
Module code
This commit is contained in:
parent
0e3e3f215f
commit
f63d331b96
76
module/code/code.php
Normal file
76
module/code/code.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?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/
|
||||
*/
|
||||
|
||||
class code extends common {
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['module', $this->getUrl(0), 'file', $this->getInput('codeConfigFile', helper::FILTER_URL, true)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// 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_ADMIN
|
||||
AND $this->getUrl(1) !== 'force'
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_BLANK,
|
||||
'title' => '',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
// Sinon code
|
||||
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([
|
||||
'content' => '<iframe src="' .
|
||||
helper::baseUrl(false) .
|
||||
'site/file/source/' .
|
||||
$this->getData(['module', $this->getUrl(0), 'file']) .
|
||||
'" frameborder="0"></iframe>' ,
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
37
module/code/view/config/config.php
Normal file
37
module/code/view/config/config.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php echo template::formOpen('codeConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('codeConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('codeConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Fichier de code</h4>
|
||||
<?php echo template::file('codeConfigFile', [
|
||||
'label' => 'Fichier de code :',
|
||||
'placeholder' => helper::baseUrl() . 'site/file/source/',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Statistiques</h4>
|
||||
<?php echo template::text('codeConfigCount', [
|
||||
'disabled' => true,
|
||||
'label' => 'Nombre de redirections',
|
||||
'value' => helper::filter($this->getData(['module', $this->getUrl(0), 'count']), helper::FILTER_INT)
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
module/code/view/index/index.js.php
Normal file
18
module/code/view/index/index.js.php
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
/**
|
||||
* 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/
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
self.location='<?php echo helper::baseUrl(); ?>page/edit/<?php echo $this->getUrl(0); ?>';
|
||||
|
1
module/code/view/index/index.php
Normal file
1
module/code/view/index/index.php
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