fix creating/moving/renaming/deleting files/dirs with ' in name

remotes/origin/stable
Bartek Przybylski 13 years ago
parent 15ea83834d
commit 3210fe2564
  1. 4
      files/ajax/delete.php
  2. 6
      files/ajax/move.php
  3. 6
      files/ajax/newfile.php
  4. 6
      files/ajax/newfolder.php
  5. 6
      files/ajax/rename.php
  6. 2
      files/index.php

@ -6,8 +6,8 @@ require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get data
$dir = $_GET["dir"];
$files = isset($_GET["file"]) ? $_GET["file"] : $_GET["files"];
$dir = stripslashes($_GET["dir"]);
$files = isset($_GET["file"]) ? stripslashes($_GET["file"]) : stripslashes($_GET["files"]);
$files = explode(';', $files);
$filesWithError = '';

@ -6,9 +6,9 @@ require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get data
$dir = $_GET["dir"];
$file = $_GET["file"];
$target = $_GET["target"];
$dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$target = stripslashes($_GET["target"]);
if(OC_Files::move($dir,$file,$target,$file)){

@ -6,8 +6,8 @@ require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get the params
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$filename = isset( $_GET['filename'] ) ? $_GET['filename'] : '';
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
$filename = isset( $_GET['filename'] ) ? stripslashes($_GET['filename']) : '';
$content = isset( $_GET['content'] ) ? $_GET['content'] : '';
if($filename == '') {
@ -24,4 +24,4 @@ if(OC_Files::newFile($dir, $filename, 'file')) {
}
OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));

@ -6,15 +6,15 @@ require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get the params
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : '';
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
$foldername = isset( $_GET['foldername'] ) ? stripslashes($_GET['foldername']) : '';
if(trim($foldername) == '') {
OC_JSON::error(array("data" => array( "message" => "Empty Foldername" )));
exit();
}
if(OC_Files::newFile($dir, $foldername, 'dir')) {
if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) {
OC_JSON::success(array("data" => array()));
exit();
}

@ -6,9 +6,9 @@ require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get data
$dir = $_GET["dir"];
$file = $_GET["file"];
$newname = $_GET["newname"];
$dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$newname = stripslashes($_GET["newname"]);
// Delete
if( OC_Files::move( $dir, $file, $dir, $newname )) {

@ -38,7 +38,7 @@ if(!isset($_SESSION['timezone'])){
}
OC_App::setActiveNavigationEntry( "files_index" );
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if(!OC_Filesystem::is_dir($dir)) {
header("Location: ".$_SERVER['PHP_SELF']."");

Loading…
Cancel
Save