mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-10 21:26:35 +01:00
Made progress towards invalid character function
This commit is contained in:
parent
1c92f2ce31
commit
3841525525
@ -774,15 +774,16 @@ class Filemanager extends Common {
|
||||
* trying to rename or delete it, allow the actual file name.
|
||||
*/
|
||||
|
||||
echo var_dump( file_exists( $full_path ),($_GET['action'] == "modify"),($_GET['action'] == "delete" ), $path, $full_path );
|
||||
|
||||
if( file_exists( $full_path ) && ( $_GET['action'] == "modify" || $_GET['action'] == "delete" ) ) {
|
||||
|
||||
if( preg_match( '/[^A-Za-z0-9\-\._\/\ ]/', $path ) && ! ( $_GET['action'] == "modify" || $_GET['action'] == "delete" ) ) {
|
||||
|
||||
exit( '{"status":"error","message":"Error, the filename contains invalid characters, please either rename or delete it."}' );
|
||||
} elseif( preg_match( '/[^A-Za-z0-9\-\._\/\ ]/', $path ) && ( $_GET['action'] == "modify" || $_GET['action'] == "delete" ) ) {
|
||||
} else {
|
||||
|
||||
// Only allow certain characters in filenames
|
||||
$path = preg_replace( '/[^A-Za-z0-9\-\._\/\ ]/', '', $path );
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user