Improves on image uploader

This commit is contained in:
dignajar 2015-11-08 20:26:19 -03:00
parent de39deea01
commit b875b4870d
5 changed files with 19 additions and 16 deletions

View File

@ -103,6 +103,7 @@ button.delete-button:hover {
height: 400px; height: 400px;
} }
/* ----------- ALERT ----------- */ /* ----------- ALERT ----------- */
#alert { #alert {

View File

@ -159,6 +159,9 @@ class HTML {
$("#jsaddImage").on("click", function() { $("#jsaddImage").on("click", function() {
var filename = $("#jsimageList option:selected").text(); var filename = $("#jsimageList option:selected").text();
if(!filename.trim()) {
return false;
}
var textareaValue = $("#jscontent").val(); var textareaValue = $("#jscontent").val();
$("#jscontent").val(textareaValue + "<img src=\""+filename+"\" alt=\"\">" + "\n"); $("#jscontent").val(textareaValue + "<img src=\""+filename+"\" alt=\"\">" + "\n");
}); });
@ -187,6 +190,10 @@ class HTML {
bar.css("width", "100%").text("100%"); bar.css("width", "100%").text("100%");
setTimeout(function() { progressbar.addClass("uk-hidden"); }, 250); setTimeout(function() { progressbar.addClass("uk-hidden"); }, 250);
$("#jsimageList").prepend("<option value=\'"+response.filename+"\' selected=\'selected\'>"+response.filename+"</option>"); $("#jsimageList").prepend("<option value=\'"+response.filename+"\' selected=\'selected\'>"+response.filename+"</option>");
},
notallowed: function(file, settings) {
alert("'.$L->g('Supported image file types').' "+settings.allow);
} }
}; };

View File

@ -7,6 +7,11 @@
* Bludit is opensource software licensed under the MIT license. * Bludit is opensource software licensed under the MIT license.
*/ */
// Check PHP version
if(version_compare(phpversion(), '5.3', '<')) {
exit('Current PHP version '.phpversion().', you need > 5.3. (ERR_202)');
}
// Security constant // Security constant
define('BLUDIT', true); define('BLUDIT', true);
@ -139,19 +144,6 @@ function checkSystem()
$phpModules = get_loaded_extensions(); $phpModules = get_loaded_extensions();
} }
// If the php version is less than 5.3, then don't check others requirements.
if(!version_compare(phpversion(), '5.3', '>='))
{
$errorText = 'Current PHP version '.phpversion().', you need > 5.3. (ERR_202)';
error_log($errorText, 0);
$tmp['title'] = 'PHP version';
$tmp['errorText'] = $errorText;
array_push($stdOut, $tmp);
return $stdOut;
}
if(!file_exists(PATH_ROOT.'.htaccess')) if(!file_exists(PATH_ROOT.'.htaccess'))
{ {
$errorText = 'Missing file, upload the file .htaccess (ERR_201)'; $errorText = 'Missing file, upload the file .htaccess (ERR_201)';
@ -202,9 +194,8 @@ function install($adminPassword, $email, $timezoneOffset)
$stdOut = array(); $stdOut = array();
$timezone = timezone_name_from_abbr('', $timezoneOffset, 1); $timezone = timezone_name_from_abbr('', $timezoneOffset, 0);
if($timezone === false) { $timezone = timezone_name_from_abbr('', $timezoneOffset, 0); } // Workaround bug #44780 if($timezone === false) { $timezone = timezone_name_from_abbr('', $timezoneOffset, 0); } // Workaround bug #44780
date_default_timezone_set($timezone); date_default_timezone_set($timezone);
$currentDate = Date::current(DB_DATE_FORMAT); $currentDate = Date::current(DB_DATE_FORMAT);

View File

@ -203,5 +203,6 @@
"images": "Images", "images": "Images",
"upload-image": "Upload image", "upload-image": "Upload image",
"drag-and-drop-or-click-here": "Drag and drop or click here", "drag-and-drop-or-click-here": "Drag and drop or click here",
"insert-image": "Insert image" "insert-image": "Insert image",
"supported-image-file-types": "Supported image file types"
} }

View File

@ -97,6 +97,9 @@ class pluginsimpleMDE extends Plugin {
$html .= '$("#jsaddImage").on("click", function() { $html .= '$("#jsaddImage").on("click", function() {
var filename = $("#jsimageList option:selected" ).text(); var filename = $("#jsimageList option:selected" ).text();
if(!filename.trim()) {
return false;
}
var text = simplemde.value(); var text = simplemde.value();
simplemde.value(text + "![alt text]("+filename+")" + "\n"); simplemde.value(text + "![alt text]("+filename+")" + "\n");
});'; });';