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') ?>
- p('Files & images') ?>
diff --git a/bl-kernel/admin/views/login.php b/bl-kernel/admin/views/login.php
index 82af8701..4080a627 100644
--- a/bl-kernel/admin/views/login.php
+++ b/bl-kernel/admin/views/login.php
@@ -24,9 +24,10 @@
});
-" />
+title() ?>
-echo ''.$site->title().'
';
+'login'));
@@ -60,7 +61,7 @@ echo Bootstrap::formOpen(array('name'=>'login'));
-
+
';
diff --git a/bl-kernel/admin/views/settings.php b/bl-kernel/admin/views/settings.php
index cb70af14..bb199b28 100644
--- a/bl-kernel/admin/views/settings.php
+++ b/bl-kernel/admin/views/settings.php
@@ -48,6 +48,12 @@
args[key] = value;
});
+ if (!isJson($('#customFields').val())) {
+ logs('Invalid JSON format for custom fields.');
+ showAlertError("p('Invalid JSON format for custom fields') ?>");
+ return false;
+ }
+
api.saveSettings(args).then(function(response) {
if (response.status == 0) {
logs('Settings saved.');
@@ -685,7 +691,8 @@
'value' => json_encode($site->customFields(), JSON_PRETTY_PRINT),
'tip' => $L->g('define-custom-fields-for-the-content'),
'rows' => 15,
- 'data' => array('save' => 'true')
+ 'data' => array('save' => 'true'),
+ 'disable-current-value' => false
));
?>
diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php
index 763d066c..d1b59436 100644
--- a/bl-kernel/boot/init.php
+++ b/bl-kernel/boot/init.php
@@ -7,17 +7,16 @@ define('BLUDIT_RELEASE_DATE', '2021-05-23');
define('BLUDIT_BUILD', '20210523');
// Debug mode
-// Change to FALSE, for prevent warning or errors on browser
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
- ini_set("display_errors", 0);
- ini_set('display_startup_errors',0);
+ // 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 | E_STRICT | E_NOTICE);
+ error_reporting(E_ALL);
}
// PHP paths
diff --git a/bl-kernel/helpers/bootstrap.class.php b/bl-kernel/helpers/bootstrap.class.php
index bc58b7d0..a4d78ce9 100644
--- a/bl-kernel/helpers/bootstrap.class.php
+++ b/bl-kernel/helpers/bootstrap.class.php
@@ -84,15 +84,30 @@ EOF;
$class = $class.' '.$args['class'];
}
- $html = '';
- if (!empty($args['label'])) {
- $html .= '
';
+ $tip = '';
+ if (!empty($args['tip'])) {
+ $tip = '
'.$args['tip'].'
';
}
- $html .= '