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
87c590b8
Commit
87c590b8
authored
15 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
New: Add module FTP client
parent
0139ef6b
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/ftp/index.php
+46
-30
46 additions, 30 deletions
htdocs/ftp/index.php
htdocs/ftp/pre.inc.php
+14
-0
14 additions, 0 deletions
htdocs/ftp/pre.inc.php
htdocs/lib/functions.lib.php
+1
-0
1 addition, 0 deletions
htdocs/lib/functions.lib.php
with
61 additions
and
30 deletions
htdocs/ftp/index.php
+
46
−
30
View file @
87c590b8
...
...
@@ -62,10 +62,12 @@ $offset = $limit * $page ;
if
(
!
$sortorder
)
$sortorder
=
"ASC"
;
if
(
!
$sortfield
)
$sortfield
=
"label"
;
$s_ftp_name
=
'FTP_NAME_'
.
$numero_ftp
;
$s_ftp_server
=
'FTP_SERVER_'
.
$numero_ftp
;
$s_ftp_port
=
'FTP_PORT_'
.
$numero_ftp
;
$s_ftp_user
=
'FTP_USER_'
.
$numero_ftp
;
$s_ftp_password
=
'FTP_PASSWORD_'
.
$numero_ftp
;
$ftp_name
=
$conf
->
global
->
$s_ftp_name
;
$ftp_server
=
$conf
->
global
->
$s_ftp_server
;
$ftp_port
=
$conf
->
global
->
$s_ftp_port
;
$ftp_user
=
$conf
->
global
->
$s_ftp_user
;
...
...
@@ -319,7 +321,6 @@ $userstatic = new User($db);
print_fiche_titre
(
$langs
->
trans
(
"FTPArea"
));
print
$langs
->
trans
(
"FTPAreaDesc"
)
.
"<br>"
;
print
"<br>
\n
"
;
if
(
!
function_exists
(
'ftp_connect'
))
{
...
...
@@ -333,7 +334,7 @@ else
// Confirm remove file
if
(
$_GET
[
'action'
]
==
'delete'
)
{
$ret
=
$form
->
form_confirm
(
$_SERVER
[
"PHP_SELF"
]
.
'?section='
.
urlencode
(
$_REQUEST
[
"section"
])
.
'&file='
.
urlencode
(
$_GET
[
"file"
]),
$langs
->
trans
(
'DeleteFile'
),
$langs
->
trans
(
'ConfirmDeleteFile'
),
'confirm_deletefile'
,
''
,
''
,
1
);
$ret
=
$form
->
form_confirm
(
$_SERVER
[
"PHP_SELF"
]
.
'?
numero_ftp='
.
$numero_ftp
.
'&
section='
.
urlencode
(
$_REQUEST
[
"section"
])
.
'&file='
.
urlencode
(
$_GET
[
"file"
]),
$langs
->
trans
(
'DeleteFile'
),
$langs
->
trans
(
'ConfirmDeleteFile'
),
'confirm_deletefile'
,
''
,
''
,
1
);
if
(
$ret
==
'html'
)
print
'<br>'
;
}
...
...
@@ -343,7 +344,7 @@ else
// Confirmation de la suppression d'une ligne categorie
if
(
$_GET
[
'action'
]
==
'delete_section'
)
{
$ret
=
$form
->
form_confirm
(
$_SERVER
[
"PHP_SELF"
]
.
'?section='
.
urlencode
(
$_REQUEST
[
"section"
])
.
'&file='
.
urlencode
(
$_GET
[
"file"
]),
$langs
->
trans
(
'DeleteSection'
),
$langs
->
trans
(
'ConfirmDeleteSection'
,
$ecmdir
->
label
),
'confirm_deletesection'
,
''
,
''
,
1
);
$ret
=
$form
->
form_confirm
(
$_SERVER
[
"PHP_SELF"
]
.
'?
numero_ftp='
.
$numero_ftp
.
'&
section='
.
urlencode
(
$_REQUEST
[
"section"
])
.
'&file='
.
urlencode
(
$_GET
[
"file"
]),
$langs
->
trans
(
'DeleteSection'
),
$langs
->
trans
(
'ConfirmDeleteSection'
,
$ecmdir
->
label
),
'confirm_deletesection'
,
''
,
''
,
1
);
if
(
$ret
==
'html'
)
print
'<br>'
;
}
...
...
@@ -365,7 +366,7 @@ else
print
'<td class="liste_titre" align="center">'
.
$langs
->
trans
(
"Group"
)
.
'</td>'
.
"
\n
"
;
print
'<td class="liste_titre" align="center">'
.
$langs
->
trans
(
"Permissions"
)
.
'</td>'
.
"
\n
"
;
print
'<td class="liste_titre" align="right">'
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=refreshmanual
'
.
(
$section
?
'&
amp;
section='
.
urlencode
(
$section
)
:
''
)
.
'">'
.
img_picto
(
$langs
->
trans
(
"Refresh"
),
'refresh'
)
.
'</a> '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=refreshmanual
&numero_ftp='
.
$numero_ftp
.
(
$section
?
'§ion='
.
urlencode
(
$section
)
:
''
)
.
'">'
.
img_picto
(
$langs
->
trans
(
"Refresh"
),
'refresh'
)
.
'</a> '
;
print
'</td>'
.
"
\n
"
;
print
'</tr>'
.
"
\n
"
;
...
...
@@ -460,7 +461,7 @@ else
print
'<td align="right" width="64" nowrap="nowrap">'
;
if
(
$is_directory
)
{
if
(
$file
!=
'..'
)
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=delete_section§ion='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_delete
()
.
'</a>'
;
if
(
$file
!=
'..'
)
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=delete_section&
numero_ftp='
.
$numero_ftp
.
'&
section='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_delete
()
.
'</a>'
;
else
print
' '
;
}
else
if
(
$is_link
)
...
...
@@ -469,9 +470,9 @@ else
}
else
{
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=download§ion='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_file
()
.
'</a>'
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=download&
numero_ftp='
.
$numero_ftp
.
'&
section='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_file
()
.
'</a>'
;
print
' '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=delete§ion='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_delete
()
.
'</a>'
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=delete&
numero_ftp='
.
$numero_ftp
.
'&
section='
.
urlencode
(
$section
)
.
'&file='
.
urlencode
(
$file
)
.
'">'
.
img_delete
()
.
'</a>'
;
}
print
'</td>'
;
print
'</tr>'
.
"
\n
"
;
...
...
@@ -524,43 +525,58 @@ llxFooter('$Date$ - $Revision$');
*/
function
dol_ftp_connect
(
$ftp_server
,
$ftp_port
,
$ftp_user
,
$ftp_password
,
$section
)
{
global
$langs
;
$ok
=
1
;
$conn_id
=
ftp_connect
(
$ftp_server
,
$ftp_port
,
20
);
if
(
$conn_id
)
if
(
!
is_numeric
(
$ftp_port
))
{
// turn on passive mode transfers
//ftp_pasv ($conn_id, true) ;
$mesg
=
$langs
->
trans
(
"FailedToConnectToFTPServer"
,
$ftp_server
,
$ftp_port
);
$ok
=
0
;
}
if
(
$ftp_user
)
if
(
$ok
)
{
$conn_id
=
ftp_connect
(
$ftp_server
,
$ftp_port
,
20
);
if
(
$conn_id
)
{
if
(
ftp_login
(
$conn_id
,
$ftp_user
,
$ftp_password
))
{
// Change the dir
$newsectioniso
=
utf8_decode
(
$section
);
ftp_chdir
(
$conn_id
,
$newsectioniso
);
}
else
{
$mesg
=
$langs
->
trans
(
"FailedToConnectToFTPServerWithCredentials"
);
$ok
=
0
;
}
// turn on passive mode transfers
//ftp_pasv ($conn_id, true) ;
if
(
$ftp_user
)
{
if
(
ftp_login
(
$conn_id
,
$ftp_user
,
$ftp_password
))
{
// Change the dir
$newsectioniso
=
utf8_decode
(
$section
);
ftp_chdir
(
$conn_id
,
$newsectioniso
);
}
else
{
$mesg
=
$langs
->
trans
(
"FailedToConnectToFTPServerWithCredentials"
);
$ok
=
0
;
}
}
}
else
{
$mesg
=
$langs
->
trans
(
"FailedToConnectToFTPServer"
,
$ftp_server
,
$ftp_port
);
$ok
=
0
;
}
}
else
{
$mesg
=
$langs
->
trans
(
"FailedToConnectToFTPServer"
,
$ftp_server
,
$ftp_port
);
$ok
=
0
;
}
$arrayresult
=
array
(
'conn_id'
=>
$conn_id
,
'ok'
=>
$ok
,
'mesg'
=>
$mesg
);
return
$arrayresult
;
}
/**
*/
* Tell if an entry is a FTP directory
*
* @param unknown_type $connect_id
* @param unknown_type $dir
* @return unknown
*/
function
ftp_isdir
(
$connect_id
,
$dir
)
{
if
(
ftp_chdir
(
$connect_id
,
$dir
))
...
...
This diff is collapsed.
Click to expand it.
htdocs/ftp/pre.inc.php
+
14
−
0
View file @
87c590b8
...
...
@@ -36,6 +36,20 @@ function llxHeader($head = '', $title='', $help_url='', $morehtml='')
$menu
=
new
Menu
();
$MAXFTP
=
20
;
$i
=
1
;
while
(
$i
<=
$MAXFTP
)
{
$paramkey
=
'FTP_NAME_'
.
$i
;
//print $paramkey;
if
(
!
empty
(
$conf
->
global
->
$paramkey
))
{
$link
=
DOL_URL_ROOT
.
"/ftp/index.php?idmenu="
.
$_SESSION
[
"idmenu"
]
.
"&numero_ftp="
.
$i
;
$menu
->
add
(
$link
,
dol_trunc
(
$conf
->
global
->
$paramkey
,
24
));
}
$i
++
;
}
left_menu
(
$menu
->
liste
,
$help_url
,
$morehtml
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/functions.lib.php
+
1
−
0
View file @
87c590b8
...
...
@@ -927,6 +927,7 @@ function dolibarr_trunc($string,$size=40,$trunc='right',$stringencoding='')
* \param string String to truncate
* \param size Max string size. 0 for no limit.
* \param trunc Where to trunc: right, left, middle
* \param stringencoding Tell what is source string encoding
* \return string Truncated string
* \remarks USE_SHORT_TITLE=0 can disable all truncings
*/
...
...
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