@@ -1144,16 +1144,13 @@ public function moveUploadedDocument(array &$input, $filename)
11441144 is_writable (GLPI_UPLOAD_DIR )
11451145 && is_writable ($ fullpath )
11461146 ) { // Move if allowed
1147- if (self ::renameForce ($ fullpath , GLPI_DOC_DIR . "/ " . $ new_path )) {
1148- Session::addMessageAfterRedirect (__s ('Document move succeeded. ' ));
1149- } else {
1147+ if (!self ::renameForce ($ fullpath , GLPI_DOC_DIR . "/ " . $ new_path )) {
11501148 Session::addMessageAfterRedirect (__s ('File move failed. ' ), false , ERROR );
11511149 return false ;
11521150 }
11531151 } else { // Copy (will overwrite dest file is present)
11541152 try {
11551153 copy ($ fullpath , GLPI_DOC_DIR . "/ " . $ new_path );
1156- Session::addMessageAfterRedirect (__s ('Document copy succeeded. ' ));
11571154 } catch (FilesystemException $ e ) {
11581155 Session::addMessageAfterRedirect (__s ('File move failed ' ), false , ERROR );
11591156 return false ;
@@ -1265,7 +1262,6 @@ public static function moveDocument(array &$input, $filename)
12651262 // Copy (will overwrite dest file if present)
12661263 try {
12671264 copy ($ fullpath , GLPI_DOC_DIR . "/ " . $ new_path );
1268- Session::addMessageAfterRedirect (__s ('Document copy succeeded. ' ));
12691265 } catch (FilesystemException $ e ) {
12701266 Session::addMessageAfterRedirect (__s ('File move failed ' ), false , ERROR );
12711267 @unlink ($ fullpath );
@@ -1313,7 +1309,7 @@ public static function getUploadFileValidLocationName($dir, $sha1sum)
13131309 E_USER_WARNING
13141310 );
13151311 Session::addMessageAfterRedirect (
1316- __s ("Documents directory doesn't exist . " ),
1312+ __s ("An unexpected error occured . " ),
13171313 false ,
13181314 ERROR
13191315 );
@@ -1324,10 +1320,6 @@ public static function getUploadFileValidLocationName($dir, $sha1sum)
13241320 if (!is_dir (GLPI_DOC_DIR . "/ " . $ subdir )) {
13251321 try {
13261322 mkdir (GLPI_DOC_DIR . "/ " . $ subdir , 0o777 , true );
1327- Session::addMessageAfterRedirect (sprintf (
1328- __s ('Create the directory %s ' ),
1329- $ subdir
1330- ));
13311323 } catch (FilesystemException $ e ) {
13321324 //emtpy catch
13331325 }
@@ -1343,7 +1335,7 @@ public static function getUploadFileValidLocationName($dir, $sha1sum)
13431335 );
13441336 Session::addMessageAfterRedirect (
13451337 sprintf (
1346- __s ('Failed to create the directory %s. Verify that you have the correct permission ' ),
1338+ __s ('An unexpected error occured. ' ),
13471339 htmlescape ($ subdir )
13481340 ),
13491341 false ,
0 commit comments