From: vincent@cubedesigners.com Date: Fri, 16 Nov 2012 10:35:13 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=238900137817f927bc3b6d6aa0672f60dd803eb1;p=cubeextranet.git --- diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index 1b12d2f63..8fb73cc99 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -296,6 +296,33 @@ class commonAjax { $c->update('WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); } + public static function syncftp($args, &$x) { + commonDroits::min(5); + $u = parse_url('ftp://' . ltrim($_POST['dest'], '/')); + if (!isset($u['port'])) { + $u['port'] = '21'; + } + + $commandes = array( + 'set ftp:passive-mode ' . $_POST['mode'], + 'mkdir -p ' . $u['path'], + 'cd ' . $u['path'], + 'lcd ' . $_POST['source'], + 'mirror -Rve --parallel=5' + ); + + //$lftp->setManualArg( . '> mirror -Rv ' . $package); + + $lftp = new cubeCommandLine('lftp'); + $lftp->setArg('u', $u['user'] . ',' . $u['pass']); + $lftp->setArg('p', $u['port']); + $lftp->setArg('e', implode(';', $commandes)); + $lftp->setArg(null, $u['host']); + $lftp->execute(); + + $x->addValue('res', utf8_encode($lftp->output)); + } + } ?> \ No newline at end of file diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index b4005cde3..2654f2d82 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -623,6 +623,28 @@ class commonTools { exit; } + public static function syncftp() { + commonDroits::min(5); + global $core; + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res.='
'; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.='
' . __('Synchronisation FTP <-> Local') . '
Source (local)' . form::field('source', 40, 512) . '
Destination (distant)ftp://' . form::field('dest', 40, 512) . '
Mode' . form::combo('mode', array(__('Actif') => 'off', __('Passif') => 'on')) . '
Résultat' . form::textArea('res', 50, 20) . '
' . $core->typo->BoutonOK(__('Synchronisation')) . '
'; + $res.='
'; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + } ?> diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 5c7d65229..bcc5d3576 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -345,7 +345,6 @@ class wsAjax extends cubeAjax { 'mirror -Rve --parallel=5' ); - //$lftp->setManualArg( . '> mirror -Rv ' . $package); $lftp = new cubeCommandLine('lftp'); $lftp->setArg('u', $u['user'] . ',' . $u['pass']);