Evite un warning

This commit is contained in:
Fred Tempez 2025-02-03 14:39:17 +01:00
parent 1747e60082
commit 962e4c5d7c

View File

@ -492,7 +492,10 @@ class core extends common
*/ */
$accessInfo['userName'] = ''; $accessInfo['userName'] = '';
$accessInfo['pageId'] = ''; $accessInfo['pageId'] = '';
if ($this->getData(['user'])) { if (
is_array($this->getData(['user']))
&& empty($this->getData(['user'])) === false
) {
foreach ($this->getData(['user']) as $userId => $userIds) { foreach ($this->getData(['user']) as $userId => $userIds) {
if (!is_null($this->getData(['user', $userId, 'accessUrl']))) { if (!is_null($this->getData(['user', $userId, 'accessUrl']))) {
$t = explode('/', $this->getData(['user', $userId, 'accessUrl'])); $t = explode('/', $this->getData(['user', $userId, 'accessUrl']));
@ -573,7 +576,6 @@ class core extends common
'inlineStyle' => $inlineStyle, 'inlineStyle' => $inlineStyle,
'inlineScript' => $inlineScript, 'inlineScript' => $inlineScript,
]); ]);
} }
// Importe le module // Importe le module
else { else {
@ -802,8 +804,7 @@ class core extends common
http_response_code(404); http_response_code(404);
// Pour éviter une 404, bascule dans l'espace correct si la page existe dans cette langue. // Pour éviter une 404, bascule dans l'espace correct si la page existe dans cette langue.
// Parcourir les espaces // Parcourir les espaces
foreach (common::$languages as $langId => $value) { foreach (common::$languages as $langId => $value) {;
;
if ( if (
// l'espace existe // l'espace existe
is_dir(common::DATA_DIR . $langId) && is_dir(common::DATA_DIR . $langId) &&
@ -853,25 +854,25 @@ class core extends common
]); ]);
} }
switch ($this->output['display']) { switch ($this->output['display']) {
// Layout brut // Layout brut
case common::DISPLAY_RAW: case common::DISPLAY_RAW:
echo $this->output['content']; echo $this->output['content'];
break; break;
// Layout vide // Layout vide
case common::DISPLAY_LAYOUT_BLANK: case common::DISPLAY_LAYOUT_BLANK:
require 'core/layout/blank.php'; require 'core/layout/blank.php';
break; break;
// Affichage en JSON // Affichage en JSON
case common::DISPLAY_JSON: case common::DISPLAY_JSON:
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($this->output['content']); echo json_encode($this->output['content']);
break; break;
// RSS feed // RSS feed
case common::DISPLAY_RSS: case common::DISPLAY_RSS:
header('Content-type: application/rss+xml; charset=UTF-8'); header('Content-type: application/rss+xml; charset=UTF-8');
echo $this->output['content']; echo $this->output['content'];
break; break;
// Layout allégé // Layout allégé
case common::DISPLAY_LAYOUT_LIGHT: case common::DISPLAY_LAYOUT_LIGHT:
ob_start(); ob_start();
require 'core/layout/light.php'; require 'core/layout/light.php';
@ -882,7 +883,7 @@ class core extends common
$content = preg_replace('/[\t ]+/u', ' ', $content); $content = preg_replace('/[\t ]+/u', ' ', $content);
echo $content; echo $content;
break; break;
// Layout principal // Layout principal
case common::DISPLAY_LAYOUT_MAIN: case common::DISPLAY_LAYOUT_MAIN:
ob_start(); ob_start();
require 'core/layout/main.php'; require 'core/layout/main.php';
@ -895,4 +896,4 @@ class core extends common
break; break;
} }
} }
} }