Merge branch 'dev-module-extern'

This commit is contained in:
Fred Tempez 2018-04-17 20:40:30 +02:00
commit cd4cf2ca25
11 changed files with 277 additions and 127 deletions

0
core/core.php Executable file → Normal file
View File

View File

@ -339,7 +339,7 @@ $config = array(
//Allowed extensions (lowercase insert)
//**********************
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg','ico' ), //Images
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'ico'), //Files
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'php'), //Files
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives

View File

@ -0,0 +1,72 @@
<?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 inclusion 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('inclusionConfigUrl', 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_MODERATOR
AND $this->getUrl(1) !== 'force'
) {
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_LAYOUT_BLANK,
'title' => '',
'view' => 'index'
]);
}
// Sinon inclusion
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), 'url']) . '"></iframe>' ,
'state' => true
]);
}
}
}

View File

@ -0,0 +1,37 @@
<?php echo template::formOpen('inclusionConfig'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('inclusionConfigBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('inclusionConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col6">
<div class="block">
<h4>inclusion</h4>
<?php echo template::file('inclusionConfigUrl', [
'label' => 'Lien d\'inclusion',
'placeholder' => helper::baseUrl() . 'site/file/source/',
'value' => $this->getData(['module', $this->getUrl(0), 'url'])
]); ?>
</div>
</div>
<div class="col6">
<div class="block">
<h4>Statistiques</h4>
<?php echo template::text('inclusionConfigCount', [
'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(); ?>

View 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(); ?>");
}

View File

@ -0,0 +1 @@
<!-- Page vide avec un commentaire pour ne pas afficher d'erreur 404 -->

0
module/redirection/redirection.php Normal file → Executable file
View File

0
module/redirection/view/config/config.php Normal file → Executable file
View File

0
module/redirection/view/index/index.js.php Normal file → Executable file
View File

0
module/redirection/view/index/index.php Normal file → Executable file
View File

View File

@ -3,6 +3,7 @@
* ou supprimer des propriétés CSS en fonction de vos besoins.
*/
/**
* Éléments principaux
*/
@ -124,3 +125,10 @@ input[type='password']:hover,
select:hover,
textarea:hover {
}
/* iframe du module Inclusion*/
iframe {
width:100%;
height:1000px;
border:none;
}