Some changes for last version

This commit is contained in:
Dimo Belov 2018-07-11 01:10:45 +03:00
parent d1d9e36a4e
commit da21429d07
9 changed files with 59 additions and 47 deletions

@ -99,12 +99,12 @@ class dbList extends dbJSON
public function edit($args) public function edit($args)
{ {
if (isset($this->db[$args['newKey']])) { if ( isset($this->db[$args['newKey']]) && ($args['newKey']!==$args['oldKey']) ) {
Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey']); Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey'], LOG_TYPE_WARN);
//this not allow to edit existing category return false;
//return false;
} }
$this->db[$args['newKey']]['name'] = $args['name']; $this->db[$args['newKey']]['name'] = $args['name'];
$this->db[$args['newKey']]['template'] = isset($args['template'])?$args['template']:''; $this->db[$args['newKey']]['template'] = isset($args['template'])?$args['template']:'';
$this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list']; $this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list'];

@ -12,10 +12,9 @@
<!-- CSS --> <!-- CSS -->
<?php <?php
echo Theme::bootstrapCSS(); echo Theme::bootstrapCSS();
echo Theme::css(array(
echo Bootstrap::css(array(
'bludit.css' 'bludit.css'
)); ), DOMAIN_ADMIN_THEME_CSS);
?> ?>
<!-- Javascript --> <!-- Javascript -->

@ -175,9 +175,10 @@
)); ));
?> ?>
</div> </div>
<!-- buttons visible on all tabs -->
<div class="form-group mt-2"> <div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary"> <button id="jsbuttonSave" type="button" class="btn btn-primary">
<?php echo $L->g('Publish') ?> <?php echo $L->g('Save') ?>
</button> </button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"> <button id="jsbuttonDraft" type="button" class="btn btn-secondary">
<?php echo $L->g('Save as draft') ?> <?php echo $L->g('Save as draft') ?>
@ -185,6 +186,11 @@
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"> <a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary">
<?php echo $L->g('Cancel') ?> <?php echo $L->g('Cancel') ?>
</a> </a>
<?php
if (count($page->children())===0) {
echo '<button id="jsbuttonDelete" type="button" class="btn btn-secondary">'.$L->g('Delete').'</button>';
}
?>
</div> </div>
<!-- Modal for Categories --> <!-- Modal for Categories -->
@ -281,9 +287,11 @@
}); });
}); });
</script> </script>
</form> </form>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -301,6 +309,13 @@ $(document).ready(function() {
$("#jsform").submit(); $("#jsform").submit();
}); });
// Button Delete
$("#jsbuttonDelete").on("click", function() {
$("#jsstatus").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
});
// External cover image // External cover image
$("#jsexternalCoverImage").change(function() { $("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() ); $("#jscoverImage").val( $(this).val() );
@ -312,15 +327,6 @@ $(document).ready(function() {
$("#jsstatus").val(status); $("#jsstatus").val(status);
}); });
// Generate slug when the user type the title
// $("#jstitle").keyup(function() {
// var text = $(this).val();
// var parent = $("#jsparent").val();
// var currentKey = "";
// var ajax = new bluditAjax();
// ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
// });
// Autosave interval // Autosave interval
setInterval(function() { setInterval(function() {
var uuid = $("#jsuuid").val(); var uuid = $("#jsuuid").val();
@ -371,8 +377,3 @@ $(document).ready(function() {
}); });
</script> </script>
<?php
// Include Bludit Media Manager
include(PATH_ADMIN_THEMES.'booty/html/media.php');
?>

@ -70,12 +70,6 @@
<textarea id="jseditor" style="display:none;"></textarea> <textarea id="jseditor" style="display:none;"></textarea>
</div> </div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
</div> </div>
<!-- TABS IMAGES --> <!-- TABS IMAGES -->
@ -198,6 +192,18 @@
)); ));
?> ?>
</div>
<!-- buttons visible on all tabs -->
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary">
<?php echo $L->g('Publish') ?>
</button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary">
<?php echo $L->g('Save as draft') ?>
</button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary">
<?php echo $L->g('Cancel') ?>
</a>
</div> </div>
<!-- Modal for Categories --> <!-- Modal for Categories -->

@ -5,8 +5,11 @@
If you are going to change some variable from here is recommended do it before the installation If you are going to change some variable from here is recommended do it before the installation
*/ */
// Log separator // Log
define('LOG_SEP', ' | '); define('LOG_SEP', ' | ');
define('LOG_TYPE_INFO', '[INFO]');
define('LOG_TYPE_WARN', '[WARN]');
define('LOG_TYPE_ERROR', '[ERROR]');
// Protecting against Symlink attacks // Protecting against Symlink attacks
define('CHECK_SYMBOLIC_LINKS', TRUE); define('CHECK_SYMBOLIC_LINKS', TRUE);

@ -92,6 +92,7 @@ class dbPages extends dbJSON
} }
// Set type of the page // Set type of the page
// may be not needed
if ($args['status']=='static') { if ($args['status']=='static') {
$args['type'] = 'static'; $args['type'] = 'static';
} }
@ -346,7 +347,8 @@ class dbPages extends dbJSON
{ {
$tmp = $this->db; $tmp = $this->db;
foreach ($tmp as $key=>$fields) { foreach ($tmp as $key=>$fields) {
if ($fields['status']!='published' || $fields['type'] != "") { // do not want sticky and static pages here
if ($fields['status']!='published' || !empty($fields['type'])) {
unset($tmp[$key]); unset($tmp[$key]);
} }
} }

@ -2,18 +2,20 @@
class Log { class Log {
public static function set($text, $type=0) public static function set($text, $type=LOG_TYPE_INFO)
{ {
$messageType = 0;
if (is_array($text) ) { if (is_array($text) ) {
error_log('------------------------', $type); error_log('------------------------', $messageType);
error_log('Array', $type); error_log('Array', $messageType);
error_log('------------------------', $type); error_log('------------------------', $messageType);
foreach ($text as $key=>$value) { foreach ($text as $key=>$value) {
error_log($key.'=>'.$value, $type); error_log($key.'=>'.$value, $messageType);
} }
error_log('------------------------', $type); error_log('------------------------', $messageType);
} }
error_log('('.BLUDIT_VERSION.') ('.$_SERVER['REQUEST_URI'].') '.$text, $type); error_log($type.' ['.BLUDIT_VERSION.'] ['.$_SERVER['REQUEST_URI'].'] '.$text, $messageType);
} }
} }

@ -147,11 +147,10 @@ class Text {
} }
$string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string); $string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string);
$string = trim($string, '-');
$string = self::lowercase($string); $string = self::lowercase($string);
$string = preg_replace("/[\/_|+ -]+/", $separator, $string); $string = preg_replace("/[\/_|+ -]+/", $separator, $string);
//trim separator $string = trim($string, '-');
$string = trim($string, $separator);
return $string; return $string;
} }