Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
domainepublic
alternc
Commits
ca5137fc
Commit
ca5137fc
authored
Jan 22, 2008
by
Antoine Beaupré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorder CopyFile API so that it works like MoveFile (ie. support multiple files
parent
e47e12df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
bureau/class/m_bro.php
bureau/class/m_bro.php
+31
-8
No files found.
bureau/class/m_bro.php
View file @
ca5137fc
...
...
@@ -451,16 +451,45 @@ class m_bro {
}
/**
* Copy many files from point A to point B
*/
function
CopyFile
(
$d
,
$old
,
$new
)
{
global
$err
;
$old
=
$this
->
convertabsolute
(
$old
,
0
);
if
(
!
$old
)
{
$err
->
raise
(
"bro"
,
1
);
return
false
;
}
$new
=
$this
->
convertabsolute
(
$new
,
0
);
if
(
!
$new
)
{
$err
->
raise
(
"bro"
,
1
);
return
false
;
}
if
(
$old
==
$new
)
{
$err
->
raise
(
"bro"
,
2
);
return
false
;
}
for
(
$i
=
0
;
$i
<
count
(
$d
);
$i
++
)
{
$d
[
$i
]
=
ssla
(
$d
[
$i
]);
// strip slashes if needed
if
(
!
strpos
(
$d
[
$i
],
"/"
)
&&
file_exists
(
$old
.
"/"
.
$d
[
$i
])
&&
!
file_exists
(
$new
.
"/"
.
$d
[
$i
]))
{
$this
->
CopyOneFile
(
$old
.
"/"
.
$d
[
$i
],
$new
);
}
}
return
true
;
}
/**
* Copy a source to a destination by either copying recursively a
* directory or by downloading a file with a URL (only http:// is
* supported)
* @param string $name is the application name
* @param string $src is the path or URL
* @param string $dest is the absolute path inside the users directory
* @return boolean false on error
*
* Note that we assume that the inputs have been convertabsolute()'d
*/
function
CopyFile
(
$name
,
$src
,
$dest
)
function
Copy
One
File
(
$src
,
$dest
)
{
global
$err
;
...
...
@@ -520,12 +549,6 @@ class m_bro {
*/
// Last step // Copy -R
$src
=
$this
->
convertabsolute
(
$src
);
$dest
=
$this
->
convertabsolute
(
$dest
);
if
(
!
$src
||
!
$dest
)
{
$err
->
raise
(
"bro"
,
1
);
return
false
;
}
$src
=
escapeshellarg
(
$src
);
$dest
=
escapeshellarg
(
$dest
);
// TODO: write a recursive copy function(?)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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