minor fix for restricted images

This commit is contained in:
Diego Najar 2018-10-07 15:54:28 +02:00
parent 9c07ec4d61
commit 682dc5788f
7 changed files with 37 additions and 17 deletions

View File

@ -5,7 +5,12 @@
// ============================================================================ // ============================================================================
function updateBludit() { function updateBludit() {
global $site; global $site;
// Check if Bludit need to be update. // New installation
if ($site->currentBuild()==0) {
$site->set(array('currentBuild'=>BLUDIT_BUILD));
}
// Check if Bludit need to be update
if ( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) { if ( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) {
Log::set('UPDATE SYSTEM - Starting.'); Log::set('UPDATE SYSTEM - Starting.');

View File

@ -144,8 +144,9 @@ function deleteMedia(filename) {
} }
function setCoverImage(filename) { function setCoverImage(filename) {
var thumbnail = "<?php echo $thumbnailHTML; ?>"+filename;
$("#jscoverImage").val(filename); $("#jscoverImage").val(filename);
$("#jscoverImagePreview").attr("src", HTML_PATH_UPLOADS_THUMBNAILS+filename); $("#jscoverImagePreview").attr("src", thumbnail);
} }
$(document).ready(function() { $(document).ready(function() {

View File

@ -12,10 +12,11 @@ define('DEBUG_MODE', TRUE);
error_reporting(0); // Turn off all error reporting error_reporting(0); // Turn off all error reporting
if (DEBUG_MODE) { if (DEBUG_MODE) {
// Turn on all error reporting // Turn on all error reporting
ini_set("display_errors", 1); ini_set("display_errors", 0);
ini_set('display_startup_errors',1); ini_set('display_startup_errors',0);
ini_set("track_errors", 1); ini_set("track_errors", 1);
ini_set("html_errors", 1); ini_set("html_errors", 1);
ini_set('log_errors', 1);
error_reporting(E_ALL | E_STRICT | E_NOTICE); error_reporting(E_ALL | E_STRICT | E_NOTICE);
} }

View File

@ -279,29 +279,32 @@ class Page {
return json_encode($tmp); return json_encode($tmp);
} }
// Returns the file name, FALSE there isn't a cover image setted // Returns the endpoint of the coverimage, FALSE if the page doesn't have a cover image
// If the user defined an External Cover Image the complete URL is going to be returned // (boolean) $absolute, TRUE returns the complete URL, FALSE returns the filename
// (boolean) $absolute, TRUE returns the absolute path and file name, FALSE just the file name // If the user defined an external cover image the function returns it
public function coverImage($absolute=true) public function coverImage($absolute=true)
{ {
$fileName = $this->getValue('coverImage'); $filename = $this->getValue('coverImage');
if (empty($fileName)) { if (empty($filename)) {
return false; return false;
} }
// Check is external cover image // Check is external cover image
if (filter_var($fileName, FILTER_VALIDATE_URL)) { if (filter_var($filename, FILTER_VALIDATE_URL)) {
return $fileName; return $filename;
} }
if ($absolute) { if ($absolute) {
return DOMAIN_UPLOADS.$fileName; if (IMAGE_RESTRICT) {
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/'.$filename;
}
return DOMAIN_UPLOADS.$filename;
} }
return $fileName; return $filename;
} }
// Returns the absolute URL of the thumbnail of the cover image, FALSE if the page doen't have cover image // Returns the endpoint of the thumbnail cover image, FALSE if the page doesn't have a cover image
public function thumbCoverImage() public function thumbCoverImage()
{ {
$coverImageFilename = $this->coverImage(false); $coverImageFilename = $this->coverImage(false);
@ -314,6 +317,9 @@ class Page {
return $coverImageFilename; return $coverImageFilename;
} }
if (IMAGE_RESTRICT) {
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/thumbnails/'.$filename;
}
return DOMAIN_UPLOADS_THUMBNAILS.$coverImageFilename; return DOMAIN_UPLOADS_THUMBNAILS.$coverImageFilename;
} }

View File

@ -1,5 +1,5 @@
body { body {
padding: 10px 5%; padding: 10px 5% !important;
font-size: 16px; font-size: 16px;
} }

View File

@ -83,6 +83,12 @@ class pluginTinymce extends Plugin {
$lang = $L->currentLanguageShortVersion(); $lang = $L->currentLanguageShortVersion();
} }
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
$document_base_url = 'document_base_url: "'.DOMAIN_UPLOADS.'",';
} else {
$document_base_url = '';
}
$script = <<<EOF $script = <<<EOF
<script> <script>
@ -120,7 +126,7 @@ tinymce.init({
paste_as_text: true, paste_as_text: true,
relative_urls: true, relative_urls: true,
remove_script_host: false, remove_script_host: false,
document_base_url: DOMAIN_UPLOADS, $document_base_url
plugins: ["$plugins"], plugins: ["$plugins"],
toolbar1: "$toolbar1", toolbar1: "$toolbar1",
toolbar2: "$toolbar2", toolbar2: "$toolbar2",

View File

@ -54,6 +54,7 @@ define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS); define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS); define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
define('PATH_UPLOADS_THUMBNAILS',PATH_UPLOADS.'thumbnails'.DS); define('PATH_UPLOADS_THUMBNAILS',PATH_UPLOADS.'thumbnails'.DS);
define('PATH_UPLOADS_PAGES', PATH_UPLOADS.'pages'.DS);
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS); define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS); define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);