Ejemplo n.º 1
0
function unrar_go_go()
{
    global $options, $list, $L;
    ?>
<script type="text/javascript">
/* <![CDATA[ */
function rar_st(elementid, st){
  document.getElementById(elementid).innerHTML = st;
  return true;
}
/* ]]> */
</script>
<?php 
    for ($i = 0; $i < count($_GET["files"]); $i++) {
        $file = $list[$_GET["files"][$i]];
        if (count($_GET['filestounrar'][$i]) == 0) {
            continue;
        }
        foreach ($_GET['filestounrar'][$i] as $rar_item) {
            flush();
            $rar = new rlRar($file["name"], $options['check_these_before_unzipping'] ? $options['forbidden_filetypes'] : array('.xxx'));
            if ($rar->rar_return === false) {
                ?>
<script type="text/javascript">rar_st('<?php 
                echo 'unrar' . $_GET["files"][$i] . '-' . str_replace('=', '-', $rar_item);
                ?>
', '<?php 
                echo $L->say['rar_disappear'];
                ?>
');</script>
<?php 
            } else {
                $rar_result = $rar->extract(base64_decode($rar_item), $options['download_dir'], $_GET['passwords'][$i], 'unrar' . $_GET["files"][$i] . '-' . str_replace('=', '-', $rar_item), $i);
                echo $rar_result;
                if (strpos($rar_result, ", 'OK')") !== false) {
                    _create_list();
                    $rar_tolist = realpath($options['download_dir']) . '/' . basename(base64_decode($rar_item));
                    $time = getNowzone(@filemtime($rar_tolist));
                    while (isset($list[$time])) {
                        $time++;
                    }
                    $list[$time] = array("name" => $rar_tolist, "size" => bytesToKbOrMbOrGb(filesize($rar_tolist)), "date" => $time);
                    if (!updateListInFile($list)) {
                        ?>
<script type="text/javascript">var tmp = document.getElementById('rar_finished'); tmp.innerHTML = "<?php 
                        echo $L->say['couldnt_upd_list'];
                        ?>
<br /><br />" + tmp.innerHTML</script>;
<?php 
                    }
                }
            }
        }
    }
    ?>
<script type="text/javascript">document.getElementById('unrar_finished').style.display = '';</script>
<?php 
}