forked from ZwiiCMS-Team/ZwiiCampus
Session ZWII_CLASS
This commit is contained in:
parent
75918bdeec
commit
32051cd9e2
@ -1231,8 +1231,8 @@ class layout extends common
|
||||
public function showi18n($lang)
|
||||
{
|
||||
if (
|
||||
(isset($_SESSION['ZWII_CONTENT'])
|
||||
and $_SESSION['ZWII_CONTENT'] === $lang
|
||||
(isset($_SESSION['ZWII_CLASS'])
|
||||
and $_SESSION['ZWII_CLASS'] === $lang
|
||||
)
|
||||
) {
|
||||
$select = ' class="i18nFlagSelected" ';
|
||||
|
@ -513,7 +513,7 @@ class core extends common
|
||||
is_array($pagesId['page']) &&
|
||||
array_key_exists($this->getUrl(0), $pagesId['page'])
|
||||
) {
|
||||
$_SESSION['ZWII_CONTENT'] = $key;
|
||||
$_SESSION['ZWII_CLASS'] = $key;
|
||||
header('Refresh:0; url=' . helper::baseUrl() . $this->getUrl(0));
|
||||
exit();
|
||||
}
|
||||
|
@ -494,8 +494,8 @@ class template
|
||||
$lang = $langId;
|
||||
break;
|
||||
case 'selected':
|
||||
if (isset($_SESSION['ZWII_CONTENT'])) {
|
||||
$lang = $_SESSION['ZWII_CONTENT'];
|
||||
if (isset($_SESSION['ZWII_CLASS'])) {
|
||||
$lang = $_SESSION['ZWII_CLASS'];
|
||||
} else {
|
||||
$lang = 'fr_FR';
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ $(document).ready(function () {
|
||||
var langSelected = $(this).val();
|
||||
var langSelected = langSelected.split("/");
|
||||
// Lit le cookie de langue
|
||||
var langSession = "<?php echo isset($_SESSION['ZWII_CONTENT']) ? $_SESSION['ZWII_CONTENT'] : '';?>";
|
||||
var langSession = "<?php echo isset($_SESSION['ZWII_CLASS']) ? $_SESSION['ZWII_CLASS'] : '';?>";
|
||||
// Découpe l'URL pour exclure le changement de page avec le thème
|
||||
var url = window.location;
|
||||
var currentUrl = url.href.split("/");
|
||||
|
@ -303,20 +303,10 @@ class common
|
||||
// $this->input['_SESSION'] = $_SESSION;
|
||||
|
||||
// Déterminer la langue du contenu du site
|
||||
if (isset($_SESSION['ZWII_CONTENT'])) {
|
||||
if (isset($_SESSION['ZWII_CLASS'])) {
|
||||
// Déterminé par la session présente
|
||||
self::$classesContent = $_SESSION['ZWII_CONTENT'];
|
||||
} else {
|
||||
// Détermine la langue par défaut
|
||||
foreach (self::$languages as $key => $value) {
|
||||
if (file_exists(self::DATA_DIR . $key . '/.default')) {
|
||||
self::$classesContent = $key;
|
||||
$_SESSION['ZWII_CONTENT'] = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self::$classesContent = $_SESSION['ZWII_CLASS'];
|
||||
}
|
||||
\setlocale(LC_ALL, self::$classesContent . '.UTF8');
|
||||
|
||||
// Instanciation de la classe des entrées / sorties
|
||||
$this->jsonDB(self::$classesContent);
|
||||
|
@ -120,24 +120,24 @@ class install extends common
|
||||
self::$i18nUI = $_SESSION['ZWII_UI'];
|
||||
self::$i18nUI = array_key_exists(self::$i18nUI, self::$languages) ? self::$i18nUI : 'fr_FR';
|
||||
// par défaut le contenu est la langue d'installation
|
||||
$_SESSION['ZWII_CONTENT'] = self::$i18nUI;
|
||||
$_SESSION['ZWII_CLASS'] = self::$i18nUI;
|
||||
|
||||
// Création du dossier de langue avec le marqueur de langue par défaut
|
||||
if (!is_dir(self::DATA_DIR . $_SESSION['ZWII_CONTENT'])) {
|
||||
mkdir(self::DATA_DIR . $_SESSION['ZWII_CONTENT']);
|
||||
touch(self::DATA_DIR . $_SESSION['ZWII_CONTENT'] . '/.default');
|
||||
if (!is_dir(self::DATA_DIR . $_SESSION['ZWII_CLASS'])) {
|
||||
mkdir(self::DATA_DIR . $_SESSION['ZWII_CLASS']);
|
||||
touch(self::DATA_DIR . $_SESSION['ZWII_CLASS'] . '/.default');
|
||||
}
|
||||
|
||||
// Installation du site de test
|
||||
if (
|
||||
$this->getInput('installDefaultData', helper::FILTER_BOOLEAN) === false
|
||||
&& $_SESSION['ZWII_CONTENT'] === 'fr_FR'
|
||||
&& $_SESSION['ZWII_CLASS'] === 'fr_FR'
|
||||
) {
|
||||
$sample = true;
|
||||
}
|
||||
$this->initData('page', $_SESSION['ZWII_CONTENT'], $sample);
|
||||
$this->initData('module', $_SESSION['ZWII_CONTENT'], $sample);
|
||||
$this->initData('config', $_SESSION['ZWII_CONTENT'], $sample);
|
||||
$this->initData('page', $_SESSION['ZWII_CLASS'], $sample);
|
||||
$this->initData('module', $_SESSION['ZWII_CLASS'], $sample);
|
||||
$this->initData('config', $_SESSION['ZWII_CLASS'], $sample);
|
||||
|
||||
// Création de l'utilisateur si les données sont complétées.
|
||||
// success retour de l'enregistrement des données
|
||||
@ -153,7 +153,7 @@ class install extends common
|
||||
'signature' => 1,
|
||||
'mail' => $userMail,
|
||||
'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true),
|
||||
'language' => $_SESSION['ZWII_CONTENT']
|
||||
'language' => $_SESSION['ZWII_CLASS']
|
||||
]
|
||||
]);
|
||||
|
||||
@ -172,7 +172,7 @@ class install extends common
|
||||
|
||||
// Nettoyage fr par défaut
|
||||
if (
|
||||
$_SESSION['ZWII_CONTENT'] !== 'fr_FR'
|
||||
$_SESSION['ZWII_CLASS'] !== 'fr_FR'
|
||||
) {
|
||||
if (is_dir(self::DATA_DIR . 'fr_FR'))
|
||||
$this->deleteDir(self::DATA_DIR . 'fr_FR');
|
||||
|
@ -532,7 +532,7 @@ class language extends common
|
||||
) {
|
||||
|
||||
// Stocker la sélection
|
||||
$_SESSION['ZWII_CONTENT'] = $lang;
|
||||
$_SESSION['ZWII_CLASS'] = $lang;
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
|
Loading…
Reference in New Issue
Block a user