function tps_estimated($val_details)
{
    global $l;
    if ($val_details == "") {
        return;
    }
    /*********************************DETAIL SUR LE TEMPS APPROXIMATIF DE TELEDEPLOIEMENT*****************************************/
    //	$sql_config="select name,ivalue from config where name in ('DOWNLOAD_CYCLE_LATENCY',
    //					    'DOWNLOAD_PERIOD_LENGTH',
    //					    'DOWNLOAD_FRAG_LATENCY',
    //	    				'DOWNLOAD_PERIOD_LATENCY')";
    //	$res_config = mysql_query( $sql_config, $_SESSION['OCS']["readServer"] );
    //	while ($val_config = mysql_fetch_array( $res_config ))
    //	$config[$val_config['name']]=$val_config['ivalue'];
    looking4config();
    if ($val_details['priority'] == 0) {
        $val_details['priority'] = 1;
    }
    //dur�e compl�te d'un cycle en seconde
    $tps_cycle = $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_CYCLE_LATENCY'] * $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LENGTH'];
    //nbre de t�l�chargement de fragment par cycle
    $nb_frag_by_cycle = floor($_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LENGTH'] / $val_details['priority']);
    //nombre de cycles necessaires pour le t�l�chargement complet
    $nb_cycle_for_download = $val_details['fragments'] / $nb_frag_by_cycle;
    //temps dans le cycle
    $tps_cycle_for_download = $nb_cycle_for_download * $tps_cycle;
    //temps entre chaque fragment pour tous les cycles
    $tps_frag_latency = $nb_frag_by_cycle * $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_FRAG_LATENCY'] * $nb_cycle_for_download;
    //temps entre chaque p�riode
    $tps_period_latency = $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LATENCY'] * $nb_cycle_for_download;
    //ajout de la vitesse de t�l�chargement
    $download_speed = 25000;
    $tps_download_speed = $val_details['size'] / $download_speed;
    //temps total de t�l�chargement:
    $tps_total = $tps_cycle_for_download + $tps_frag_latency + $tps_period_latency + $tps_download_speed;
    $heure = floor($tps_total / 3600);
    $tps_total -= $heure * 3600;
    $minutes = floor($tps_total / 60);
    $tps_total -= $minutes * 60;
    $tps = $heure . "h " . $minutes . "min ";
    if ($heure == 0 and $minutes == 0) {
        $tps .= floor($tps_total) . " " . $l->g(511);
    }
    return $tps;
}
function tps_estimated($val_details)
{
    global $l;
    if ($val_details == "") {
        return;
    }
    /*********************************DETAIL SUR LE TEMPS APPROXIMATIF DE TELEDEPLOIEMENT*****************************************/
    looking4config();
    if ($val_details['priority'] == 0) {
        $val_details['priority'] = 1;
    }
    //durée complète d'un cycle en seconde
    $tps_cycle = $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_CYCLE_LATENCY'] * $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LENGTH'];
    //nbre de téléchargement de fragment par cycle
    $nb_frag_by_cycle = floor($_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LENGTH'] / $val_details['priority']);
    //nombre de cycles necessaires pour le téléchargement complet
    $nb_cycle_for_download = $val_details['fragments'] / $nb_frag_by_cycle;
    //temps dans le cycle
    $tps_cycle_for_download = $nb_cycle_for_download * $tps_cycle;
    //temps entre chaque fragment pour tous les cycles
    $tps_frag_latency = $nb_frag_by_cycle * $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_FRAG_LATENCY'] * $nb_cycle_for_download;
    //temps entre chaque période
    $tps_period_latency = $_SESSION['OCS']['CONFIG_DOWNLOAD']['DOWNLOAD_PERIOD_LATENCY'] * $nb_cycle_for_download;
    //ajout de la vitesse de téléchargement
    $download_speed = 25000;
    $tps_download_speed = $val_details['size'] / $download_speed;
    //temps total de téléchargement:
    $tps_total = $tps_cycle_for_download + $tps_frag_latency + $tps_period_latency + $tps_download_speed;
    $heure = floor($tps_total / 3600);
    $tps_total -= $heure * 3600;
    $minutes = floor($tps_total / 60);
    $tps_total -= $minutes * 60;
    $tps = $heure . "h " . $minutes . "min ";
    if ($heure == 0 and $minutes == 0) {
        $tps .= floor($tps_total) . " " . $l->g(511);
    }
    return $tps;
}
        rename($server_dir . $timestamp_redistrib . "/" . $timestamp_redistrib . "_redistrib.zip", $server_dir . $timestamp_redistrib . "/tmp");
        //create temp file
        $fSize = filesize($server_dir . $timestamp_redistrib . "/tmp");
        $sql_details = array('document_root' => $server_dir, 'timestamp' => $timestamp_redistrib, 'nbfrags' => $protectedPost['nbfrags_redistrib'], 'name' => $protectedPost['NAME'] . '_redistrib', 'os' => $protectedPost['OS'], 'description' => '[PACK REDISTRIBUTION ' . $protectedPost['timestamp'] . ']', 'size' => $fSize, 'id_wk' => $protectedPost['LIST_DDE_CREAT']);
        $info_details = array('PRI' => $protectedPost['REDISTRIB_PRIORITY'], 'ACT' => 'STORE', 'DIGEST' => $digest, 'PROTO' => $protectedPost['PROTOCOLE'], 'DIGEST_ALGO' => $protectedPost["digest_algo"], 'DIGEST_ENCODE' => $protectedPost["digest_encod"], 'PATH' => $protectedPost['DOWNLOAD_SERVER_DOCROOT'], 'NAME' => '', 'COMMAND' => '', 'NOTIFY_USER' => '0', 'NOTIFY_TEXT' => '', 'NOTIFY_COUNTDOWN' => '', 'NOTIFY_CAN_ABORT' => '0', 'NOTIFY_CAN_DELAY' => '0', 'NEED_DONE_ACTION' => '0', 'NEED_DONE_ACTION_TEXT' => '', 'GARDEFOU' => "rien");
        create_pack($sql_details, $info_details);
    }
    unset($protectedPost, $_SESSION['OCS']['DATA_CACHE']);
}
$lign_begin = "<tr height='30px' bgcolor='white'><td>";
$td_colspan2 = ":</td><td colspan='2'>";
$lign_end = "</td></tr>";
$form_name = "create_pack";
echo open_form($form_name, '', "enctype='multipart/form-data'");
if (isset($protectedPost['valid'])) {
    looking4config();
    $fSize = @filesize($_FILES["teledeploy_file"]["tmp_name"]);
    //file not exist
    if ($fSize <= 0) {
        if ($protectedPost['ACTION'] != 'EXECUTE') {
            $error = $l->g(436) . " " . $_FILES["teledeploy_file"]["tmp_name"];
        }
    } else {
        //is it a zip file or TAR.GZ file?
        $name_file_extention = explode('.', $_FILES["teledeploy_file"]["name"]);
        $extention = array_pop($name_file_extention);
        if (strtoupper($extention) != "ZIP" and strtoupper($extention) != "GZ") {
            $error = $l->g(1231);
            //ok
        } elseif (strtoupper($extention) == "GZ" and strtoupper(array_pop($name_file_extention)) != "TAR") {
            $error = $l->g(1232);