Skip to content

Commit 78c2f67

Browse files
remicollettrasher
authored andcommitted
fix user pictures
1 parent e8497df commit 78c2f67

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

front/document.send.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@
6565
$send = false;
6666
if (($splitter[0] == "_dumps")
6767
&& Session::haveRight("backup", CREATE)) {
68-
$send = true;
68+
$send = GLPI_DUMP_DIR . '/' . $splitter[1];
6969
}
7070

7171
if ($splitter[0] == "_pictures") {
72-
if (Document::isImage(GLPI_DOC_DIR."/".$_GET['file'])) {
73-
$send = true;
72+
if (Document::isImage(GLPI_PICTURE_DIR . '/' . $splitter[1])) {
73+
$send = GLPI_PICTURE_DIR . '/' . $splitter[1];
7474
}
7575
}
7676

77-
if ($send && file_exists(GLPI_DOC_DIR."/".$_GET["file"])) {
78-
Toolbox::sendFile(GLPI_DOC_DIR."/".$_GET["file"], $splitter[1]);
77+
if ($send && file_exists($send)) {
78+
Toolbox::sendFile($send, $splitter[1]);
7979
} else {
8080
Html::displayErrorAndDie(__('Unauthorized access to this file'), true);
8181
}

inc/user.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function prepareInputForUpdate($input) {
733733
$extension = Toolbox::strtolower(array_pop($tmp));
734734
@mkdir(GLPI_PICTURE_DIR . "/$sub");
735735
$picture_path = GLPI_PICTURE_DIR . "/$sub/${filename}.$extension";
736-
self::dropPictureFiles($filename.".".$extension);
736+
self::dropPictureFiles("$sub/${filename}.$extension");
737737

738738
if (Document::isImage($fullpath)
739739
&& Document::renameForce($fullpath, $picture_path)) {
@@ -4747,7 +4747,7 @@ static function dropPictureFiles($picture) {
47474747
if (!empty($picture)) {
47484748
// unlink main file
47494749
if (file_exists(GLPI_PICTURE_DIR."/$picture")) {
4750-
@unlink(GLPI_DOC_DIR."/_pictures/$picture");
4750+
@unlink(GLPI_PICTURE_DIR."/$picture");
47514751
}
47524752
// unlink Thunmnail
47534753
$tmp = explode(".", $picture);

0 commit comments

Comments
 (0)