Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
3a9625e2
Commit
3a9625e2
authored
Jan 29, 2004
by
Kjartan Mannes
Browse files
- Fixing extension splitting (was using the first dot instead of the last one).
parent
c8daca07
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/file.inc
View file @
3a9625e2
...
...
@@ -115,6 +115,7 @@ function file_check_upload($source) {
*/
function
file_check_location
(
$source
,
$directory
=
0
)
{
$source
=
realpath
(
$source
);
$directory
=
realpath
(
$directory
);
if
(
$directory
&&
strpos
(
$source
,
$directory
)
!==
0
)
{
return
0
;
}
...
...
@@ -172,8 +173,9 @@ function file_copy(&$source, $dest = 0, $replace = 0) {
if
(
file_exists
(
$dest
)
&&
!
$replace
)
{
// Destination file already exists and we can't replace is so we try and
// and find a new filename.
list
(
$name
,
$ext
)
=
explode
(
'.'
,
$basename
,
2
);
$ext
=
$ext
?
".
$ext
"
:
''
;
$pos
=
strrpos
(
$basename
,
'.'
);
$name
=
substr
(
$basename
,
0
,
$pos
);
$ext
=
substr
(
$basename
,
$pos
);
$counter
=
0
;
do
{
$dest
=
$directory
.
FILE_SEPARATOR
.
$name
.
'_'
.
$counter
++
.
$ext
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment