View file aiv2 AutoIndex/panel/filemanager.extract.rar.php

File size: 1.75Kb
<?php
include ('../config.php');
$page='fm';
include ('session.php');
include ($config->real() . $config->header);
if(isset($_POST,$_POST['folder'],$_POST['file']) and is_file('../'.$config->filedir.$_POST['file']) and $func->ext($_POST['file'])=='rar'){

$rar_file = rar_open('../'.$config->filedir.$_POST['file']);
$list = rar_list($rar_file);
foreach($list as $file) {
$entry = rar_entry_get($rar_file, $file);
$entry->extract('../'.$config->filedir.$_POST['folder']);
}
rar_close($rar_file);
header('Location: filemanager.php?task=extrar&status=1&dir='.str_replace(basename($_POST['folder']),null,$_POST['folder']));
die();
}
?>
<?php
if($layout=='web'){?>
<div class="wrap">
<div style="float: left; width: 18%; margin-bottom: 5px;" class="container">
<?php include('sidebar.php'); ?>
</div>
<div style="float: right; width:80%;">
<?php
}?>
<div class="container"><div class="title">Extract RAR</div>
<?php if($layout=='web'){
echo '<div style="padding:5px;">';
}?>
<?php
if(function_exists('rar_open')):
?>
<form action="filemanager.extract.rar.php" method="POST">
<input name="file" type="hidden" value="<?php echo htmlspecialchars($_GET['file']); ?>" />
RaR File: <?php echo basename(htmlspecialchars($_GET['file'])); ?><br />
Folder To Extract to: <input name="folder" type="text" value="<?php echo str_replace('.rar',null,htmlspecialchars($_GET['file'])); ?>" />
<div style="text-align: center;"><input type="submit" value="Extract" /></div>
</form>
<?php else: ?>
Sorry, you dont have unRar Library!<br />
For more details: <a href="http://pecl.php.net/package/rar">http://pecl.php.net/package/rar</a>
<?php endif; ?>
</div>
<?php if($layout=='web'){
echo '</div></div></div>';
}
?>
<?php
include ($config->real() . $config->footer); ?>