Skip to content

Commit

Permalink
Correctif insertion public
Browse files Browse the repository at this point in the history
  • Loading branch information
Gvx- committed Apr 7, 2020
1 parent 587b536 commit 748b044
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

Version 2.1.2 (2020-04-07)
--------------------------

* Correctif insertion cote public
* Sauvegarde settings

Version 2.1.1 (2020-04-04)
--------------------------

Expand Down
6 changes: 6 additions & 0 deletions dcScript/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

Version 2.1.2 (2020-04-07)
--------------------------

* Correctif insertion cote public
* Sauvegarde settings

Version 2.1.1 (2020-04-04)
--------------------------

Expand Down
6 changes: 3 additions & 3 deletions dcScript/_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
if (isset($_POST['save'])) {
try {
$core->dcScript->settings('enabled', !empty($_POST['enabled']), true);
$core->dcScript->settings('header_code_enabled', !empty($_POST['header_code_enabled']), true);
$core->dcScript->settings('footer_code_enabled', !empty($_POST['footer_code_enabled']), true);
$core->dcScript->settings('backup_ext', html::escapeHTML($_POST['backup']), true);
$core->dcScript->settings('header_code_enabled', !empty($_POST['header_code_enabled']), false);
$core->dcScript->settings('footer_code_enabled', !empty($_POST['footer_code_enabled']), false);
$core->dcScript->settings('backup_ext', html::escapeHTML($_POST['backup']), false);
$core->blog->triggerBlog();
dcPage::addSuccessNotice(__('Configuration successfully updated.'));
} catch(exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion dcScript/_define.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* Name */ 'dcScript',
/* Description*/ 'Add script for DC 2.8+',
/* Author */ 'Gvx',
/* Version */ '2.1.1',
/* Version */ '2.1.2',
array(
/* standard plugin options dotclear */
'permissions' => 'dcScript.edit'
Expand Down
4 changes: 2 additions & 2 deletions dcScript/inc/class.dcScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class dcScript extends dcPluginHelper024b {

public static function publicHeadContent($core, $_ctx) {
if(version_compare(PHP_VERSION, '7.2', '>=') && ($core->dcScript->settings('crypt_lib') != self::OPENSSL)) { return; }
$html = self::decrypt($core->dcScript->settings('header_code'), $core->dcScript->getCryptKey());
$html = self::decrypt($core->dcScript->settings('header_code'), $core->dcScript->getCryptKey(), $core->dcScript->settings('crypt_lib'));
if($core->dcScript->settings('enabled') && $core->dcScript->settings('header_code_enabled') && !empty($html)) {
echo "<!-- dcScript header begin -->\n".$html."\n<!-- dcScript header end -->\n";
}
}

public static function publicFooterContent($core, $_ctx) {
if(version_compare(PHP_VERSION, '7.2', '>=') && ($core->dcScript->settings('crypt_lib') != self::OPENSSL)) { return; }
$html = self::decrypt($core->dcScript->settings('footer_code'), $core->dcScript->getCryptKey());
$html = self::decrypt($core->dcScript->settings('footer_code'), $core->dcScript->getCryptKey(), $core->dcScript->settings('crypt_lib'));
if($core->dcScript->settings('enabled') && $core->dcScript->settings('footer_code_enabled') && !empty($html)) {
echo "<!-- dcScript footer begin -->\n".$html."\n<!-- dcScript footer end -->\n";
}
Expand Down
68 changes: 34 additions & 34 deletions dcScript/inc/index_warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@
* (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* -- END LICENSE BLOCK -----------------------------------------------------*/

(function (undefined) {
'use strict';
// -- INFORMATIONS BLOCK BEGIN ----------------------------------------------------
var informations = {
name: 'dcScriptIndexWarning',
description: 'dcScript for dotclear version 2.7+',
version: '0.1.0',
author: 'Gvx',
copyright: '© 2020 Gvx',
support: '',
license: 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html'
};
// -- INFORMATIONS BLOCK END ------------------------------------------------------
(function(undefined) {
'use strict';
// -- INFORMATIONS BLOCK BEGIN ----------------------------------------------------
var informations = {
name: 'dcScriptIndexWarning',
description: 'dcScript for dotclear version 2.7+',
version: '0.1.0',
author: 'Gvx',
copyright: '© 2020 Gvx',
support: '',
license: 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html'
};
// -- INFORMATIONS BLOCK END ------------------------------------------------------

function copy(element, button) {
if (element) {
var range = document.createRange();
var selection = window.getSelection();
range.selectNode(element);
selection.removeAllRanges();
selection.addRange(range);
if (button) { button.classList.remove('copy_done'); }
if (document.execCommand('copy')) {
if (button) { button.classList.add('copy_done'); }
} else {
console.log('Erreur de copie de "' + element.id + '"');
}
}
}
function copy(element, button) {
if (element) {
var range = document.createRange();
var selection = window.getSelection();
range.selectNode(element);
selection.removeAllRanges();
selection.addRange(range);
if (button) { button.classList.remove('copy_done'); }
if (document.execCommand('copy')) {
if (button) { button.classList.add('copy_done'); }
} else {
console.log('Erreur de copie de "' + element.id + '"');
}
}
}

document.addEventListener('DOMContentLoaded', function() {
document.getElementById('copy_key_crypt').addEventListener('click', function() { copy(document.getElementById('key_crypt'), this); });
document.getElementById('copy_header_code').addEventListener('click', function() { copy(document.getElementById('header_code'), this); });
document.getElementById('copy_footer_code').addEventListener('click', function() { copy(document.getElementById('footer_code'), this); });
});
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('copy_key_crypt').addEventListener('click', function() { copy(document.getElementById('key_crypt'), this); });
document.getElementById('copy_header_code').addEventListener('click', function() { copy(document.getElementById('header_code'), this); });
document.getElementById('copy_footer_code').addEventListener('click', function() { copy(document.getElementById('footer_code'), this); });
});

}());
}());

0 comments on commit 748b044

Please sign in to comment.