Compare commits
No commits in common. "d61216216a06d13cfbafc98477302aa9e931cb05" and "1381e4f7be42ecdf2748ed48fc8d464afef0419c" have entirely different histories.
d61216216a
...
1381e4f7be
|
@ -527,14 +527,12 @@ class FileController extends Controller
|
|||
$output=array();
|
||||
$directory=$request->request->get('directory');
|
||||
|
||||
|
||||
// Récupération du répertoire source et le nom du fichier
|
||||
$racine=$this->get('kernel')->getRootDir()."/../uploads/file";
|
||||
$directory = $request->request->get('directory');
|
||||
$dirsource = $request->request->get('dirsource');
|
||||
$namesource = $request->request->get('namesource');
|
||||
$dirdestination = $request->request->get('dirdestination');
|
||||
$namedestination = $request->request->get('namedestination');
|
||||
$dirsource =$request->request->get('dirsource');
|
||||
$namesource =$request->request->get('namesource');
|
||||
$dirdestination =$request->request->get('dirdestination');
|
||||
$namedestination =$request->request->get('namedestination');
|
||||
|
||||
|
||||
$canupdate =$this->getPermission($access,$directory);
|
||||
|
@ -543,19 +541,8 @@ class FileController extends Controller
|
|||
$fs = new Filesystem();
|
||||
|
||||
// Déplacer le fichier
|
||||
$urlsource=str_replace("//","/",$racine."/".$dirsource."/".$namesource);
|
||||
$urldestination=str_replace("//","/",$racine."/".$dirdestination."/".$namedestination);
|
||||
|
||||
// Controle de cohérance du déplacement
|
||||
$fgerror=false;
|
||||
if(empty($racine)) $fgerror=true;
|
||||
if(empty($dirsource)) $fgerror=true;
|
||||
if(empty($directory)) $fgerror=true;
|
||||
if($urlsource==$urldestination) $fgerror=true;
|
||||
if(stripos($urldestination,$urlsource)!==false) $fgerror=true;
|
||||
if($fgerror) return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||
|
||||
|
||||
$urlsource=$racine."/".$dirsource."/".$namesource;
|
||||
$urldestination=$racine."/".$dirdestination."/".$namedestination;
|
||||
if($fs->exists($urlsource)) {
|
||||
if(is_dir($urlsource)) {
|
||||
$fs->mirror($urlsource,$urldestination);
|
||||
|
|
|
@ -291,7 +291,6 @@
|
|||
});
|
||||
|
||||
|
||||
{% if canupdate and not fgtrash %}
|
||||
$('.file').on('dragstart', function (s) {
|
||||
dirsource=$(this).data("dir");
|
||||
namesource=$(this).data("name");
|
||||
|
@ -314,17 +313,11 @@
|
|||
dirdestination=$(this).data("dir")+"/"+$(this).data("name");
|
||||
namedestination=namesource;
|
||||
|
||||
urlsource=dirsource+"/"+namesource;
|
||||
urlsource=urlsource.replace("//","/");
|
||||
urldestination=dirdestination+"/"+namedestination;
|
||||
urldestination=urldestination.replace("//","/");
|
||||
|
||||
// Si la source est la meme que la destination on ne fait rien
|
||||
if(urlsource==urldestination) return false;
|
||||
|
||||
// Si la source est dans la destination on ne fait rien
|
||||
//if(urldestination.includes(urlsource)) return false;
|
||||
if(dirdestination+"/"+namedestination==dirsource+"/"+namesource) return false;
|
||||
|
||||
console.log(dirsource+"/"+namesource);
|
||||
console.log(dirdestination+"/"+namedestination);
|
||||
// On déplace l'element
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
|
@ -343,9 +336,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
@ -371,7 +366,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
{% if canupdate %}
|
||||
// Trasher un fichier
|
||||
function trashFile(directory,subdirectory,filename) {
|
||||
var r = confirm("Confirmez-vous la mise à la poubelle de ce fichier ? Vous pourrez le récupèrer si besoin.");
|
||||
|
@ -428,7 +422,6 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
// Affichage des frames associés aux items de bureau
|
||||
|
|
Loading…
Reference in New Issue