diff --git a/bl-kernel/admin/views/content.php b/bl-kernel/admin/views/content.php
index 4d18589b..3459ec5e 100644
--- a/bl-kernel/admin/views/content.php
+++ b/bl-kernel/admin/views/content.php
@@ -84,7 +84,7 @@ echo '
if(Paginator::showPrev()) {
echo '
Previous';
} else {
- echo ' Previous';
+ echo ' '.$Language->g('Previous').'';
}
for($i=1; $i<=Paginator::amountOfPages(); $i++) {
@@ -93,7 +93,7 @@ echo '
// Show next page link
if(Paginator::showNext()) {
- echo 'Next ';
+ echo ''.$Language->g('Next').' ';
} else {
echo 'Next ';
}
diff --git a/bl-kernel/ajax/delete-file.php b/bl-kernel/ajax/delete-file.php
index a02b1c6c..fe0601f7 100644
--- a/bl-kernel/ajax/delete-file.php
+++ b/bl-kernel/ajax/delete-file.php
@@ -1,34 +1,36 @@
1, 'msg'=>'The filename is empty.') );
- exit;
+if (Text::isEmpty($filename)) {
+ exit (json_encode(array(
+ 'status'=>1,
+ 'message'=>'The filename is empty.'
+ )));
}
-// Check if the filename exist and Sanitize::pathFile it's necesary for security reasons.
-if( Sanitize::pathFile(PATH_UPLOADS.$filename) ) {
+// Check if the filename exist
+if (!Sanitize::pathFile(PATH_UPLOADS.$filename)) {
+ exit (json_encode(array(
+ 'status'=>1,
+ 'message'=>'The file does not exist.'
+ )));
+}
+// Delete the file
+Filesystem::rmfile(PATH_UPLOADS.$filename);
- // Delete the file.
- Filesystem::rmfile(PATH_UPLOADS.$filename);
-
- // Delete the thumnails.
+// Check if the file has a thumbnail
+if (Sanitize::pathFile(PATH_UPLOADS_THUMBNAILS.$filename)) {
+ // Delete the file
Filesystem::rmfile(PATH_UPLOADS_THUMBNAILS.$filename);
-
- echo json_encode( array('status'=>0, 'msg'=>'The file was deleted.') );
-
- exit;
}
-exit(json_encode(array(
- 'status'=>1,
- 'msg'=>'The file does not exist.'
+exit (json_encode(array(
+ 'status'=>0,
+ 'message'=>'File deleted.'
)));
?>
\ No newline at end of file
diff --git a/bl-kernel/ajax/slug.php b/bl-kernel/ajax/slug.php
index 8512074c..983def3b 100644
--- a/bl-kernel/ajax/slug.php
+++ b/bl-kernel/ajax/slug.php
@@ -7,11 +7,9 @@ $oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : '';
$slug = $dbPages->generateKey($text, $parent, $returnSlug=true, $oldKey);
-exit(json_encode(
- array(
- 'status'=>0,
- 'slug'=>$slug
- )
-));
+exit (json_encode(array(
+ 'status'=>0,
+ 'slug'=>$slug
+)));
?>
\ No newline at end of file
diff --git a/bl-kernel/ajax/uploader.php b/bl-kernel/ajax/uploader.php
index d671c98d..7ecf5e73 100644
--- a/bl-kernel/ajax/uploader.php
+++ b/bl-kernel/ajax/uploader.php
@@ -1,17 +1,13 @@
1,
- 'msg'=>'Invalid extension file.'
+ 'message'=>'Invalid extension file. Supported extensions:'.$validExtensionString
)));
}
-// Generate the next filename if the filename already exist.
+// Generate the next filename if the filename already exist
$tmpName = $filename.'.'.$fileExtension;
-if( file_exists(PATH_UPLOADS.$tmpName) )
-{
+if (Sanitize::pathFile(PATH_UPLOADS.$tmpName)) {
$number = 0;
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
- while(file_exists(PATH_UPLOADS.$tmpName)) {
+ while (Sanitize::pathFile(PATH_UPLOADS.$tmpName)) {
$number++;
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
}
}
-// Move from temporary PHP folder to temporary Bludit folder.
-move_uploaded_file($source, PATH_TMP.'original'.'.'.$fileExtension);
+// Move from temporary PHP folder to temporary Bludit folder
+$originalFile = PATH_TMP.'original'.'.'.$fileExtension;
+move_uploaded_file($_FILES['files']['tmp_name'][0], $originalFile);
+
+// Returned variables
+$absoluteURL = '';
+$absoluteURLThumbnail = '';
+$absolutePath = '';
// --- PROFILE PICTURE ---
-if($type=='profilePicture')
-{
- // Resize and crop profile image.
+if ($type=='profilePicture') {
+ // Resize and crop profile image
$username = Sanitize::html($_POST['username']);
$tmpName = $username.'.png';
$Image = new Image();
- $Image->setImage(PATH_TMP.'original'.'.'.$fileExtension, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
+ $Image->setImage($originalFile, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
$Image->saveImage(PATH_UPLOADS_PROFILES.$tmpName, PROFILE_IMG_QUALITY, false, true);
+
+ // Paths
+ $absoluteURL = DOMAIN_UPLOADS_PROFILES.$tmpName;
+ $absoluteURLThumbnail = '';
+ $absolutePath = PATH_UPLOADS_PROFILES.$tmpName;
}
// --- OTHERS ---
else {
- // Generate the thumbnail
- $Image = new Image();
-
- //Handling all other formats than svg
- if (strcasecmp($fileExtension, 'svg') != 0) {
- $Image->setImage(PATH_TMP.'original'.'.'.$fileExtension, THUMBNAILS_WIDTH, THUMBNAILS_HEIGHT, 'crop');
+ // Exclude generate thumbnail for SVG format
+ if (strcasecmp($fileExtension, 'svg')!=0) {
+ // Generate the thumbnail
+ $Image = new Image();
+ $Image->setImage($originalFile, THUMBNAILS_WIDTH, THUMBNAILS_HEIGHT, 'crop');
$Image->saveImage(PATH_UPLOADS_THUMBNAILS.$tmpName, THUMBNAILS_QUALITY, true);
}
- // Move the original to the upload folder.
- rename(PATH_TMP.'original'.'.'.$fileExtension, PATH_UPLOADS.$tmpName);
+ // Move the original to the upload folder
+ rename($originalFile, PATH_UPLOADS.$tmpName);
- //If it is a svg file, just save a copy in thumbnail-folder
- if (strcasecmp($fileExtension, 'svg') == 0) {
+ // Generate a link to the SVG file and save on thumbnails folder
+ if (strcasecmp($fileExtension, 'svg')==0) {
symlink(PATH_UPLOADS.$tmpName, PATH_UPLOADS_THUMBNAILS.$tmpName);
}
+
+ // Paths
+ $absoluteURL = DOMAIN_UPLOADS.$tmpName;
+ $absoluteURLThumbnail = DOMAIN_UPLOADS_THUMBNAILS.$tmpName;
+ $absolutePath = PATH_UPLOADS.$tmpName;
}
-// Remove the Bludit temporary file.
-if(file_exists(PATH_TMP.'original'.'.'.$fileExtension)) {
- unlink(PATH_TMP.'original'.'.'.$fileExtension);
+// Remove the Bludit temporary file
+if (Sanitize::pathFile($originalFile)) {
+ unlink($originalFile);
}
-exit(json_encode(array(
+exit (json_encode(array(
'status'=>0,
- 'filename'=>$tmpName
+ 'message'=>'Image uploaded success.',
+ 'filename'=>$tmpName,
+ 'absoluteURL'=>$absoluteURL,
+ 'absoluteURLThumbnail'=>$absoluteURLThumbnail,
+ 'absolutePath'=>$absolutePath
)));
?>
\ No newline at end of file
diff --git a/bl-languages/en.json b/bl-languages/en.json
index 308dd81c..755ec072 100644
--- a/bl-languages/en.json
+++ b/bl-languages/en.json
@@ -226,5 +226,8 @@
"have-you-seen-my-ball": "Have you seen my ball?",
"pagebreak": "Page break",
"pages": "Pages",
- "this-plugin-may-not-be-supported-by-this-version-of-bludit": "This plugin may not be supported by this version of Bludit"
+ "this-plugin-may-not-be-supported-by-this-version-of-bludit": "This plugin may not be supported by this version of Bludit",
+ "previous": "Previous",
+ "previous-page": "Previous page",
+ "next-page": "Next page"
}
\ No newline at end of file