From 7d16e139036c165ae061d476cd28566091bcaaaa Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 6 Oct 2018 19:39:34 +0200 Subject: [PATCH] Image per pages, removed convert relative to absolute path, media manager improves --- bl-kernel/abstract/plugin.class.php | 4 +- bl-kernel/admin/controllers/dashboard.php | 6 ++ bl-kernel/admin/controllers/edit-content.php | 1 + bl-kernel/admin/controllers/new-content.php | 3 + bl-kernel/admin/themes/booty/html/media.php | 48 ++++++++--- bl-kernel/admin/views/new-content.php | 2 +- bl-kernel/ajax/generate-slug.php | 2 +- .../ajax/{list-files.php => list-images.php} | 25 ++++-- bl-kernel/ajax/upload-files.php | 50 ------------ bl-kernel/ajax/upload-images.php | 80 +++++++++++++++++++ bl-kernel/boot/init.php | 9 +++ bl-kernel/boot/variables.php | 37 +++------ bl-kernel/helpers/filesystem.class.php | 5 +- bl-kernel/js/variables.php | 1 - bl-kernel/pagex.class.php | 5 +- bl-kernel/site.class.php | 14 +++- bl-plugins/remote-content/plugin.php | 10 +-- bl-plugins/tinymce/plugin.php | 3 +- install.php | 9 ++- 19 files changed, 201 insertions(+), 113 deletions(-) rename bl-kernel/ajax/{list-files.php => list-images.php} (63%) delete mode 100644 bl-kernel/ajax/upload-files.php create mode 100644 bl-kernel/ajax/upload-images.php diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index 3eb8c782..1e726a45 100644 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -216,10 +216,10 @@ class Plugin { // Create workspace $workspace = $this->workspace(); - mkdir($workspace, 0755, true); + mkdir($workspace, DIR_PERMISSIONS, true); // Create plugin directory for the database - mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true); + mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, DIR_PERMISSIONS, true); $this->dbFields['position'] = $position; // Sanitize default values to store in the file diff --git a/bl-kernel/admin/controllers/dashboard.php b/bl-kernel/admin/controllers/dashboard.php index b924561d..cc1f72ca 100644 --- a/bl-kernel/admin/controllers/dashboard.php +++ b/bl-kernel/admin/controllers/dashboard.php @@ -22,6 +22,12 @@ function updateBludit() { } } + // Updates only for version less than Bludit v3.1 + if ($site->currentBuild()<'20180921') { + @mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true); + $site->set(array('imageRelativeToAbsolute'=>true, 'imageRestrict'=>false)); + } + // Set the current build number $site->set(array('currentBuild'=>BLUDIT_BUILD)); Log::set('UPDATE SYSTEM - Finished.'); diff --git a/bl-kernel/admin/controllers/edit-content.php b/bl-kernel/admin/controllers/edit-content.php index eae42488..0566ea95 100644 --- a/bl-kernel/admin/controllers/edit-content.php +++ b/bl-kernel/admin/controllers/edit-content.php @@ -64,6 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { try { $pageKey = $layout['parameters']; $page = new Page($pageKey); + $uuid = $page->uuid(); } catch (Exception $e) { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR); Redirect::page('content'); diff --git a/bl-kernel/admin/controllers/new-content.php b/bl-kernel/admin/controllers/new-content.php index fd119222..908a4d2a 100644 --- a/bl-kernel/admin/controllers/new-content.php +++ b/bl-kernel/admin/controllers/new-content.php @@ -32,5 +32,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Main after POST // ============================================================================ +// UUID of the page is need it for autosave and media manager +$uuid = $pages->generateUUID(); + // Title of the page $layout['title'] = $L->g('New content').' - '.$layout['title']; \ No newline at end of file diff --git a/bl-kernel/admin/themes/booty/html/media.php b/bl-kernel/admin/themes/booty/html/media.php index e2bab522..f18cba26 100644 --- a/bl-kernel/admin/themes/booty/html/media.php +++ b/bl-kernel/admin/themes/booty/html/media.php @@ -1,11 +1,20 @@
-
@@ -91,12 +99,15 @@ function displayFiles(files) { cleanFiles(); // Regenerate the table $.each(files, function(key, filename) { + var thumbnail = ""+filename; + var path = ""; + tableRow = ''+ - '200x200<\/td>'+ + '200x200<\/td>'+ ''+ '
'+filename+'<\/div>'+ '
'+ - '