Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
qkqpttgf authored Mar 28, 2020
1 parent da012e8 commit 01ff467
Showing 1 changed file with 41 additions and 57 deletions.
98 changes: 41 additions & 57 deletions theme/ly_white.php
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -59,6 +59,7 @@
}
</style>
</head>

<body>
<div style="padding:1px">
<?php
Expand All @@ -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>
Expand All @@ -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
Expand All @@ -104,15 +105,28 @@
<?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>
</div>
</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">
Expand All @@ -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']) { ?>
Expand Down Expand Up @@ -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;?>">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
';
Expand Down Expand Up @@ -575,18 +560,24 @@ function setTime() {
<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/[email protected]/github-markdown.css">
<?php if (isset($files['children']['head.md'])||isset($files['children']['readme.md'])) { ?><link rel="stylesheet" href="//unpkg.zhimg.com/[email protected]/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/[email protected]/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) {
Expand All @@ -608,23 +599,6 @@ function path_format(path) {
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');
Expand Down Expand Up @@ -737,6 +711,16 @@ function renderpage(pdf,i)
}
<?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++) {
Expand Down Expand Up @@ -774,8 +758,7 @@ function CopyAllDownloadUrl(str) {
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) {
Expand Down Expand Up @@ -1068,6 +1051,7 @@ function readblob(start) {
//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();
Expand All @@ -1077,7 +1061,7 @@ function readblob(start) {
} 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']) { ?>
Expand Down

0 comments on commit 01ff467

Please sign in to comment.