$xmlFilter->name = __('Liste d\'articles') . ' (*.xml)';
$xmlFilter->extensions = '*.xml';
+ $htmlFilter = new stdClass();
+ $htmlFilter->name = __('Fichier HTML') . ' (*.html)';
+ $htmlFilter->extensions = '*.html';
+
$imageFilter = new stdClass();
$imageFilter->name = __('Images') . ' (*.jpg, *.png)';
$imageFilter->extensions = '*.jpg;*.jpeg;*.png';
$this->fields['splashTarget'] = ['type' => 'combo', 'datas' => $target, 'default' => '_self', 'editable' => true, 'label' => __('Ouvrir le lien'), 'grade' => 3];
$this->fields['splashMinimalTime'] = ['type' => 'float', 'default' => '1', 'editable' => true, 'label' => __('Temps minimal d\'affichage'), 'grade' => 3];
- $this->forms['splash'] = ['label' => __('Ecran de chargement'), 'fieldsnames' => ['splashImage', 'splashURL','splashTarget', 'splashMinimalTime']];
+ $this->forms['splash'] = ['label' => __('Ecran de chargement'), 'fieldsnames' => ['splashImage', 'splashURL', 'splashTarget', 'splashMinimalTime']];
// Articles
$this->fields['articlesFile'] = ['type' => 'freefile', 'default' => '', 'editable' => true,
$this->fields['secureURL'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('URL de sécurisation'), 'grade' => 5, 'hint' => __('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication'));
$this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse"));
+ $this->fields['secureClientSidePassword'] = ['type' => 'freefile', 'label' => 'Sécurisation par mot de passe côté client', 'editable' => true, 'default' => '', 'grade' => 3, 'fileFilter' => $htmlFilter];
+ $this->fields['secureClientSidePasswordCredentials'] = ['type' => 'textarea', 'label' => 'Utilisateurs / mots de passe', 'editable' => true, 'default' => '', 'grade' => 3, 'hint' => 'Format user:password par ligne'];
$this->fields['preventRightClick'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Essayer d'empêcher le clic droit"), 'grade' => 1);
$this->fields['restrictPrint'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Restreindre l'impression"), 'grade' => 5);
$this->fields['restrictDownload'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Restreindre l'impression"), 'grade' => 5);
$this->fields['restrictSendBookmark'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Restreindre l'envoi de marques-pages"), 'grade' => 5);
$this->fields['restrictPrintDownload'] = ['type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Paramètre de l\'url permettant de désactiver la restriction (non vide pour activer les restrictions)'), 'grade' => 5, 'hint' => __("Ne pas indiquer le ?")];
$this->forms['secure'] = array('label' => __('Sécurisation'),
- 'fieldsnames' => array('secureURL', 'secureURLRedirect', '|', 'preventRightClick', '|', 'restrictPrintDownload', 'restrictPrint', 'restrictDownload', 'restrictSendBookmark'));
+ 'fieldsnames' => array('secureURL', 'secureURLRedirect', '|', 'secureClientSidePassword', 'secureClientSidePasswordCredentials', '|', 'preventRightClick', '|', 'restrictPrintDownload', 'restrictPrint', 'restrictDownload', 'restrictSendBookmark'));
$this->fields['home'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Accueil de l'interface multibrochure"), 'grade' => 5);
$this->fields['multilang'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Langues'), 'hint' => __('Code langue') . ',' . __('Code pays') . ',' . __('URL'));
// ],
'jquery' =>
['js/libs/jquery/jquery.min.js',
- 'js/libs/jquery/jquery.transform.js',
- 'js/libs/jquery/jquery.form.min.js',
- 'js/libs/jquery/jquery.mousewheel.min.js',
- 'js/libs/jquery/jquery.hashchange.min.js'
],
+ 'jquery-extra' => ['js/libs/jquery/jquery.transform.js',
+ 'js/libs/jquery/jquery.form.min.js',
+ 'js/libs/jquery/jquery.mousewheel.min.js',
+ 'js/libs/jquery/jquery.hashchange.min.js'],
'bluebird' => ['js/libs/bluebird.min.js'],
'screenfull' => ['js/libs/screenfull.min.js'],
'storage' => ['js/libs/storage.js',],
'hotkeys' => ['js/libs/hotkeys.min.js',],
+ 'forge' => ['js/libs/forge/forge-sha256.min.js',],
'perfectscrollbar' => ['js/libs/perfect-scrollbar/perfect-scrollbar.min.js',
'js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js'],
'mmenu' =>
$this->book->parametres->seoVersion = false;
}
+ $this->writeSecure();
$this->log('Copied assets');
$this->loadPlugins();
$this->log('Plugins loaded');
$this->log('Files Synced');
}
+ protected function writeSecure()
+ {
+ if ($this->book->parametres->secureClientSidePassword !== '') {
+ $credentials = CubeIT_Text::explodeNewLines($this->book->parametres->secureClientSidePasswordCredentials);
+ $users = [];
+ foreach ($credentials as $credential) {
+ $salt = bin2hex(random_bytes(5));
+ $e = explode(':', $credential);
+ if (count($e) <= 1) {
+ continue;
+ }
+ $users[$e[0]] = ['salt' => $salt, 'hash' => hash("sha256", $salt . '-' . $e[1])];
+ }
+
+ $secure = file_get_contents($this->wdir . '/' . $this->book->parametres->secureClientSidePassword);
+ $secure = str_replace('$CREDENTIALS', 'var CREDENTIALS=' . json_encode($users) . ';', $secure);
+ $this->vdir->file_put_contents('secure.html', $secure);
+
+ $this->config->secureClientSidePasswordCredentials = $users;
+ }
+ }
protected function loadPlugins()
{