From 0f622478710fd3ba55ba228d711c5f7638d06c79 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 3 May 2022 19:44:01 +0200 Subject: [PATCH 1/5] fix env variables for installer --- install.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 74b7e7c4..fa66707c 100644 --- a/install.php +++ b/install.php @@ -44,6 +44,31 @@ if ($modulesRequiredExit) { // Bludit constanst, variables, language and locale settings // ============================================================================ +// Bludit version +define('BLUDIT_VERSION', '4.0.0'); +define('BLUDIT_CODENAME', ''); +define('BLUDIT_RELEASE_DATE', '2021-05-23'); +define('BLUDIT_BUILD', '20210523'); + +// Log +define('LOG_SEP', ' | '); +define('LOG_TYPE_INFO', '[INFO]'); +define('LOG_TYPE_WARN', '[WARN]'); +define('LOG_TYPE_ERROR', '[ERROR]'); + +// Debug mode +define('DEBUG_MODE', TRUE); +define('DEBUG_TYPE', 'INFO'); // INFO, TRACE +error_reporting(0); // Turn off all error reporting +ini_set("display_errors", 0); // Turn off display errors in browser +ini_set('display_startup_errors', 0); +if (DEBUG_MODE) { + // Turn on all error reporting, will be display in log server + ini_set("html_errors", 1); + ini_set('log_errors', 1); + error_reporting(E_ALL); +} + // Security constant define('BLUDIT', true); @@ -70,7 +95,6 @@ define('PATH_ABSTRACT', PATH_KERNEL . 'abstract' . DS); // Protecting against Symlink attacks define('CHECK_SYMBOLIC_LINKS', TRUE); define('FILENAME', 'index.txt'); -define('LOG_SEP', ' | '); define('DB_DATE_FORMAT', 'Y-m-d H:i:s'); define('CHARSET', 'UTF-8'); define('DEFAULT_LANGUAGE_FILE', 'en.json'); From c8fa8d5dd60fca8cdf2089e0cd5c72bd1a0dd2be Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 3 May 2022 19:44:20 +0200 Subject: [PATCH 2/5] fix italian dictionary --- bl-languages/it_IT.json | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/bl-languages/it_IT.json b/bl-languages/it_IT.json index 43acc671..c572d879 100644 --- a/bl-languages/it_IT.json +++ b/bl-languages/it_IT.json @@ -3,7 +3,7 @@ "native": "Italiano (Italia)", "english-name": "Italian", "last-update": "2022-04-07", - "locale": "it, it_IT" + "locale": "it, it_IT", "authors": [ "Daniele La Pira https:\/\/github.com\/danielelapira", "Giuseppe Pignataro https:\/\/github.com\/fastbyte01", @@ -285,18 +285,6 @@ "there-are-no-sticky-pages-at-this-moment": "Non c'è nessuna pagina sticky in questo momento.", "there-are-no-scheduled-pages-at-this-moment": "Non c'è nessuna pagina programmata in questo momento.", "update": "Aggiorna", - - - - - - - - - - - - "template": "Template", "nickname": "Nickname", "disable-user": "Disabilita utente", @@ -308,7 +296,6 @@ "extreme-friendly-url": "URL estremamente friendly", "title-formats": "Formati titolo", "delete-content": "Elimina contenuto", - "sticky": "Sticky", "actions": "Azioni", "edit": "Modifica", @@ -335,8 +322,6 @@ "allow-unicode": "Permetti Unicode", "allow-unicode-characters-in-the-url-and-some-part-of-the-system": "Permette i caratteri Unicode nell'URL e in alcune parti del sistema.", "variables-allowed": "Variabili permesse", - - "tag": "Tag", "drag-and-drop-to-sort-the-plugins": "Sposta e trascina per ordinare i plugin.", "seo": "SEO", @@ -393,7 +378,7 @@ "custom-fields": "Campi personalizzati", "define-custom-fields-for-the-content": "Definisci campi personalizzati per il contenuto. Scopri di più sui campi personalizzati nella documentazione<\/a>.", "start-typing-to-see-a-list-of-suggestions": "Inizia a scrivere per vedere un elenco di suggerimenti.", - "view": "Visualizza" + "view": "Visualizza", "confirm": "Conferma", "current-password": "Password attuale", "are-you-sure-you-want-to-disable-this-user": "Sei sicuro di voler disabilitare questo utente?", From 66ff89c3ab8917207688ec4d1b8c823b0a63f768 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 3 May 2022 19:45:01 +0200 Subject: [PATCH 3/5] check json format for custom fields, add position menu for custom fields, fix issues with boolean types --- bl-kernel/admin/views/editor.php | 79 +++++++++++++++++++++++---- bl-kernel/admin/views/login.php | 7 ++- bl-kernel/admin/views/settings.php | 9 ++- bl-kernel/boot/init.php | 9 ++- bl-kernel/helpers/bootstrap.class.php | 41 ++++++++++---- bl-kernel/js/functions.js | 14 ++++- bl-kernel/pages.class.php | 17 +++--- 7 files changed, 135 insertions(+), 41 deletions(-) diff --git a/bl-kernel/admin/views/editor.php b/bl-kernel/admin/views/editor.php index a4b67003..a231ca69 100644 --- a/bl-kernel/admin/views/editor.php +++ b/bl-kernel/admin/views/editor.php @@ -131,12 +131,21 @@ // Ctrl+S or Command+S if ((event.ctrlKey || event.metaKey) && event.which == 83) { event.preventDefault(); + + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -186,12 +195,20 @@ }); $('#btnSave').on('click', function() { + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -383,13 +400,20 @@ return false; } + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -687,12 +711,12 @@ 'data' => array('field' => $field) )); } elseif ($options['type']=="bool") { - echo Bootstrap::formCheckbox(array( - 'name'=>'custom['.$field.']', - 'label'=>(isset($options['label'])?$options['label']:''), - 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), - 'checked'=>(($pageKey && $page->custom($field))?true:false), - 'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''), + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => (isset($options['label'])?$options['label']:''), + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?'true':'false'), + 'tip' => (isset($options['tip'])?$options['tip']:''), 'data' => array('field' => $field) )); } @@ -722,12 +746,12 @@ 'data' => array('field' => $field) )); } elseif ($options['type']=="bool") { - echo Bootstrap::formCheckbox(array( - 'name'=>'custom['.$field.']', - 'label'=>(isset($options['label'])?$options['label']:''), - 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), - 'checked'=>(($pageKey && $page->custom($field))?true:false), - 'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''), + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => (isset($options['label'])?$options['label']:''), + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?'true':'false'), + 'tip' => (isset($options['tip'])?$options['tip']:''), 'data' => array('field' => $field) )); } @@ -800,6 +824,37 @@ + + + customFields(); + foreach ($customFields as $field=>$options) { + if ( isset($options['position']) && ($options['position']=='menu') ) { + if ($options['type']=="string") { + echo '
'.(isset($options['label'])?$options['label']:'').'
'; + echo Bootstrap::formInputTextBlock(array( + 'name'=>'custom['.$field.']', + 'value'=>(($pageKey && $page->custom($field))?$page->custom($field):''), + 'tip'=>(isset($options['tip'])?$options['tip']:''), + 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), + 'class'=>'', + 'data' => array('field' => $field) + )); + } elseif ($options['type']=="bool") { + echo '
'.(isset($options['label'])?$options['label']:'').'
'; + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => '', + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?true:false), + 'tip' => (isset($options['tip'])?$options['tip']:''), + 'data' => array('field' => $field) + )); + } + } + } + ?> +
p('More options') ?>