added some comments

This commit is contained in:
Diego Najar 2019-05-27 19:41:46 +02:00
parent 0dc9904d62
commit 0d2c962da8
7 changed files with 40 additions and 32 deletions

View File

@ -5,7 +5,7 @@ header('Content-Type: application/json');
| Delete an image from a particular page
|
| @_POST['filename'] string Name of the file to delete
| @_POST['uuid'] string Page uuid
| @_POST['uuid'] string Page UUID
|
| @return array
*/

View File

@ -1,9 +1,22 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Generate an slug text for the URL
|
| @_POST['text'] string The text from where is generated the slug
| @_POST['parentKey'] string The parent key if the page has one
| @_POST['currentKey'] string The current page key
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
$text = isset($_POST['text']) ? $_POST['text'] : '';
$parent = isset($_POST['parentKey']) ? $_POST['parentKey'] : '';
$oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : '';
// ----------------------------------------------------------------------------
$slug = $pages->generateKey($text, $parent, $returnSlug=true, $oldKey);

View File

@ -1,6 +1,14 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Returns a list of pages are parent and match with the string in them titles
|
| @_POST['query'] string The string to search in the title of the pages
|
| @return array
*/
// $_GET
// ----------------------------------------------------------------------------
// (string) $_GET['query']

View File

@ -2,11 +2,11 @@
header('Content-Type: application/json');
/*
| List filename of image from a particular page
| Returns a list of images from a particular page
|
| @_POST['pageNumber'] int Page number for the paginator
| @_POST['path'] string Pre-defined name for the directory to read, its pre-defined to avoid security issues
| @_POST['uuid'] string Page uuid
| @_POST['uuid'] string Page UUID
|
| @return array
*/

View File

@ -1,6 +1,15 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Upload site logo
| The final filename is the site's name and the extension is the same as the file uploaded
|
| @_FILES['inputFile'] multipart/form-data File from form
|
| @return array
*/
if (!isset($_FILES['inputFile'])) {
ajaxResponse(1, 'Error trying to upload the site logo.');
}
@ -9,7 +18,9 @@ if (!isset($_FILES['inputFile'])) {
$fileExtension = Filesystem::extension($_FILES['inputFile']['name']);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, ALLOWED_IMG_EXTENSION) ) {
return false;
$message = 'File type is not supported. Allowed types: '.implode(', ',ALLOWED_IMG_EXTENSION);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Final filename

View File

@ -16,10 +16,10 @@ if (!isset($_FILES['profilePictureInputFile'])) {
}
// File extension
$allowedExtensions = array('gif', 'png', 'jpg', 'jpeg', 'svg');
$fileExtension = pathinfo($_FILES['profilePictureInputFile']['name'], PATHINFO_EXTENSION);
if (!in_array($fileExtension, $allowedExtensions) ) {
$message = 'File type is not supported. Allowed types: '.implode(', ',$allowedExtensions);
$fileExtension = Filesystem::extension($_FILES['profilePictureInputFile']['name']);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, ALLOWED_IMG_EXTENSION) ) {
$message = 'File type is not supported. Allowed types: '.implode(', ',ALLOWED_IMG_EXTENSION);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}

View File

@ -1,24 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
*
* This script check if the user is logged
*
*/
// Check UUID
if ($login->isLogged()) {
exit (json_encode(array(
'status'=>1,
'message'=>'The user is logged.'
)));
}
exit (json_encode(array(
'status'=>0,
'message'=>'The user is NOT logged.'
)));
?>