Force obtention des permissions à chaque isPost
This commit is contained in:
parent
101da263fd
commit
08e8c3fa2c
@ -240,7 +240,10 @@ class config extends common
|
||||
public function backup()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Creation du ZIP
|
||||
$filter = $this->getInput('configBackupOption', helper::FILTER_BOOLEAN) === true ? ['backup', 'tmp'] : ['backup', 'tmp', 'file'];
|
||||
$fileName = helper::autoBackup(self::TEMP_DIR, $filter);
|
||||
@ -330,7 +333,10 @@ class config extends common
|
||||
public function restore()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
$success = false;
|
||||
|
||||
@ -427,7 +433,10 @@ class config extends common
|
||||
public function index()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Basculement en mise à jour auto, remise à 0 du compteur
|
||||
if (
|
||||
@ -600,7 +609,10 @@ class config extends common
|
||||
public function script()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Ecrire les fichiers de script
|
||||
if ($this->geturl(2) === 'head') {
|
||||
file_put_contents(self::DATA_DIR . 'head.inc.html', $this->getInput('configScriptHead', null));
|
||||
|
@ -52,7 +52,10 @@ class install extends common
|
||||
}
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
$lang = $this->getInput('installLanguage');
|
||||
// Pour la suite de l'installation
|
||||
@ -95,7 +98,10 @@ class install extends common
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
$success = true;
|
||||
|
||||
|
@ -296,7 +296,10 @@ class page extends common
|
||||
// La page existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Si le Title n'est pas vide, premier test pour positionner la notification du champ obligatoire
|
||||
if ($this->getInput('pageEditTitle', helper::FILTER_ID, true) !== null && $this->getInput('pageEditTitle') !== '') {
|
||||
// Génére l'ID si le titre de la page a changé
|
||||
@ -541,7 +544,10 @@ class page extends common
|
||||
public function cssEditor()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$css = $this->getInput('pageCssEditorContent', helper::FILTER_STRING_LONG) === null ? '' : $this->getInput('pageCssEditorContent', helper::FILTER_STRING_LONG);
|
||||
// Enregistre le CSS
|
||||
$this->setData([
|
||||
@ -572,7 +578,10 @@ class page extends common
|
||||
public function jsEditor()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$js = $this->getInput('pageJsEditorContent', helper::FILTER_STRING_LONG) === null ? '' : $this->getInput('pageJsEditorContent', helper::FILTER_STRING_LONG);
|
||||
// Enregistre le JS
|
||||
$this->setData([
|
||||
|
@ -266,7 +266,10 @@ class plugin extends common
|
||||
{
|
||||
// Soumission du formulaire
|
||||
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Installation d'un module
|
||||
$checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN);
|
||||
$zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT);
|
||||
@ -759,7 +762,10 @@ class plugin extends common
|
||||
public function dataImport()
|
||||
{
|
||||
// Soumission du formulaire d'importation du module dans une page libre
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Récupérer le fichier et le décompacter
|
||||
$zipFilename = $this->getInput('pluginImportFile', helper::FILTER_STRING_SHORT, true);
|
||||
$pageId = $this->getInput('pluginImportPage', null, true);
|
||||
|
@ -249,7 +249,10 @@ class theme extends common
|
||||
public function admin()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'admin',
|
||||
[
|
||||
@ -295,7 +298,10 @@ class theme extends common
|
||||
public function advanced()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Enregistre le CSS
|
||||
file_put_contents(self::DATA_DIR . 'custom.css', $this->getInput('themeAdvancedCss', null));
|
||||
// Valeurs en sortie
|
||||
@ -321,7 +327,10 @@ class theme extends common
|
||||
public function body()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'theme',
|
||||
'body',
|
||||
@ -359,7 +368,10 @@ class theme extends common
|
||||
public function footer()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
if (
|
||||
$this->getInput('themeFooterCopyrightPosition') === 'hide' &&
|
||||
$this->getInput('themeFooterSocialsPosition') === 'hide' &&
|
||||
@ -449,7 +461,10 @@ class theme extends common
|
||||
public function header()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Modification des URL des images dans la bannière perso
|
||||
$featureContent = $this->getInput('themeHeaderText', null);
|
||||
/**
|
||||
@ -550,7 +565,10 @@ class theme extends common
|
||||
public function menu()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'theme',
|
||||
'menu',
|
||||
@ -675,7 +693,10 @@ class theme extends common
|
||||
public function fontAdd()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Type d'import en ligne ou local
|
||||
$type = $this->getInput('fontAddUrl', helper::FILTER_BOOLEAN) ? 'imported' : 'files';
|
||||
$type === 'files' ? 'imported' : 'files';
|
||||
@ -742,7 +763,10 @@ class theme extends common
|
||||
public function fontEdit()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Type d'import en ligne ou local
|
||||
$type = $this->getInput('fontEditUrl', helper::FILTER_BOOLEAN) ? 'imported' : 'files';
|
||||
$ressource = $type === 'imported' ? $this->getInput('fontEditUrl', null) : $this->getInput('fontEditFile', null);
|
||||
@ -880,7 +904,10 @@ class theme extends common
|
||||
public function site()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'theme',
|
||||
'title',
|
||||
@ -954,7 +981,10 @@ class theme extends common
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
$zipFilename = $this->getInput('themeManageImport', helper::FILTER_STRING_SHORT, true);
|
||||
$data = $this->import(self::FILE_DIR . 'source/' . $zipFilename);
|
||||
|
@ -66,6 +66,14 @@ class translate extends common
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} else {
|
||||
$lang = $this->getUrl(2);
|
||||
// Action interdite ou URl avec le code langue incorrecte
|
||||
if (
|
||||
@ -99,15 +107,18 @@ class translate extends common
|
||||
'state' => $response
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration avancée des langues
|
||||
*/
|
||||
public function copy()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Initialisation
|
||||
$success = false;
|
||||
$copyFrom = $this->getInput('translateFormCopySource');
|
||||
@ -175,7 +186,8 @@ class translate extends common
|
||||
foreach (self::$languages as $key => $value) {
|
||||
// tableau des langues installées
|
||||
if (is_dir(self::DATA_DIR . $key)) {
|
||||
if (file_exists(self::DATA_DIR . $key . '/page.json') &&
|
||||
if (
|
||||
file_exists(self::DATA_DIR . $key . '/page.json') &&
|
||||
file_exists(self::DATA_DIR . $key . '/module.json') &&
|
||||
file_exists(self::DATA_DIR . $key . '/locale.json')
|
||||
) {
|
||||
@ -302,7 +314,10 @@ class translate extends common
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Création du contenu
|
||||
$lang = $this->getInput('translateAddContent');
|
||||
@ -356,7 +371,10 @@ class translate extends common
|
||||
}
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Sauvegarder les locales
|
||||
$data = [
|
||||
@ -459,7 +477,10 @@ class translate extends common
|
||||
]);
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Sauvegarder les champs de la langue
|
||||
$data = json_decode(file_get_contents(self::I18N_DIR . $lang . '.json'), true);
|
||||
@ -536,6 +557,14 @@ class translate extends common
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} else {
|
||||
// Action interdite ou URl avec le code langue incorrecte
|
||||
$target = $this->getUrl(2);
|
||||
$lang = $this->getUrl(3);
|
||||
@ -584,6 +613,7 @@ class translate extends common
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Modifie la langue du site par défaut
|
||||
@ -591,6 +621,14 @@ class translate extends common
|
||||
*/
|
||||
public function default()
|
||||
{
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} else {
|
||||
// Action interdite ou URl avec le code langue incorrecte
|
||||
$lang = $this->getUrl(2);
|
||||
if (
|
||||
@ -618,6 +656,7 @@ class translate extends common
|
||||
'state' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langue
|
||||
|
@ -75,7 +75,10 @@ class user extends common
|
||||
public function add()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$check = true;
|
||||
// L'identifiant d'utilisateur est indisponible
|
||||
$userId = $this->getInput('userAddId', helper::FILTER_ID, true);
|
||||
@ -259,7 +262,10 @@ class user extends common
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Double vérification pour le mot de passe
|
||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||
if ($this->getInput('userEditNewPassword')) {
|
||||
@ -384,7 +390,10 @@ class user extends common
|
||||
public function forgot()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$userId = $this->getInput('userForgotId', helper::FILTER_ID, true);
|
||||
if ($this->getData(['user', $userId])) {
|
||||
// Enregistre la date de la demande dans le compte utilisateur
|
||||
@ -529,18 +538,12 @@ class user extends common
|
||||
*/
|
||||
public function profilEdit()
|
||||
{
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true ||
|
||||
$this->checkCSRF()
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'profil',
|
||||
$this->getInput('profilEditGroup', helper::FILTER_STRING_LONG, true),
|
||||
@ -667,7 +670,10 @@ class user extends common
|
||||
public function profilAdd()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Nombre de profils de ce groupe
|
||||
$group = $this->getInput('profilAddGroup');
|
||||
$profil = (string) (count($this->getData(['profil', $group])) + 1);
|
||||
@ -827,7 +833,9 @@ class user extends common
|
||||
{
|
||||
// Soumission du formulaire
|
||||
$logStatus = '';
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->isPost()
|
||||
) {
|
||||
// Lire Id du compte
|
||||
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
|
||||
// Check le captcha
|
||||
@ -1003,7 +1011,10 @@ class user extends common
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Double vérification pour le mot de passe
|
||||
if ($this->getInput('userResetNewPassword')) {
|
||||
// La confirmation ne correspond pas au mot de passe
|
||||
@ -1046,7 +1057,10 @@ class user extends common
|
||||
// Soumission du formulaire
|
||||
$notification = '';
|
||||
$success = true;
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Lecture du CSV et construction du tableau
|
||||
$file = $this->getInput('userImportCSVFile', helper::FILTER_STRING_SHORT, true);
|
||||
$filePath = self::FILE_DIR . 'source/' . $file;
|
||||
@ -1180,6 +1194,7 @@ class user extends common
|
||||
*/
|
||||
public function template()
|
||||
{
|
||||
if ($this->getUser('permission', __CLASS__, __FUNCTION__) !== true) {
|
||||
$file = 'template.csv';
|
||||
$path = 'core/module/user/ressource/';
|
||||
// Téléchargement du CSV
|
||||
@ -1192,6 +1207,8 @@ class user extends common
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les dossier contenus dans RFM
|
||||
*/
|
||||
|
@ -250,7 +250,10 @@ class blog extends common
|
||||
public function add()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Modification de l'userId
|
||||
if ($this->getUser('group') === self::GROUP_ADMIN) {
|
||||
$newuserid = $this->getInput('blogAddUserId', helper::FILTER_STRING_SHORT, true);
|
||||
@ -556,7 +559,10 @@ class blog extends common
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'config',
|
||||
@ -635,7 +641,10 @@ class blog extends common
|
||||
// L'article existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
if ($this->getUser('group') === self::GROUP_ADMIN) {
|
||||
$newuserid = $this->getInput('blogEditUserId', helper::FILTER_STRING_SHORT, true);
|
||||
} else {
|
||||
@ -730,7 +739,10 @@ class blog extends common
|
||||
// L'article existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Check la captcha
|
||||
if (
|
||||
$this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
||||
@ -892,6 +904,7 @@ class blog extends common
|
||||
*/
|
||||
public function signature($userId)
|
||||
{
|
||||
if ($this->getUser('permission', __CLASS__, __FUNCTION__) !== true) {
|
||||
switch ($this->getData(['user', $userId, 'signature'])) {
|
||||
case 1:
|
||||
return $userId;
|
||||
@ -909,4 +922,6 @@ class blog extends common
|
||||
return $this->getData(['user', $userId, 'firstname']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -117,7 +117,10 @@ class form extends common
|
||||
self::$listUsers[] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
@ -163,7 +166,10 @@ class form extends common
|
||||
self::$listUsers[] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Débordement
|
||||
$width = $this->getInput('formOptionWidth');
|
||||
if ($this->getInput('formOptionWidth', helper::FILTER_INT) + $this->getInput('formOptionOffset', helper::FILTER_INT) > 12) {
|
||||
@ -228,7 +234,10 @@ class form extends common
|
||||
public function data()
|
||||
{
|
||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||
if ($data) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$data
|
||||
) {
|
||||
// Pagination
|
||||
$pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPage);
|
||||
// Liste des pages
|
||||
@ -383,7 +392,10 @@ class form extends common
|
||||
$this->update();
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Check la captcha
|
||||
if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
|
@ -417,7 +417,10 @@ class gallery extends common
|
||||
public function add()
|
||||
{
|
||||
// Soumission du formulaire d'ajout d'une galerie
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$galleryId = $this->getInput('galleryAddName', null, true);
|
||||
$success = false;
|
||||
if ($galleryId) {
|
||||
@ -499,8 +502,10 @@ class gallery extends common
|
||||
public function delete()
|
||||
{
|
||||
// La galerie n'existe pas
|
||||
if ($this->getUser('permission', __CLASS__, __FUNCTION__) !== true ||
|
||||
$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true ||
|
||||
$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -536,7 +541,10 @@ class gallery extends common
|
||||
public function edit()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// légendes
|
||||
foreach ((array) $this->getInput('legend', null) as $file => $legend) {
|
||||
@ -687,12 +695,12 @@ class gallery extends common
|
||||
// Définir les options
|
||||
self::$config['homePicture'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'homePicture']);
|
||||
self::$config['fullScreen'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'fullScreen']) === true ? 'fullScreen' : '';
|
||||
self::$config['backPositionTop'] = ( $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'top'||
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both' )
|
||||
self::$config['backPositionTop'] = ($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'top' ||
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both')
|
||||
? ''
|
||||
: 'displayNone';
|
||||
self::$config['backPositionBottom'] = ( $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'bottom'||
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both' )
|
||||
self::$config['backPositionBottom'] = ($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'bottom' ||
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both')
|
||||
? ''
|
||||
: 'displayNone';
|
||||
self::$config['backAlign'] = 'textAlign' . ucfirst($this->getData(['module', $this->getUrl(0), 'config', 'backAlign']));
|
||||
@ -838,7 +846,10 @@ class gallery extends common
|
||||
public function theme()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) {
|
||||
mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true);
|
||||
@ -910,16 +921,11 @@ class gallery extends common
|
||||
* Options applicables à toutes les galeries du module
|
||||
*/
|
||||
if ($this->getUrl(2) === 'galleries') {
|
||||
// Action interdite
|
||||
if ($this->checkCSRF()) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => helper::translate('Action interdite')
|
||||
]);
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Sauver la configuration de la galerie
|
||||
$this->setData([
|
||||
@ -960,7 +966,10 @@ class gallery extends common
|
||||
]);
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Le nom de la galerie est vide c'est le nom dans l'url qui est pris en compte
|
||||
$galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(3);
|
||||
|
@ -163,7 +163,10 @@ class news extends common
|
||||
public function add()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
// Crée la news
|
||||
$newsId = helper::increment($this->getInput('newsAddTitle', helper::FILTER_ID), (array) $this->getData(['module', $this->getUrl(0), 'posts']));
|
||||
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
||||
@ -262,7 +265,10 @@ class news extends common
|
||||
public function option()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.newsFrame {';
|
||||
@ -404,7 +410,7 @@ class news extends common
|
||||
// La news existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
if ($this->getUser('permission', __CLASS__, __FUNCTION__) !== true && $this->isPost()) {
|
||||
// Si l'id a changée
|
||||
$newsId = $this->getInput('newsEditTitle', helper::FILTER_ID, true);
|
||||
if ($newsId !== $this->getUrl(2)) {
|
||||
|
@ -13,7 +13,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class redirection extends common {
|
||||
class redirection extends common
|
||||
{
|
||||
|
||||
const VERSION = '1.6';
|
||||
const REALNAME = 'Redirection';
|
||||
@ -28,9 +29,13 @@ class redirection extends common {
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
public function config()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData(['module', $this->getUrl(0), 'url', $this->getInput('redirectionConfigUrl', helper::FILTER_URL, true)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -49,9 +54,11 @@ class redirection extends common {
|
||||
/**
|
||||
* Accueil
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// Message si l'utilisateur peut éditer la page
|
||||
if( $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
&& $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
&& $this->getUser('group') >= self::GROUP_MODERATOR
|
||||
&& $this->getUrl(1) !== 'force'
|
||||
|
@ -120,7 +120,10 @@ class search extends common
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.keywordColor {background:' . $this->getInput('searchKeywordColor') . ';}';
|
||||
@ -129,17 +132,25 @@ class search extends common
|
||||
// Fin feuille de style
|
||||
|
||||
// Soumission du formulaire
|
||||
$this->setData(['module', $this->getUrl(0), 'config', [
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'submitText' => $this->getInput('searchSubmitText'),
|
||||
'placeHolder' => $this->getInput('searchPlaceHolder'),
|
||||
'resultHideContent' => $this->getInput('searchResultHideContent', helper::FILTER_BOOLEAN),
|
||||
'previewLength' => $this->getInput('searchPreviewLength', helper::FILTER_INT),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
$this->setData(['module', $this->getUrl(0), 'theme', [
|
||||
]
|
||||
]);
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'theme',
|
||||
[
|
||||
'keywordColor' => $this->getInput('searchKeywordColor'),
|
||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
||||
]]);
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
// Valeurs en sortie, affichage du formulaire
|
||||
@ -165,7 +176,10 @@ class search extends common
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
//Initialisations variables
|
||||
$success = true;
|
||||
$result = [];
|
||||
@ -181,10 +195,12 @@ class search extends common
|
||||
$arraymotclef = explode(' ', $motclef);
|
||||
$motclef = '';
|
||||
foreach ($arraymotclef as $key => $value) {
|
||||
if (strlen($value) > 2 && $value !== 'les' && $value !== 'des' && $value !== 'une' && $value !== 'aux') $motclef .= $value . ' ';
|
||||
if (strlen($value) > 2 && $value !== 'les' && $value !== 'des' && $value !== 'une' && $value !== 'aux')
|
||||
$motclef .= $value . ' ';
|
||||
}
|
||||
// Suppression du dernier ' '
|
||||
if ($motclef !== '') $motclef = substr($motclef, 0, strlen($motclef) - 1);
|
||||
if ($motclef !== '')
|
||||
$motclef = substr($motclef, 0, strlen($motclef) - 1);
|
||||
|
||||
// Récupération de l'état de l'option mot entier passé par le même formulaire
|
||||
self::$motentier = $this->getInput('searchMotentier', helper::FILTER_BOOLEAN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user