Add files via upload

pull/41/head v2.1
qkqpttgf 2020-03-28 18:42:20 +08:00 committed by GitHub
parent da012e8009
commit 01ff467b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 57 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo $constStr['language']; ?>"> <html lang="<?php echo $constStr['language']; ?>">
<head> <head>
<title><?php echo $pretitle; if ($_SERVER['base_disk_path']!=$_SERVER['base_path']) echo ' - ' . getConfig('diskname');?> - <?php echo $_SERVER['sitename'];?></title> <title><?php echo $pretitle; if ($_SERVER['base_disk_path']!=$_SERVER['base_path']) { if (getConfig('diskname')!='') $diskname = getConfig('diskname'); else $diskname = $_SERVER['disktag']; echo ' - ' . $diskname; } ?> - <?php echo $_SERVER['sitename'];?></title>
<meta charset=utf-8> <meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge"> <meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1"> <meta name=viewport content="width=device-width,initial-scale=1">
@ -59,6 +59,7 @@
} }
</style> </style>
</head> </head>
<body> <body>
<div style="padding:1px"> <div style="padding:1px">
<?php <?php
@ -67,7 +68,6 @@
<a class="login" onclick="login();"><ion-icon name="log-in"></ion-icon><?php echo getconstStr('Login'); ?></a> <a class="login" onclick="login();"><ion-icon name="log-in"></ion-icon><?php echo getconstStr('Login'); ?></a>
<?php } <?php }
} else { ?> } else { ?>
&nbsp;
<li class="operate"><ion-icon name="construct"></ion-icon><?php echo getconstStr('Operate'); ?><ul> <li class="operate"><ion-icon name="construct"></ion-icon><?php echo getconstStr('Operate'); ?><ul>
<?php if (isset($files['folder'])) { ?> <?php if (isset($files['folder'])) { ?>
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><?php echo getconstStr('Create'); ?></a></li> <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><?php echo getconstStr('Create'); ?></a></li>
@ -79,6 +79,7 @@
</ul></li> </ul></li>
<?php <?php
} ?> } ?>
&nbsp;
<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)"> <select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
<option value="">Language</option> <option value="">Language</option>
<?php <?php
@ -104,7 +105,7 @@
<?php foreach ($disktags as $disk) { <?php foreach ($disktags as $disk) {
$diskname = getConfig('diskname', $disk); $diskname = getConfig('diskname', $disk);
if ($diskname=='') $diskname = $disk; if ($diskname=='') $diskname = $disk;
echo ' <a href="'.path_format($_SERVER['base_path'].'/'.$disk).'"'.($_SERVER['disktag']==$disk?' now':'').'>'.$diskname.'</a> echo ' <a href="'.path_format($_SERVER['base_path'].'/'.$disk.'/').'"'.($_SERVER['disktag']==$disk?' now':'').'>'.$diskname.'</a>
'; ';
} ?> } ?>
</div> </div>
@ -112,7 +113,20 @@
</div> </div>
</div> </div>
<?php } <?php }
if ($files) { ?> if ($files) {
if (isset($files['children']['head.md'])) { ?>
<div class="list-wrapper" id="head-div">
<div class="list-container">
<div class="list-header-container">
<div class="readme">
<div class="markdown-body" id="head">
<textarea id="head-md" style="display:none;"><?php echo fetch_files(spurlencode(path_format($path . '/head.md'),'/'))['content']['body']; ?></textarea>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="list-wrapper" id="list-div"> <div class="list-wrapper" id="list-div">
<div class="list-container"> <div class="list-container">
<div class="list-header-container"> <div class="list-header-container">
@ -136,8 +150,6 @@
</div> </div>
<div class="list-body-container"> <div class="list-body-container">
<?php <?php
$head = false;
$readme = false;
$pdfurl = false; $pdfurl = false;
$DPvideo = false; $DPvideo = false;
if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { ?> if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { ?>
@ -247,12 +259,6 @@
foreach ($files['children'] as $file) { foreach ($files['children'] as $file) {
// Files // Files
if (isset($file['file'])) { if (isset($file['file'])) {
if (strtolower($file['name']) === 'head.md') $head = $file;
if (strtolower($file['name']) === 'readme.md') $readme = $file;
if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) {
$html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body'];
return output($html,200);
}
if ($_SERVER['admin'] or !isHideFile($file['name'])) { if ($_SERVER['admin'] or !isHideFile($file['name'])) {
$filenum++; ?> $filenum++; ?>
<tr data-to id="tr<?php echo $filenum;?>"> <tr data-to id="tr<?php echo $filenum;?>">
@ -354,25 +360,7 @@
echo 'Unknown path or file.'; echo 'Unknown path or file.';
echo json_encode($files, JSON_PRETTY_PRINT); echo json_encode($files, JSON_PRETTY_PRINT);
} }
if ($head) { if (isset($files['children']['readme.md'])) {
echo '
</div>
</div>
</div>
<div class="list-wrapper" id="head-div">
<div class="list-container">
<div class="list-header-container">
<div class="readme">
<!--<svg class="octicon octicon-book" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
<span style="line-height: 16px;vertical-align: top;">'.$head['name'].'</span>-->
<div class="markdown-body" id="head">
<textarea id="head-md" style="display:none;">' . curl_request(fetch_files(spurlencode(path_format($path . '/' .$head['name']),'/'))['@microsoft.graph.downloadUrl'])['body'] . '
</textarea>
</div>
</div>
';
}
if ($readme) {
echo ' echo '
</div> </div>
</div> </div>
@ -381,11 +369,8 @@
<div class="list-container"> <div class="list-container">
<div class="list-header-container"> <div class="list-header-container">
<div class="readme"> <div class="readme">
<!--<svg class="octicon octicon-book" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
<span style="line-height: 16px;vertical-align: top;">'.$readme['name'].'</span>-->
<div class="markdown-body" id="readme"> <div class="markdown-body" id="readme">
<textarea id="readme-md" style="display:none;">' . curl_request(fetch_files(spurlencode(path_format($path . '/' .$readme['name']),'/'))['@microsoft.graph.downloadUrl'])['body'] . ' <textarea id="readme-md" style="display:none;">' . fetch_files(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body'] . '</textarea>
</textarea>
</div> </div>
</div> </div>
'; ';
@ -575,18 +560,24 @@ echo 'IPv4: ' ,$ip, "\n";
<center> <center>
<span id="clock"><span> <!--顶部span的id为clock--> <span id="clock"><span> <!--顶部span的id为clock-->
<div class="footer_copyright"> <div class="footer_copyright">
Copyright © 2019-2020 - <span id="footyear"></span>OneManager,Power_by_逸笙 <em> 主题归彼岸云端版权所有</em> Copyright © 2019-2020 - <span id="footyear"></span>OneManager Powered_by_逸笙 <em> 主题归彼岸云端版权所有</em>
</div> </div>
</center> </center>
&nbsp; &nbsp;
</body> </body>
<?php if ($files) { ?> <?php if ($files) { ?>
<?php if ($head||$readme) { ?><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <?php if (isset($files['children']['head.md'])||isset($files['children']['readme.md'])) { ?><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><?php } ?> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><?php } ?>
<?php if (isset($files['folder']) && $_SERVER['is_guestup_path'] && !$_SERVER['admin']) { ?><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><?php } ?> <?php if (isset($files['folder']) && $_SERVER['is_guestup_path'] && !$_SERVER['admin']) { ?><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><?php } ?>
<?php if ($pdfurl!='') { ?><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><?php } ?> <?php if ($pdfurl!='') { ?><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><?php } ?>
<?php } ?> <?php } ?>
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str)
{
if (str=='Language') str = '';
document.cookie='language='+str+'; path=/';
location.href = location.href;
}
<?php if ($files) { ?> <?php if ($files) { ?>
var root = '<?php echo $_SERVER["base_disk_path"]; ?>'; var root = '<?php echo $_SERVER["base_disk_path"]; ?>';
function path_format(path) { function path_format(path) {
@ -608,23 +599,6 @@ echo 'IPv4: ' ,$ip, "\n";
e.innerHTML += paths[paths.length - 1]; e.innerHTML += paths[paths.length - 1];
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '') e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
}); });
function changelanguage(str)
{
if (str=='Language') str = '';
document.cookie='language='+str+'; path=/';
location.href = location.href;
}
var $head = document.getElementById('head');
if ($head) {
document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
$head.innerHTML = marked(document.getElementById('head-md').innerText);
}
var $readme = document.getElementById('readme');
if ($readme) {
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
}
<?php <?php
if (isset($_GET['preview'])) { //is preview mode. 在预览时处理 ?> if (isset($_GET['preview'])) { //is preview mode. 在预览时处理 ?>
var $url = document.getElementById('url'); var $url = document.getElementById('url');
@ -737,6 +711,16 @@ echo 'IPv4: ' ,$ip, "\n";
} }
<?php } <?php }
} else { // view folder. 不预览,即浏览目录时?> } else { // view folder. 不预览,即浏览目录时?>
var $head = document.getElementById('head');
if ($head) {
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
$head.innerHTML = marked(document.getElementById('head-md').innerText);
}
var $readme = document.getElementById('readme');
if ($readme) {
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
}
function showthumbnails(obj) { function showthumbnails(obj) {
var files=document.getElementsByName('filelist'); var files=document.getElementsByName('filelist');
for ($i=0;$i<files.length;$i++) { for ($i=0;$i<files.length;$i++) {
@ -774,8 +758,7 @@ echo 'IPv4: ' ,$ip, "\n";
tmptextarea.select(); tmptextarea.select();
tmptextarea.setSelectionRange(0, tmptextarea.value.length); tmptextarea.setSelectionRange(0, tmptextarea.value.length);
document.execCommand("copy"); document.execCommand("copy");
alert(tmptextarea.innerHTML); alert(tmptextarea.innerHTML+'<?php echo getconstStr('Success'); ?>');
//alert('Success');
} }
var sort=0; var sort=0;
function sortby(string) { function sortby(string) {
@ -1068,6 +1051,7 @@ echo 'IPv4: ' ,$ip, "\n";
//window.open(lasturl); //window.open(lasturl);
document.getElementById('upfile_a_'+tdnum).href = lasturl; document.getElementById('upfile_a_'+tdnum).href = lasturl;
document.getElementById('upfile_a1_'+tdnum).href = filename; document.getElementById('upfile_a1_'+tdnum).href = filename;
document.getElementById('upfile_cpbt_'+tdnum).style.display = "";
} }
<?php } ?> <?php } ?>
EndTime=new Date(); EndTime=new Date();
@ -1077,7 +1061,7 @@ echo 'IPv4: ' ,$ip, "\n";
} else { } else {
MiddleStr += '<?php echo getconstStr('ThisTime').getconstStr('AverageSpeed'); ?>:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>'; MiddleStr += '<?php echo getconstStr('ThisTime').getconstStr('AverageSpeed'); ?>:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="'+response.name+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="'+response.name+'" id="upfile_a1_'+tdnum+'"></a><?php echo getconstStr('UploadComplete'); ?><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');"><?php echo getconstStr('CopyUrl'); ?></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<?php echo $_SERVER['base_disk_path']; ?>'+response.name+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<?php echo $_SERVER['base_disk_path']; ?>'+response.name+'" id="upfile_a1_'+tdnum+'"></a><?php echo getconstStr('UploadComplete'); ?><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <?php if (!$_SERVER['admin']) echo 'style="display:none"'; ?> ><?php echo getconstStr('CopyUrl'); ?></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
uploadbuttonshow(); uploadbuttonshow();
<?php if ($_SERVER['admin']) { ?> <?php if ($_SERVER['admin']) { ?>