* Export centreon-syslog-server configuration file using SSH2
 * @param array $Syslog_options
 * @return string
 */
function sshExportConfFile($Syslog_options)
{
    global $tmp_file, $conf_file;
    $connection = ssh2_connect($Syslog_options["ssh_server_address"], $Syslog_options["ssh_server_port"], array('hostkey' => 'ssh-rsa'));
    if (!$connection) {
        $output = _("Unable to connect on distant server.");
        return $output;
    }
    if (strlen($Syslog_options["ssh_password"]) == 0) {
        $status = ssh2_auth_none($connection, $Syslog_options["ssh_username"]);
    } else {
        $status = ssh2_auth_password($connection, $Syslog_options["ssh_username"], $Syslog_options["ssh_password"]);
    }
    if (!$status) {
        $output = _("Authentification failed.");
        return $output;
    }
    $status = ssh2_scp_send($connection, $tmp_file, $Syslog_options["configuration_dir"] . "/" . $conf_file, 0664);
    if (!$status) {
        $output = _("Unable to export configuration file. Rights may be not correct on distant directory.");
        return $output;
    }
    return _("Configuration file exported successfully");
}
$Syslog_options = getSyslogOption($collector_id);
generateNewConfFile($Syslog_options);
echo "<root><status>" . exportConfFile($Syslog_options) . "</status></root>";
    header('Pragma: no-cache');
    header('Expires: 0');
    header('Cache-Control: no-cache, must-revalidate');
    $buffer = new SyslogXML();
    $buffer->startElement("error");
    $buffer->writeElement("msg", _("Please select a collector."));
    $buffer->endElement();
    $buffer->output();
    exit;
}
/*
 * Build SQL request
 */
$pearDB = new syslogDB("centreon");
$pearDB_syslog = new SyslogDB("syslog", $collector_id);
$cfg_syslog = getSyslogOption($collector_id);
$sql_filter = array();
if (isset($_GET['program']) && $_GET['program'] != "" && $_GET['program'] != "undefined") {
    array_push($sql_filter, " (program = '" . htmlentities($_GET['program'], ENT_QUOTES) . "') ");
}
if (isset($_GET['hostgroup']) && $_GET['hostgroup'] != "" && $_GET['hostgroup'] != "undefined") {
    array_push($sql_filter, " (host IN (" . getSyslogHostFromHostgroups($_GET['hostgroup']) . ")) ");
} else {
    if (isset($_GET['host']) && $_GET['host'] != "" && $_GET['host'] != "undefined") {
        array_push($sql_filter, " (host IN (" . getSyslogHostFromCentreon($_GET['host']) . ")) ");
    } else {
        if ($is_admin) {
            array_push($sql_filter, " (host IN (" . getFullSyslogHostFromCentreon($collector_id, $aclHostString) . ")) ");
        } else {
            array_push($sql_filter, " (host IN (" . getAllSyslogHostFromCentreon($collector_id, $aclHostString) . ")) ");
        }
require_once $syslog_mod_path . 'class/syslogDB.class.php';
require_once $syslog_mod_path . 'class/syslogXML.class.php';
require_once $syslog_mod_path . 'include/common/common-Func.php';
require_once $centreon_path . 'www/include/common/common-Func.php';
/*
 * Build PEAR DB object
 */
if (isset($_GET['collector']) && $_GET['collector'] != "") {
    $pearSyslogDB = new SyslogDB("syslog", $_GET['collector']);
} else {
    exit(1);
}
/*
 * Database retrieve information for Centreon-Syslog
 */
$cfg_syslog = getSyslogOption($_GET['collector']);
if (isset($_GET['type']) && $_GET['type'] != "") {
    $type = $_GET['type'];
}
/*
 * Get filters
 */
$sql_filter = array();
if (isset($_GET['program']) && $_GET['program'] != "") {
    array_push($sql_filter, " (program = '" . htmlentities($_GET['program'], ENT_QUOTES) . "')  ");
}
if (isset($_GET['host']) && $_GET['host'] != "") {
    array_push($sql_filter, " (host = '" . htmlentities($_GET['host'], ENT_QUOTES) . "')  ");
}
if (isset($_GET['facility']) && $_GET['facility'] != "") {
    if (strcmp($_GET['Ffacility'], "") == 0 || strcmp($_GET['Ffacility'], "eq") == 0) {