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>
<html lang="<?php echo $constStr['language']; ?>">
<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 http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1">
@ -59,6 +59,7 @@
}
</style>
</head>
<body>
<div style="padding:1px">
<?php
@ -67,7 +68,6 @@
<a class="login" onclick="login();"><ion-icon name="log-in"></ion-icon><?php echo getconstStr('Login'); ?></a>
<?php }
} else { ?>
&nbsp;
<li class="operate"><ion-icon name="construct"></ion-icon><?php echo getconstStr('Operate'); ?><ul>
<?php if (isset($files['folder'])) { ?>
<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>
<?php
} ?>
&nbsp;
<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
<option value="">Language</option>
<?php
@ -104,7 +105,7 @@
<?php foreach ($disktags as $disk) {
$diskname = getConfig('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>
@ -112,7 +113,20 @@
</div>
</div>
<?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-container">
<div class="list-header-container">
@ -136,8 +150,6 @@
</div>
<div class="list-body-container">
<?php
$head = false;
$readme = false;
$pdfurl = false;
$DPvideo = false;
if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { ?>
@ -247,12 +259,6 @@
foreach ($files['children'] as $file) {
// Files
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'])) {
$filenum++; ?>
<tr data-to id="tr<?php echo $filenum;?>">
@ -354,25 +360,7 @@
echo 'Unknown path or file.';
echo json_encode($files, JSON_PRETTY_PRINT);
}
if ($head) {
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) {
if (isset($files['children']['readme.md'])) {
echo '
</div>
</div>
@ -381,11 +369,8 @@
<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;">'.$readme['name'].'</span>-->
<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>
<textarea id="readme-md" style="display:none;">' . fetch_files(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body'] . '</textarea>
</div>
</div>
';
@ -575,18 +560,24 @@ echo 'IPv4: ' ,$ip, "\n";
<center>
<span id="clock"><span> <!--顶部span的id为clock-->
<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>
</center>
&nbsp;
</body>
<?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 } ?>
<?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 } ?>
<script type="text/javascript">
function changelanguage(str)
{
if (str=='Language') str = '';
document.cookie='language='+str+'; path=/';
location.href = location.href;
}
<?php if ($files) { ?>
var root = '<?php echo $_SERVER["base_disk_path"]; ?>';
function path_format(path) {
@ -608,23 +599,6 @@ echo 'IPv4: ' ,$ip, "\n";
e.innerHTML += paths[paths.length - 1];
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
if (isset($_GET['preview'])) { //is preview mode. 在预览时处理 ?>
var $url = document.getElementById('url');
@ -737,6 +711,16 @@ echo 'IPv4: ' ,$ip, "\n";
}
<?php }
} 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) {
var files=document.getElementsByName('filelist');
for ($i=0;$i<files.length;$i++) {
@ -774,8 +758,7 @@ echo 'IPv4: ' ,$ip, "\n";
tmptextarea.select();
tmptextarea.setSelectionRange(0, tmptextarea.value.length);
document.execCommand("copy");
alert(tmptextarea.innerHTML);
//alert('Success');
alert(tmptextarea.innerHTML+'<?php echo getconstStr('Success'); ?>');
}
var sort=0;
function sortby(string) {
@ -1068,6 +1051,7 @@ echo 'IPv4: ' ,$ip, "\n";
//window.open(lasturl);
document.getElementById('upfile_a_'+tdnum).href = lasturl;
document.getElementById('upfile_a1_'+tdnum).href = filename;
document.getElementById('upfile_cpbt_'+tdnum).style.display = "";
}
<?php } ?>
EndTime=new Date();
@ -1077,7 +1061,7 @@ echo 'IPv4: ' ,$ip, "\n";
} else {
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;
uploadbuttonshow();
<?php if ($_SERVER['admin']) { ?>