12100 Fix external scripts integrations

This commit is contained in:
Fred Tempez 2023-01-11 18:01:35 +01:00
parent ca5a59c673
commit f92cee284b
6 changed files with 11 additions and 18 deletions

View File

@ -2,6 +2,7 @@
## Version 12.1.00 ## Version 12.1.00
### Corrections : ### Corrections :
- Corrige un problème de prise en compte des scripts et des feuilles de style intégrés à la page ou au site.
- Corrige une erreur fatale avec un argument float au lieu d'int dans mt_srand. - Corrige une erreur fatale avec un argument float au lieu d'int dans mt_srand.
### Améliorations : ### Améliorations :
- Changement du nom de formulaire de gestion des langues (multilangue devient multilingue). - Changement du nom de formulaire de gestion des langues (multilangue devient multilingue).

View File

@ -2999,8 +2999,8 @@ class core extends common
'title' => $title, 'title' => $title,
'content' => $this->getPage($this->getUrl(0), self::$i18nContent) . 'content' => $this->getPage($this->getUrl(0), self::$i18nContent) .
// Concatène avec les paramètres avancés. // Concatène avec les paramètres avancés.
'<style>' . $this->getData(['page', $this->getUrl(0), 'css']) . '</style>' . $this->getData(['page', $this->getUrl(0), 'css']) .
'<script>' . $this->getData(['page', $this->getUrl(0), 'js']) . '</script>', $this->getData(['page', $this->getUrl(0), 'js']),
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']), 'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
@ -3008,13 +3008,13 @@ class core extends common
'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']),
'contentRight' => $this->getData(['page', $this->getUrl(0), 'barRight']) 'contentRight' => $this->getData(['page', $this->getUrl(0), 'barRight'])
? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) . ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) .
'<style>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) . '</style>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) .
'<script>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) . '</script>' $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js'])
: '', : '',
'contentLeft' => $this->getData(['page', $this->getUrl(0), 'barLeft']) 'contentLeft' => $this->getData(['page', $this->getUrl(0), 'barLeft'])
? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) . ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) .
'<style>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) . '</style>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) .
'<script>' . $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) . '</script>' $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js'])
: '' : ''
]); ]);
} }

View File

@ -24,9 +24,7 @@
<?php $this->showStyle(); ?> <?php $this->showStyle(); ?>
<!-- Script perso dans le header --> <!-- Script perso dans le header -->
<?php if (file_exists(self::DATA_DIR . 'head.inc.html')) { <?php if (file_exists(self::DATA_DIR . 'head.inc.html')) {
echo '<script>';
include(self::DATA_DIR . 'head.inc.html'); include(self::DATA_DIR . 'head.inc.html');
echo '</script>';
} ?> } ?>
</head> </head>
@ -194,9 +192,7 @@
<?php $this->showScript(); ?> <?php $this->showScript(); ?>
<!-- Script perso dans body --> <!-- Script perso dans body -->
<?php if (file_exists(self::DATA_DIR . 'body.inc.html')) { <?php if (file_exists(self::DATA_DIR . 'body.inc.html')) {
echo '<script>';
include(self::DATA_DIR . 'body.inc.html'); include(self::DATA_DIR . 'body.inc.html');
echo '</script>';
}?> }?>
</body> </body>

View File

@ -564,8 +564,6 @@ class page extends common
if ($this->isPost()) { if ($this->isPost()) {
// Supprime les balises styles si elles ont été saisies // Supprime les balises styles si elles ont été saisies
$css = $this->getInput('pageCssEditorContent', null); $css = $this->getInput('pageCssEditorContent', null);
$css = str_replace('<style>', '', $css);
$css = str_replace('</style>', '', $css);
// Enregistre le CSS // Enregistre le CSS
$this->setData([ $this->setData([
'page', $this->getUrl(2), 'css', 'page', $this->getUrl(2), 'css',
@ -594,11 +592,9 @@ class page extends common
public function jsEditor() public function jsEditor()
{ {
// Soumission du formulaire // Soumission du formulaire
// Supprime les balises scripts si elles ont été saisies
$js = $this->getInput('pageJsEditorContent', null);
$js = str_replace('<script>', '', $js);
$js = str_replace('</script>', '', $js);
if ($this->isPost()) { if ($this->isPost()) {
// Supprime les balises scripts si elles ont été saisies
$js = $this->getInput('pageJsEditorContent', null);
// Enregistre le JS // Enregistre le JS
$this->setData([ $this->setData([
'page', $this->getUrl(2), 'js', 'page', $this->getUrl(2), 'js',

View File

@ -14,7 +14,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::textarea('pageCssEditorContent', [ <?php echo template::textarea('pageCssEditorContent', [
'value' => empty($this->getData(['page', $this->getUrl(2), 'css'])) ? '' : $this->getData(['page', $this->getUrl(2), 'css']), 'value' => is_null($this->getData(['page', $this->getUrl(2), 'css'])) ? '' : $this->getData(['page', $this->getUrl(2), 'css']),
'class' => 'editor' 'class' => 'editor'
]); ?> ]); ?>
</div> </div>

View File

@ -14,7 +14,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::textarea('pageJsEditorContent', [ <?php echo template::textarea('pageJsEditorContent', [
'value' => empty($this->getData(['page', $this->getUrl(2), 'js'])) ? '' : $this->getData(['page', $this->getUrl(2), 'js']), 'value' => is_null($this->getData(['page', $this->getUrl(2), 'js'])) ? '' : $this->getData(['page', $this->getUrl(2), 'js']),
'class' => 'editor' 'class' => 'editor'
]); ?> ]); ?>
</div> </div>