Security fixes
This commit is contained in:
parent
3843d3ab27
commit
c24a10a0c8
|
@ -26,6 +26,9 @@ if( Sanitize::pathFile(PATH_UPLOADS.$filename) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
echo json_encode( array('status'=>0, 'msg'=>'The file does not exist.') );
|
||||
exit(json_encode(array(
|
||||
'status'=>0,
|
||||
'msg'=>'The file does not exist.'
|
||||
)));
|
||||
|
||||
?>
|
|
@ -21,6 +21,9 @@ elseif( $_POST['type']==='post' ) {
|
|||
$slug = $dbPosts->generateKey($text, $key);
|
||||
}
|
||||
|
||||
echo json_encode( array('status'=>1, 'slug'=>$slug) );
|
||||
exit(json_encode(array(
|
||||
'status'=>1,
|
||||
'slug'=>$slug
|
||||
)));
|
||||
|
||||
?>
|
|
@ -18,6 +18,15 @@ $filename = pathinfo($filename, PATHINFO_FILENAME);
|
|||
$filename = Text::replace(' ', '', $filename);
|
||||
$filename = Text::replace('_', '', $filename);
|
||||
|
||||
// Check extension
|
||||
$validExtension = array('tiff', 'gif', 'png', 'jpg', 'jpeg', 'bmp');
|
||||
if( !in_array($fileExtension, $validExtension) ) {
|
||||
exit(json_encode(array(
|
||||
'status'=>1,
|
||||
'msg'=>'Invalid extension file.'
|
||||
)));
|
||||
}
|
||||
|
||||
// Generate the next filename if the filename already exist.
|
||||
$tmpName = $filename.'.'.$fileExtension;
|
||||
if( file_exists(PATH_UPLOADS.$tmpName) )
|
||||
|
|
|
@ -30,6 +30,9 @@ if( $layout['slug']==='ajax' )
|
|||
// Check if the user is loggued.
|
||||
if($Login->isLogged())
|
||||
{
|
||||
// Rules: Security check CSRF
|
||||
include(PATH_RULES.'99.security.php');
|
||||
|
||||
// Load the ajax file.
|
||||
if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') ) {
|
||||
include(PATH_AJAX.$layout['parameters'].'.php');
|
||||
|
|
Loading…
Reference in New Issue