From 65b95fb93fd76f20670e19a49aeac4273a200b2f Mon Sep 17 00:00:00 2001 From: Dimo Belov Date: Mon, 9 Jul 2018 16:57:50 +0300 Subject: [PATCH] Changes and bug fixes --- bl-kernel/abstract/dbjson.class.php | 2 +- bl-kernel/admin/themes/booty/html/media.php | 12 +++++++----- bl-kernel/ajax/list-files.php | 3 ++- bl-kernel/dbsite.class.php | 4 +++- bl-kernel/helpers/text.class.php | 3 ++- index.php | 2 ++ 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/bl-kernel/abstract/dbjson.class.php b/bl-kernel/abstract/dbjson.class.php index 55a269a5..17e30e2d 100644 --- a/bl-kernel/abstract/dbjson.class.php +++ b/bl-kernel/abstract/dbjson.class.php @@ -93,7 +93,7 @@ class dbJSON // Returns a JSON encoded string on success or FALSE on failure. private function serialize($data) { - return json_encode($data, JSON_PRETTY_PRINT); + return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } // Returns the value encoded in json in appropriate PHP type. diff --git a/bl-kernel/admin/themes/booty/html/media.php b/bl-kernel/admin/themes/booty/html/media.php index e6d0c265..f339f927 100644 --- a/bl-kernel/admin/themes/booty/html/media.php +++ b/bl-kernel/admin/themes/booty/html/media.php @@ -92,7 +92,8 @@ function displayFiles(files) { // Regenerate the table $.each(files, function(key, filename) { tableRow = ''+ - '200x200'+ + //do not need php here. we already have these variables declared in javascript above + '200x200'+ ''+ '
'+filename+'
'+ '
'+ @@ -108,10 +109,11 @@ function displayFiles(files) { // Get the list of files via AJAX, filter by the page number function getFiles(pageNumber) { - $.post("ajax/list-files", + $.post(HTML_PATH_ADMIN_ROOT+"ajax/list-files", { tokenCSRF: tokenCSRF, pageNumber: pageNumber, - path: "" + //ajax/list-files is changed + path: HTML_PATH_UPLOADS_THUMBNAILS }, function(data) { displayFiles(data.files); @@ -120,7 +122,7 @@ function getFiles(pageNumber) { // Delete the file and the thumbnail if exist function deleteMedia(filename) { - $.post("ajax/delete-file", + $.post(HTML_PATH_ADMIN_ROOT + "ajax/delete-file", { tokenCSRF: tokenCSRF, filename: filename }, @@ -145,7 +147,7 @@ $(document).ready(function() { // Check file type/extension ? $.ajax({ - url: "ajax/upload-files", + url: HTML_PATH_ADMIN_ROOT+"ajax/upload-files", type: "POST", data: new FormData($("#jsbluditFormUpload")[0]), cache: false, diff --git a/bl-kernel/ajax/list-files.php b/bl-kernel/ajax/list-files.php index 9276a8f8..95f44fd7 100644 --- a/bl-kernel/ajax/list-files.php +++ b/bl-kernel/ajax/list-files.php @@ -17,7 +17,8 @@ if ($path==false) { 'files'=>'Invalid path.' ))); } - +//absolute path +$path = PATH_ROOT.$path; // Get all files from the directory $path, also split the array by numberOfItems $listOfFilesByPage = Filesystem::listFiles($path, '*', '*', $GLOBALS['BLUDIT_MEDIA_MANAGER_SORT_BY_DATE'], $GLOBALS['BLUDIT_MEDIA_MANAGER_AMOUNT_OF_FILES']); diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index a0d0ced5..874c93d3 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -110,7 +110,9 @@ class dbSite extends dbJSON public function extremeFriendly() { - return $this->getField('extremeFriendly'); + //always true. value is string not bool. here i convert it to boolean + //return $this->getField('extremeFriendly'); + return filter_var($this->getField('extremeFriendly'), FILTER_VALIDATE_BOOLEAN); } public function twitter() diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index a300059b..cf9478a8 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -150,7 +150,8 @@ class Text { $string = trim($string, '-'); $string = self::lowercase($string); $string = preg_replace("/[\/_|+ -]+/", $separator, $string); - + //trim separator + $string = trim($string, $separator); return $string; } diff --git a/index.php b/index.php index 5f04e248..18c4a12e 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,8 @@ if (!file_exists('bl-content/databases/site.php')) { $base = dirname($_SERVER['SCRIPT_NAME']); $base = rtrim($base, '/'); + //fix for windows + $base = rtrim($base, '\\'); header('Location:'.$base.'/install.php'); exit('Install Bludit first.'); }