Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
0ef507ae
Commit
0ef507ae
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix rename of file to remove .noexe extension.
parent
abe736c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/comm/propal/document.php
+20
-19
20 additions, 19 deletions
htdocs/comm/propal/document.php
htdocs/core/actions_linkedfiles.inc.php
+14
-5
14 additions, 5 deletions
htdocs/core/actions_linkedfiles.inc.php
htdocs/core/lib/files.lib.php
+3
-3
3 additions, 3 deletions
htdocs/core/lib/files.lib.php
with
37 additions
and
27 deletions
htdocs/comm/propal/document.php
+
20
−
19
View file @
0ef507ae
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-20
09
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-20
17
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
...
...
@@ -63,17 +63,18 @@ if (! $sortfield) $sortfield="name";
$object
=
new
Propal
(
$db
);
$object
->
fetch
(
$id
,
$ref
);
if
(
$object
->
id
>
0
)
{
$object
->
fetch_thirdparty
();
$upload_dir
=
$conf
->
propal
->
dir_output
.
'/'
.
dol_sanitizeFileName
(
$object
->
ref
);
include_once
DOL_DOCUMENT_ROOT
.
'/core/actions_linkedfiles.inc.php'
;
}
/*
* Actions
*/
if
(
$object
->
id
>
0
)
{
$object
->
fetch_thirdparty
();
$upload_dir
=
$conf
->
propal
->
dir_output
.
'/'
.
dol_sanitizeFileName
(
$object
->
ref
);
include_once
DOL_DOCUMENT_ROOT
.
'/core/actions_linkedfiles.inc.php'
;
}
/*
...
...
@@ -101,10 +102,10 @@ if ($object->id > 0)
// Proposal card
$linkback
=
'<a href="'
.
DOL_URL_ROOT
.
'/comm/propal/list.php'
.
(
!
empty
(
$socid
)
?
'?socid='
.
$socid
:
''
)
.
'">'
.
$langs
->
trans
(
"BackToList"
)
.
'</a>'
;
$morehtmlref
=
'<div class="refidno">'
;
// Ref customer
$morehtmlref
.
=
$form
->
editfieldkey
(
"RefCustomer"
,
'ref_client'
,
$object
->
ref_client
,
$object
,
0
,
'string'
,
''
,
0
,
1
);
...
...
@@ -145,24 +146,24 @@ if ($object->id > 0)
}
}
$morehtmlref
.
=
'</div>'
;
dol_banner_tab
(
$object
,
'ref'
,
$linkback
,
1
,
'ref'
,
'ref'
,
$morehtmlref
);
print
'<div class="fichecenter">'
;
print
'<div class="underbanner clearboth"></div>'
;
print
'<table class="border" width="100%">'
;
// Files infos
print
'<tr><td class="titlefield">'
.
$langs
->
trans
(
"NbOfAttachedFiles"
)
.
'</td><td>'
.
count
(
$filearray
)
.
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"TotalSizeOfAttachedFiles"
)
.
'</td><td>'
.
$totalsize
.
' '
.
$langs
->
trans
(
"bytes"
)
.
'</td></tr>'
;
print
"</table>
\n
"
;
print
'</div>'
;
dol_fiche_end
();
$modulepart
=
'propal'
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/actions_linkedfiles.inc.php
+
14
−
5
View file @
0ef507ae
...
...
@@ -71,7 +71,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$ret
=
dol_delete_file
(
$file
,
0
,
0
,
0
,
$object
);
if
(
!
empty
(
$fileold
))
dol_delete_file
(
$fileold
,
0
,
0
,
0
,
$object
);
// Delete file using old path
// Si elle existe, on efface la vignette
if
(
preg_match
(
'/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i'
,
$file
,
$regs
))
{
...
...
@@ -150,19 +150,28 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave'))
{
$filenamefrom
=
dol_sanitizeFileName
(
GETPOST
(
'renamefilefrom'
));
$filenameto
=
dol_sanitizeFileName
(
GETPOST
(
'renamefileto'
));
// Security:
// Disallow file with some extensions. We rename them.
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
if
(
preg_match
(
'/\.htm|\.html|\.php|\.pl|\.cgi$/i'
,
$filenameto
)
&&
empty
(
$conf
->
global
->
MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED
))
{
$filenameto
.
=
'.noexe'
;
}
if
(
$filenamefrom
&&
$filenameto
)
{
$srcpath
=
$upload_dir
.
'/'
.
$filenamefrom
;
$destpath
=
$upload_dir
.
'/'
.
$filenameto
;
$result
=
dol_move
(
$srcpath
,
$destpath
);
if
(
$result
)
if
(
$result
)
{
$object
->
addThumbs
(
$destpath
);
// TODO Add revert function of addThumbs
//$object->delThumbs($srcpath);
setEventMessages
(
$langs
->
trans
(
"FileRenamed"
),
null
);
}
else
setEventMessages
(
$langs
->
trans
(
"ErrorFailToRenameFile"
,
$filenamefrom
,
$filenameto
),
null
,
'errors'
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/lib/files.lib.php
+
3
−
3
View file @
0ef507ae
...
...
@@ -634,9 +634,9 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
}
}
// Security:
// Disallow file with some extensions. We rename
d
them.
// Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la deman
de.
// Security:
// Disallow file with some extensions. We rename them.
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary co
de.
if
(
preg_match
(
'/\.htm|\.html|\.php|\.pl|\.cgi$/i'
,
$dest_file
)
&&
empty
(
$conf
->
global
->
MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED
))
{
$file_name
.
=
'.noexe'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment