update 2020.7.13

pull/216/head
BingoKingo 2020-07-13 20:07:31 +08:00
parent c8b8f7997c
commit abfe215999
16 changed files with 4975 additions and 344 deletions

View File

@ -5,10 +5,17 @@ $Base64Env = [
//'Region', // used in SCF.
//'SecretId', // used in SCF.
//'SecretKey', // used in SCF.
//'AccessKeyID', // used in FC.
//'AccessKeySecret', // used in FC.
//'HW_urn', // used in FG.
//'HW_key', // used in FG.
//'HW_secret', // used in FG.
//'admin',
//'adminloginpage',
'background',
'diskname',
//'disableShowThumb',
//'disableChangeTheme',
//'disktag',
//'downloadencrypt',
//'function_name', // used in heroku.
@ -18,6 +25,7 @@ $Base64Env = [
'sitename',
'customScript',
'customCss',
'customTheme',
//'theme',
//'Drive_ver',
//'Drive_custom',
@ -31,6 +39,7 @@ $Base64Env = [
//'sharecookie',
'shareapiurl',
//'siteid',
'domainforproxy',
'public_path',
//'refresh_token',
//'token_expires',
@ -41,10 +50,17 @@ $CommonEnv = [
'Region', // used in SCF.
'SecretId', // used in SCF.
'SecretKey', // used in SCF.
'AccessKeyID', // used in FC.
'AccessKeySecret', // used in FC.
'HW_urn', // used in FG.
'HW_key', // used in FG.
'HW_secret', // used in FG.
'admin',
'adminloginpage',
'background',
'disktag',
'disableShowThumb',
'disableChangeTheme',
'function_name', // used in heroku.
'hideFunctionalityFile',
'timezone',
@ -52,6 +68,7 @@ $CommonEnv = [
'sitename',
'customScript',
'customCss',
'customTheme',
'theme',
];
@ -60,10 +77,17 @@ $ShowedCommonEnv = [
//'Region', // used in SCF.
//'SecretId', // used in SCF.
//'SecretKey', // used in SCF.
//'AccessKeyID', // used in FC.
//'AccessKeySecret', // used in FC.
//'HW_urn', // used in FG.
//'HW_key', // used in FG.
//'HW_secret', // used in FG.
//'admin',
'adminloginpage',
'background',
//'disktag',
'disableShowThumb',
'disableChangeTheme',
//'function_name', // used in heroku.
'hideFunctionalityFile',
'timezone',
@ -71,6 +95,7 @@ $ShowedCommonEnv = [
'sitename',
'customScript',
'customCss',
'customTheme',
'theme',
];
@ -89,6 +114,7 @@ $InnerEnv = [
'shareurl',
//'sharecookie',
'shareapiurl',
'domainforproxy',
'public_path',
'refresh_token',
'token_expires',
@ -109,6 +135,7 @@ $ShowedInnerEnv = [
//'shareurl',
//'sharecookie',
//'shareapiurl',
'domainforproxy',
'public_path',
//'refresh_token',
//'token_expires',
@ -271,7 +298,8 @@ function main($path)
$oldname = spurlencode($_GET['filename']);
$pos = strrpos($oldname, '.');
if ($pos>0) $ext = strtolower(substr($oldname, $pos));
$oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname . '.scfupload' );
//$oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname . '.scfupload' );
$oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname);
$data = '{"name":"' . $_GET['filemd5'] . $ext . '"}';
//echo $oldname .'<br>'. $data;
$tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']);
@ -303,13 +331,17 @@ function main($path)
if (isset($_GET['thumbnails'])) {
if ($_SERVER['ishidden']<4) {
if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) {
return get_thumbnails_url($path);
return get_thumbnails_url($path, $_GET['location']);
} else return output(json_encode($exts['img']),400);
} else return output('',401);
}
$files = list_files($path);
//echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT);
if ($_GET['json']) {
// return a json
return files_json($files);
}
if (isset($_GET['random'])&&$_GET['random']!=='') {
if ($_SERVER['ishidden']<4) {
$tmp = [];
@ -318,14 +350,29 @@ function main($path)
}
$tmp = array_values($tmp);
if (count($tmp)>0) {
if (isset($_GET['url'])) return output($tmp[rand(0,count($tmp)-1)], 200);
return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]);
$url = $tmp[rand(0,count($tmp)-1)];
if (isset($_GET['url'])) return output($url, 200);
$domainforproxy = '';
$domainforproxy = getConfig('domainforproxy');
if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy);
}
return output('', 302, [ 'Location' => $url ]);
} else return output('',404);
} else return output('',401);
}
if (isset($files['file']) && !isset($_GET['preview'])) {
// is file && not preview mode
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files[$_SERVER['DownurlStrName']] ]);
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) {
$url = $files[$_SERVER['DownurlStrName']];
$domainforproxy = '';
$domainforproxy = getConfig('domainforproxy');
if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy);
}
if ( strtolower(splitlast($files['name'],'.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
else return output('', 302, [ 'Location' => $url ]);
}
}
if ( isset($files['folder']) || isset($files['file']) ) {
return render_list($path, $files);
@ -340,6 +387,54 @@ function main($path)
}
}
function proxy_replace_domain($url, $domainforproxy)
{
$tmp = splitfirst($url, '//');
$http = $tmp[0];
$tmp = splitfirst($tmp[1], '/');
$domain = $tmp[0];
$uri = $tmp[1];
if (substr($domainforproxy, 0, 7)=='http://' || substr($domainforproxy, 0, 8)=='https://') $aim = $domainforproxy;
else $aim = $http . '//' . $domainforproxy;
if (substr($aim, -1)=='/') $aim = substr($aim, 0, -1);
return $aim . '/' . $uri . '&Origindomain=' . $domain;
//$url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp;
}
function files_json($files)
{
//$tmp = '';
if (isset($files['file'])) {
$tmp['file']['type'] = 0;
$tmp['file']['id'] = $files['id'];
$tmp['file']['name'] = $files['name'];
$tmp['file']['time'] = $files['lastModifiedDateTime'];
$tmp['file']['size'] = $files['size'];
$tmp['file']['mime'] = $files['file']['mimeType'];
$tmp['file']['url'] = $files[$_SERVER['DownurlStrName']];
$tmp['url'] = $files[$_SERVER['DownurlStrName']];
} elseif (isset($files['folder'])) {
$tmp['list'] = [];
foreach ($files['children'] as $file) {
$tmp1 = null;
$tmp1 = [];
if (isset($file['file'])) {
$tmp1['type'] = 0;
$tmp1['url'] = $file[$_SERVER['DownurlStrName']];
} elseif (isset($file['folder'])) {
$tmp1['type'] = 1;
}
$tmp1['id'] = $file['id'];
$tmp1['name'] = $file['name'];
$tmp1['time'] = $file['lastModifiedDateTime'];
$tmp1['size'] = $file['size'];
$tmp1['mime'] = $file['file']['mimeType'];
array_push($tmp['list'], $tmp1);
}
} else return output('', 404);
return output(json_encode($tmp));
}
function get_access_token($refresh_token)
{
if (getConfig('Drive_ver')=='shareurl') {
@ -362,20 +457,29 @@ function get_access_token($refresh_token)
error_log('failed to get share access_token. response' . json_encode($ret));
throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
}
error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT));
$tmp = $ret;
$tmp['access_token'] = '******';
error_log('['.$_SERVER['disktag'].'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
savecache('access_token', $_SERVER['access_token']);
$tmp = [];
$tmp['shareapiurl'] = $_SERVER['api_url'];
if (getConfig('shareapiurl')=='') setConfig($tmp);
$tmp1 = [];
$tmp1['shareapiurl'] = $_SERVER['api_url'];
if (getConfig('shareapiurl')=='') setConfig($tmp1);
} else {
$response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token );
$p=0;
while ($response['stat']==0&&$p<3) {
$response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token );
$p++;
}
if ($response['stat']==200) $ret = json_decode($response['body'], true);
if (!isset($ret['access_token'])) {
error_log($_SERVER['oauth_url'] . 'token'.'?client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token);
error_log('failed to get access_token. response' . json_encode($ret));
throw new Exception($response['stat'].', failed to get access_token.'.$response['body']);
error_log($_SERVER['oauth_url'] . 'token'.'?client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . substr($refresh_token, 0, 20) . '******' . substr($refresh_token, -20));
error_log('failed to get ['.$_SERVER['disktag'].'] access_token. response' . json_encode($ret));
throw new Exception($response['stat'].', failed to get ['.$_SERVER['disktag'].'] access_token.'.$response['body']);
}
error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT));
$tmp = $ret;
$tmp['access_token'] = '******';
$tmp['refresh_token'] = '******';
error_log('['.$_SERVER['disktag'].'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
$_SERVER['access_token'] = $ret['access_token'];
savecache('access_token', $_SERVER['access_token'], $ret['expires_in'] - 300);
if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ]);
@ -775,23 +879,35 @@ function time_format($ISO)
return date('Y-m-d H:i:s',strtotime($ISO . " UTC"));
}
function get_thumbnails_url($path = '/')
function get_thumbnails_url($path = '/', $location = 0)
{
$path1 = path_format($path);
$path = path_format($_SERVER['list_path'] . path_format($path));
if ($path!='/'&&substr($path,-1)=='/') $path=substr($path,0,-1);
$thumb_url = getcache('thumb_'.$path);
if ($thumb_url!='') return output($thumb_url);
$url = $_SERVER['api_url'];
if ($path !== '/') {
$url .= ':' . $path;
if (substr($url,-1)=='/') $url=substr($url,0,-1);
if ($thumb_url=='') {
$url = $_SERVER['api_url'];
if ($path !== '/') {
$url .= ':' . $path;
if (substr($url,-1)=='/') $url=substr($url,0,-1);
}
$url .= ':/thumbnails/0/medium';
$files = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
if (isset($files['url'])) {
savecache('thumb_'.$path, $files['url']);
$thumb_url = $files['url'];
}
}
$url .= ':/thumbnails/0/medium';
$files = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
if (isset($files['url'])) {
savecache('thumb_'.$path, $files['url']);
return output($files['url']);
if ($thumb_url!='') {
if ($location) {
$url = $thumb_url;
$domainforproxy = '';
$domainforproxy = getConfig('domainforproxy');
if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy);
}
return output('', 302, [ 'Location' => $url ]);
} else return output($thumb_url);
}
return output('', 404);
}
@ -819,7 +935,7 @@ function bigfileupload($path)
$getoldupinfo = json_decode($getoldupinfo_j['body'], true);
if ( json_decode( curl_request($getoldupinfo['uploadUrl'])['body'], true)['@odata.context']!='' ) return output($getoldupinfo_j['body'], $getoldupinfo_j['stat']);
}
if (!$_SERVER['admin']) $filename = spurlencode( $fileinfo['name'] ) . '.scfupload';
//if (!$_SERVER['admin']) $filename = spurlencode( $fileinfo['name'] ) . '.scfupload';
$response=MSAPI('createUploadSession',path_format($path1 . '/' . $filename),'{"item": { "@microsoft.graph.conflictBehavior": "fail" }}',$_SERVER['access_token']);
$responsearry = json_decode($response['body'],true);
if (isset($responsearry['error'])) return output($response['body'], $response['stat']);
@ -987,6 +1103,7 @@ function adminoperate($path)
$path1 = path_format($_SERVER['list_path'] . path_format($path));
if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
savecache('path_' . $path1 . '/?password', '', 1);
savecache('customTheme', '', 1);
return message('<meta http-equiv="refresh" content="2;URL=./">', getconstStr('RefreshCache'), 302);
}
return $tmparr;
@ -1479,7 +1596,10 @@ function get_refresh_token()
}
}
}
document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/\';
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/; \'+expires;
return true;
}
</script>';
@ -1528,11 +1648,10 @@ function EnvOpt($needUpdate = 0)
}*/
$response = setConfigResponse( setConfig($tmp, $_SERVER['disk_oprating']) );
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
} else {
$html = api_error_msg($response);
$title = 'Error';
} else {
//WaitSCFStat();
//sleep(3);
$html .= getconstStr('Success') . '!<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
$title = getconstStr('Setup');
@ -1567,10 +1686,11 @@ function EnvOpt($needUpdate = 0)
}
$html .= '
</select>
'.getconstStr('EnvironmentsDescription')[$key].'
</td>
</tr>';
} elseif ($key=='theme') {
$theme_arr = scandir('theme');
$theme_arr = scandir(__DIR__.'/theme');
$html .= '
<tr>
<td><label>' . $key . '</label></td>
@ -1583,6 +1703,7 @@ function EnvOpt($needUpdate = 0)
}
$html .= '
</select>
'.getconstStr('EnvironmentsDescription')[$key].'
</td>
</tr>';
} /*elseif ($key=='domain_path') {
@ -1614,8 +1735,8 @@ function EnvOpt($needUpdate = 0)
<form action="" method="post">
<tr>
<td colspan="2">'.$disktag.'
<input type="hidden" name="disktag_del" value="'.$disktag.'">
<input type="submit" name="submit1" value="'.getconstStr('DelDisk').'">
<input type="hidden" name="disktag_del" value="'.$disktag.'">
<input type="submit" name="submit1" value="'.getconstStr('DelDisk').'">
</td>
</tr>
</form>';
@ -1633,6 +1754,11 @@ function EnvOpt($needUpdate = 0)
$html .= '
<tr><td><input type="submit" name="submit1" value="'.getconstStr('Setup').'"></td></tr>
</form>';
} else {
$html .= '
<tr>
<td colspan="2">Please add this disk again.</td>
</tr>';
}
$html .= '
</table><br>';
@ -1640,16 +1766,32 @@ function EnvOpt($needUpdate = 0)
}
$html .= '
<a href="?AddDisk">'.getconstStr('AddDisk').'</a><br><br>';
if (!((isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud')||(isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app'))) {
$canOneKeyUpate = 0;
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
$canOneKeyUpate = 1;
} elseif ($_SERVER['_APP_SHARE_DIR']==='/var/share/CFF/processrouter') {
$canOneKeyUpate = 1;
} else {
$tmp = time();
if ( mkdir(''.$tmp, 0777) ) {
rmdir(''.$tmp);
$canOneKeyUpate = 1;
}
}
if (!$canOneKeyUpate) {
$html .= '
'.getconstStr('VPSnotupdate').'<br>';
'.getconstStr('CannotOneKeyUpate').'<br>';
} else {
$html .= '
<form name="updateform" action="" method="post">
<input type="text" name="auth" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" placeholder="project" value="OneManager-php">
<button onclick="querybranchs();return false">'.getconstStr('QueryBranchs').'</button>
<!--<input type="text" name="branch" placeholder="branch" value="master">-->
<input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
<button name="QueryBranchs" onclick="querybranchs();return false">'.getconstStr('QueryBranchs').'</button>
<select name="branch">
<option value="master">master</option>
</select>
@ -1658,7 +1800,6 @@ function EnvOpt($needUpdate = 0)
<script>
function querybranchs()
{
//alert(document.updateform.auth.value);
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.github.com/repos/"+document.updateform.auth.value+"/"+document.updateform.project.value+"/branches");
//xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager");
@ -1668,10 +1809,10 @@ function EnvOpt($needUpdate = 0)
if (xhr.status==200) {
document.updateform.branch.options.length=0;
JSON.parse(xhr.responseText).forEach( function (e) {
//alert(e.name);
document.updateform.branch.options.add(new Option(e.name,e.name));
if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true;
});
document.updateform.QueryBranchs.style.display="none";
} else {
alert(xhr.responseText+"\n"+xhr.status);
}
@ -1687,9 +1828,9 @@ function EnvOpt($needUpdate = 0)
$html .= '<div style="position:relative;word-wrap: break-word;">
' . str_replace("\r", '<br>',$_SERVER['github_version']) . '
</div>';
} else {
}/* else {
$html .= getconstStr('NotNeedUpdate');
}
}*/
return message($html, getconstStr('Setup'));
}
@ -1747,18 +1888,39 @@ function render_list($path = '', $files = '')
OneManager: An index & manager of Onedrive auth by ysun.
Github: https://github.com/qkqpttgf/OneManager-php
-->';
//$authinfo = $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
$theme = getConfig('theme');
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.html';
if (isset($_COOKIE['theme'])&&$_COOKIE['theme']!='') $theme = $_COOKIE['theme'];
if ( !file_exists(__DIR__.'/theme/'.$theme) ) $theme = '';
if ( $theme=='' ) {
$tmp = getConfig('customTheme');
if ( $tmp!='' ) $theme = $tmp;
}
if ( $theme=='' ) {
$theme = getConfig('theme');
if ( $theme=='' || !file_exists(__DIR__.'/theme/'.$theme) ) $theme = 'classic.html';
}
if (substr($theme,-4)=='.php') {
@ob_start();
include 'theme/'.$theme;
$html = ob_get_clean();
} else {
$file_path = 'theme/'.$theme;
$fp = fopen($file_path,"r");
$html = fread($fp,filesize($file_path));
fclose($fp);
if (file_exists(__DIR__.'/theme/'.$theme)) {
$file_path = __DIR__.'/theme/'.$theme;
$html = file_get_contents($file_path);
} else {
if (!($html = getcache('customTheme'))) {
$file_path = $theme;
$tmp = curl_request($file_path, false, [], 1);
if ($tmp['stat']==302) {
error_log(json_encode($tmp));
$tmp = curl_request($tmp["returnhead"]["Location"]);
}
if (!!$tmp['body']) $html = $tmp['body'];
savecache('customTheme', $html, 9999);
}
}
$tmp = splitfirst($html, '<!--IconValuesStart-->');
$html = $tmp[0];
@ -1861,46 +2023,6 @@ function render_list($path = '', $files = '')
while (strpos($html, '<!--GuestEnd-->')) $html = str_replace('<!--GuestEnd-->', '', $html);
}
if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFileStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFileEnd-->');
$html .= $tmp[1];
}
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFolderStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFolderEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--EncryptedStart-->')) {
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--GuestUploadStart-->')) {
$html = str_replace('<!--GuestUploadStart-->', '', $html);
$html = str_replace('<!--GuestUploadEnd-->', '', $html);
}
}
if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&isset($files['folder'])&&$_SERVER['ishidden']<4 )) {
while (strpos($html, '<!--UploadJsStart-->')) {
$html = str_replace('<!--UploadJsStart-->', '', $html);
$html = str_replace('<!--UploadJsEnd-->', '', $html);
}
} else {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--UploadJsStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--UploadJsEnd-->');
$html .= $tmp[1];
}
}
if ($_SERVER['ishidden']==4) {
$tmp[1] = 'a';
while ($tmp[1]!='') {
@ -1941,9 +2063,143 @@ function render_list($path = '', $files = '')
$tmp = splitfirst($tmp[1], '<!--GuestUploadEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$tmp = splitfirst($html, '<!--IsNotHiddenStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsNotHiddenEnd-->');
$html .= $tmp[1];
}
} else {
while (strpos($html, '<!--EncryptedStart-->')) {
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$html = str_replace('<!--IsNotHiddenStart-->', '', $html);
$html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
}
}
if (isset($files['children'])) {
while (strpos($html, '<!--constStr@Download-->')) $html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html);
if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFileStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFileEnd-->');
$html .= $tmp[1];
}
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFolderStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFolderEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--GuestUploadStart-->')) {
$html = str_replace('<!--GuestUploadStart-->', '', $html);
$html = str_replace('<!--GuestUploadEnd-->', '', $html);
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$tmp = splitfirst($html, '<!--IsNotHiddenStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsNotHiddenEnd-->');
$html .= $tmp[1];
}
} else {
while (strpos($html, '<!--GuestUploadStart-->')) {
$tmp = splitfirst($html, '<!--GuestUploadStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--GuestUploadEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$html = str_replace('<!--IsNotHiddenStart-->', '', $html);
$html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
}
}
if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&isset($files['folder'])&&$_SERVER['ishidden']<4 )) {
while (strpos($html, '<!--UploadJsStart-->')) {
while (strpos($html, '<!--UploadJsStart-->')) $html = str_replace('<!--UploadJsStart-->', '', $html);
while (strpos($html, '<!--UploadJsEnd-->')) $html = str_replace('<!--UploadJsEnd-->', '', $html);
while (strpos($html, '<!--constStr@Calculate-->')) $html = str_replace('<!--constStr@Calculate-->', getconstStr('Calculate'), $html);
}
} else {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--UploadJsStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--UploadJsEnd-->');
$html .= $tmp[1];
}
}
if (isset($files['file'])) {
while (strpos($html, '<!--GuestUploadStart-->')) {
$tmp = splitfirst($html, '<!--GuestUploadStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--GuestUploadEnd-->');
$html .= $tmp[1];
}
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFolderStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFolderEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsFileStart-->')) {
$html = str_replace('<!--IsFileStart-->', '', $html);
$html = str_replace('<!--IsFileEnd-->', '', $html);
}
$html = str_replace('<!--FileEncodeUrl-->', str_replace('%2523', '%23', str_replace('%26amp%3B','&amp;',spurlencode(path_format($_SERVER['base_disk_path'] . '/' . $path), '/'))), $html);
$html = str_replace('<!--FileUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
$ext = strtolower(substr($path, strrpos($path, '.') + 1));
if (in_array($ext, $exts['img'])) $ext = 'img';
elseif (in_array($ext, $exts['video'])) $ext = 'video';
elseif (in_array($ext, $exts['music'])) $ext = 'music';
//elseif (in_array($ext, $exts['pdf'])) $ext = 'pdf';
elseif ($ext=='pdf') $ext = 'pdf';
elseif (in_array($ext, $exts['office'])) $ext = 'office';
elseif (in_array($ext, $exts['txt'])) $ext = 'txt';
else $ext = 'Other';
$previewext = ['img', 'video', 'music', 'pdf', 'office', 'txt', 'Other'];
$previewext = array_diff($previewext, [ $ext ]);
foreach ($previewext as $ext1) {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--Is'.$ext1.'FileStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--Is'.$ext1.'FileEnd-->');
$html .= $tmp[1];
}
}
while (strpos($html, '<!--Is'.$ext.'FileStart-->')) {
$html = str_replace('<!--Is'.$ext.'FileStart-->', '', $html);
$html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html);
}
//while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files[$_SERVER['DownurlStrName']], $html);
while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html);
$html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files[$_SERVER['DownurlStrName']]), $html);
$html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html);
$html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html);
$html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html);
while (strpos($html, '<!--TxtContent-->')) $html = str_replace('<!--TxtContent-->', htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']), $html);
$html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
//$html = str_replace('<!--constStr@File-->', getconstStr('File'), $html);
} elseif (isset($files['children'])) {
while (strpos($html, '<!--GuestUploadStart-->')) {
$tmp = splitfirst($html, '<!--GuestUploadStart-->');
$html = $tmp[0];
@ -2002,21 +2258,27 @@ function render_list($path = '', $files = '')
$filenum++;
$ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1));
$FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList);
$FolderListStr = str_replace('<!--FileExt-->', $ext, $FolderListStr);
if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('<!--FileExtType-->', 'audio', $FolderListStr);
elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('<!--FileExtType-->', 'iframe', $FolderListStr);
else $FolderListStr = str_replace('<!--FileExtType-->', '', $FolderListStr);
$FolderListStr = str_replace('<!--FileEncodeReplaceName-->', str_replace('&','&amp;', $file['name']), $FolderListStr);
//$FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . str_replace('&','&amp;', $file['name'])), $FolderListStr);
$FolderListStr = str_replace('<!--lastModifiedDateTime-->', time_format($file['lastModifiedDateTime']), $FolderListStr);
$FolderListStr = str_replace('<!--size-->', size_format($file['size']), $FolderListStr);
foreach ($IconValues as $key1 => $value1) {
if (isset($exts[$key1])&&in_array($ext, $exts[$key1])) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
if (!!$IconValues) {
foreach ($IconValues as $key1 => $value1) {
if (isset($exts[$key1])&&in_array($ext, $exts[$key1])) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
}
if ($ext==$key1) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
}
//error_log('file:'.$file['name'].':'.$key1);
if (!strpos($FolderListStr, '<!--IconValue-->')) break;
}
if ($ext==$key1) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
}
//error_log('file:'.$file['name'].':'.$key1);
if (!strpos($FolderListStr, '<!--IconValue-->')) break;
if (strpos($FolderListStr, '<!--IconValue-->')) $FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
}
if (strpos($FolderListStr, '<!--IconValue-->')) $FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
while (strpos($FolderListStr, '<!--filenum-->')) $FolderListStr = str_replace('<!--filenum-->', $filenum, $FolderListStr);
$html .= $FolderListStr;
}
@ -2077,6 +2339,8 @@ function render_list($path = '', $files = '')
}
$html .= $tmp[1];
while (strpos($html, '<!--MaxPageNum-->')) $html = str_replace('<!--MaxPageNum-->', $maxpage, $html);
} else {
while (strpos($html, '<!--MorePageStart-->')) {
$tmp = splitfirst($html, '<!--MorePageStart-->');
@ -2086,70 +2350,6 @@ function render_list($path = '', $files = '')
}
}
} elseif (isset($files['file'])) {
while (strpos($html, '<!--GuestUploadStart-->')) {
$tmp = splitfirst($html, '<!--GuestUploadStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--GuestUploadEnd-->');
$html .= $tmp[1];
}
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--IsFolderStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--IsFolderEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsFileStart-->')) {
$html = str_replace('<!--IsFileStart-->', '', $html);
$html = str_replace('<!--IsFileEnd-->', '', $html);
}
$html = str_replace('<!--FileEncodeUrl-->', str_replace('%2523', '%23', str_replace('%26amp%3B','&amp;',spurlencode(path_format($_SERVER['base_disk_path'] . '/' . $path), '/'))), $html);
$html = str_replace('<!--FileUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
$html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html);
$ext = strtolower(substr($path, strrpos($path, '.') + 1));
if (in_array($ext, $exts['img'])) $ext = 'img';
elseif (in_array($ext, $exts['video'])) $ext = 'video';
elseif (in_array($ext, $exts['music'])) $ext = 'music';
//elseif (in_array($ext, $exts['pdf'])) $ext = 'pdf';
elseif ($ext=='pdf') $ext = 'pdf';
elseif (in_array($ext, $exts['office'])) $ext = 'office';
elseif (in_array($ext, $exts['txt'])) $ext = 'txt';
else $ext = 'Other';
$previewext = ['img', 'video', 'music', 'pdf', 'office', 'txt', 'Other'];
$previewext = array_diff($previewext, [ $ext ]);
foreach ($previewext as $ext1) {
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--Is'.$ext1.'FileStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--Is'.$ext1.'FileEnd-->');
$html .= $tmp[1];
}
}
while (strpos($html, '<!--Is'.$ext.'FileStart-->')) {
$html = str_replace('<!--Is'.$ext.'FileStart-->', '', $html);
$html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html);
}
//while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files[$_SERVER['DownurlStrName']], $html);
while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html);
$html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files[$_SERVER['DownurlStrName']]), $html);
$html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html);
$html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html);
$html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html);
while (strpos($html, '<!--TxtContent-->')) $html = str_replace('<!--TxtContent-->', htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']), $html);
$html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
//$html = str_replace('<!--constStr@File-->', getconstStr('File'), $html);
}
$html = str_replace('<!--constStr@language-->', $constStr['language'], $html);
@ -2177,9 +2377,9 @@ function render_list($path = '', $files = '')
//$description .= 'In '.$_SERVER['sitename'];
$html = str_replace('<!--Description-->', $description, $html);
while (strpos($html, '<!--base_disk_path-->')) $html = str_replace('<!--base_disk_path-->', $_SERVER['base_disk_path'], $html);
while (strpos($html, '<!--base_disk_path-->')) $html = str_replace('<!--base_disk_path-->', (substr($_SERVER['base_disk_path'],-1)=='/'?substr($_SERVER['base_disk_path'],0,-1):$_SERVER['base_disk_path']), $html);
while (strpos($html, '<!--base_path-->')) $html = str_replace('<!--base_path-->', $_SERVER['base_path'], $html);
while (strpos($html, '<!--Path-->')) $html = str_replace('<!--Path-->', str_replace('%23', '#', str_replace('&','&amp;', $path)), $html);
while (strpos($html, '<!--Path-->')) $html = str_replace('<!--Path-->', str_replace('%23', '#', str_replace('&','&amp;', path_format($path.'/'))), $html);
while (strpos($html, '<!--constStr@Home-->')) $html = str_replace('<!--constStr@Home-->', getconstStr('Home'), $html);
$html = str_replace('<!--customCss-->', getConfig('customCss'), $html);
@ -2211,6 +2411,7 @@ function render_list($path = '', $files = '')
while (strpos($html, '<!--constStr@GetFileNameFail-->')) $html = str_replace('<!--constStr@GetFileNameFail-->', getconstStr('GetFileNameFail'), $html);
while (strpos($html, '<!--constStr@UploadFile-->')) $html = str_replace('<!--constStr@UploadFile-->', getconstStr('UploadFile'), $html);
while (strpos($html, '<!--constStr@UploadFolder-->')) $html = str_replace('<!--constStr@UploadFolder-->', getconstStr('UploadFolder'), $html);
while (strpos($html, '<!--constStr@FileSelected-->')) $html = str_replace('<!--constStr@FileSelected-->', getconstStr('FileSelected'), $html);
while (strpos($html, '<!--IsPreview?-->')) $html = str_replace('<!--IsPreview?-->', (isset($_GET['preview'])?'?preview&':'?'), $html);
$tmp = splitfirst($html, '<!--BackgroundStart-->');
@ -2220,6 +2421,25 @@ function render_list($path = '', $files = '')
$background = str_replace('<!--BackgroundUrl-->', getConfig('background'), $tmp[0]);
}
$html .= $background . $tmp[1];
$tmp = splitfirst($html, '<!--PathArrayStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--PathArrayEnd-->');
$PathArrayStr = $tmp[0];
$tmp_path = str_replace('%23', '#', str_replace('&','&amp;', $path));
$tmp_url = $_SERVER['base_disk_path'];
while ($tmp_path!='') {
$tmp1 = splitfirst($tmp_path, '/');
$folder1 = $tmp1[0];
if ($folder1!='') {
$tmp_url .= $folder1 . '/';
$PathArrayStr1 = str_replace('<!--PathArrayLink-->', ($folder1==$files['name']?'':$tmp_url), $PathArrayStr);
$PathArrayStr1 = str_replace('<!--PathArrayName-->', $folder1, $PathArrayStr1);
$html .= $PathArrayStr1;
}
$tmp_path = $tmp1[1];
}
$html .= $tmp[1];
$tmp = splitfirst($html, '<!--SelectLanguageStart-->');
$html = $tmp[0];
@ -2263,7 +2483,8 @@ function render_list($path = '', $files = '')
$tmp = splitfirst($html, '<!--ShowThumbnailsStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--ShowThumbnailsEnd-->');
if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) {
//if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) {
if (!getConfig('disableShowThumb')) {
$html .= str_replace('<!--constStr@OriginalPic-->', getconstStr('OriginalPic'), $tmp[0]) . $tmp[1];
} else $html .= $tmp[1];
}
@ -2296,7 +2517,10 @@ function render_list($path = '', $files = '')
$tmp[1] = $tmp1;
}
$html .= $MultiDiskArea . $tmp[1];
while (strpos($html, '<!--DisktagNow-->')) $html = str_replace('<!--DisktagNow-->', $_SERVER['disktag'], $html);
$diskname = getConfig('diskname');
if ($diskname=='') $diskname = $_SERVER['disktag'];
//if (strlen($diskname)>15) $diskname = substr($diskname, 0, 12).'...';
while (strpos($html, '<!--DiskNameNow-->')) $html = str_replace('<!--DiskNameNow-->', $diskname, $html);
$tmp = splitfirst($html, '<!--HeadomfStart-->');
$html = $tmp[0];
@ -2426,12 +2650,57 @@ function render_list($path = '', $files = '')
$html .= $tmp[1];
while (strpos($html, '<!--timezone-->')) $html = str_replace('<!--timezone-->', $_SERVER['timezone'], $html);
while (strpos($html, '{{.RawData}}')) {
$str = '[';
$i = 0;
foreach ($files['children'] as $file) if ($_SERVER['admin'] or !isHideFile($file['name'])) {
$tmp = [];
$tmp['name'] = $file['name'];
$tmp['size'] = size_format($file['size']);
$tmp['date'] = time_format($file['lastModifiedDateTime']);
$tmp['@time'] = $file['date'];
$tmp['@type'] = isset($file['folder'])?'folder':'file';
$str .= json_encode($tmp).',';
}
if ($str == '[') {
$str = '';
} else $str = substr($str, 0, -1).']';
$html = str_replace('{{.RawData}}', base64_encode($str), $html);
}
// 最后清除换行
while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html);
//while (strpos($html, "\r\r")) $html = str_replace("\r\r", "\r", $html);
while (strpos($html, "\n\n")) $html = str_replace("\n\n", "\n", $html);
//while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html);
$exetime = round(microtime(true)-$_SERVER['php_starttime'],3);
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html);
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runningtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html);
}
if ($_SERVER['admin']||!getConfig('disableChangeTheme')) {
$theme_arr = scandir(__DIR__.'/theme');
$html .= '
<div style="position: fixed;right: 10px;bottom: 10px;/*color: rgba(247,247,249,0);*/">
<select name="theme" onchange="changetheme(this.options[this.options.selectedIndex].value)">
<option value="">'.getconstStr('Theme').'</option>';
foreach ($theme_arr as $v1) {
if ($v1!='.' && $v1!='..') $html .= '
<option value="'.$v1.'"'.($v1==$theme?' selected="selected"':'').'>'.$v1.'</option>';
}
$html .= '
</select>
</div>
<script type="text/javascript">
function changetheme(str)
{
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'theme=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
</script>';
}
$html = $authinfo . $html;

View File

@ -1,16 +1,16 @@
<?php
$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
$exts['music'] = ['mp3', 'wma', 'flac', 'wav', 'ogg', 'm4a'];
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'json', 'html', 'c', 'md', 'py', 'omf'];
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', 'rmvb'];
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
$constStr = [
'languages' => [
'en-us' => 'English',
'zh-cn' => '中文',
'zh-cn' => '简体中文',
'ja' => '日本語',
'ko-kr' => '한국어',
'fa' => 'فارسی',
@ -68,14 +68,20 @@ $constStr = [
'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?admin\', it is \'?{this value}\'.',
'customScript' => '<script> in all pages, e.g. http turn to https',
'customCss' => '<style> in <head>',
'customTheme' => 'an url of html',
'domain_path' => 'more custom domain, format is a1.com:/dirto/path1|b2.com:/path2',
'diskname' => 'The disk name you want show.',
'disktag' => 'A tag used in store config and url.',
'disableShowThumb' => 'if 1, the ShowThumbnail button will not display',
'disableChangeTheme' => 'if 1, the Theme selection button will not display',
'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password',
'background' => 'Set an url as background photo.',
'theme' => 'Select theme.',
'timezone' => 'Set default timezone.',
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md',
'passfile' => 'The password of dir will save in this file.',
'passfile' => 'The password of folder(& its childrens) will save in this file.',
'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.',
'sitename' => 'sitename',
'Onedrive_ver' => 'Onedrive version',
@ -85,14 +91,20 @@ $constStr = [
'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。',
'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
'customCss' => '<style>,在<head>最后面',
'customTheme' => 'html格式的主题的url',
'domain_path' => '使用多个自定义域名时指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2比private_path优先。',
'diskname' => '这个盘你想显示什么名称。',
'disktag' => '一个标签用于保存配置多盘时会显示在url中。',
'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。',
'disableChangeTheme' => '如果填 1, 主题选择切换将被隐藏',
'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
'background' => '设置一个url作为背景。',
'theme' => '选择一个主题。',
'timezone' => '设置默认时区。',
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看但它的功能正常比如readme.md',
'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值在目标需要自己设置反代。会加上&Origindomain=原域名',
'public_path' => '使用API长链接访问时显示网盘文件的路径不设置时默认为根目录不能是private_path的上级public看到的不能比private多要么看到的就不一样。',
'sitename' => '网站的名称',
'Onedrive_ver' => 'Onedrive版本',
@ -194,7 +206,7 @@ $constStr = [
'zh-cn' => '先在环境变量设置passfile才能加密',
'ja' => '最初に暗号化する環境変数にパスファイルを設定します',
'ko-kr' => '암호화하기 전에 환경 변수에 패스 파일을 설정하십시오',
'fa' => 'قبل از رمزگذاری \ "pass file \" را در محیط تنظیم کنید',
'fa' => 'قبل از رمزگذاری \"pass file \" را در محیط تنظیم کنید',
],
'updateProgram' => [
'en-us' => 'Update Program',
@ -224,6 +236,10 @@ $constStr = [
'ko-kr' => '돌아 가기',
'fa' => 'بازگشت',
],
'Theme' => [
'en-us' => 'Theme',
'zh-cn' => '主题',
],
'NotNeedUpdate' => [
'en-us' => 'Not Need Update',
'zh-cn' => '不需要更新',
@ -514,6 +530,10 @@ $constStr = [
'ko-kr' => '업로드 링크 받기',
'fa' => 'دریافت لینک آپلود',
],
'Calculate' => [
'en-us' => 'Calculate',
'zh-cn' => '计算',
],
'UpFileTooLarge' => [
'en-us' => 'The File is too Large!',
'zh-cn' => '文件过大,终止上传。',
@ -761,9 +781,9 @@ $constStr = [
'ko-kr' => '캐시 플러시',
'fa' => 'رفرش cache',
],
'VPSnotupdate' => [
'en-us' => 'In VPS can not update by a click! run update.sh',
'zh-cn' => '在VPS中不能一键更新可以运行update.sh',
'CannotOneKeyUpate' => [
'en-us' => 'Can not update by a click! run update.sh',
'zh-cn' => '不能一键更新可以运行update.sh',
],
'QueryBranchs' => [
'en-us' => 'Query Branchs',

View File

@ -1,14 +1,18 @@
<?php
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(E_ALL & ~E_NOTICE);
include 'vendor/autoload.php';
include 'conststr.php';
include 'common.php';
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
include 'platform/scf.php';
include 'platform/TencentSCF.php';
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
include 'platform/AliyunFC.php';
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
include 'platform/HuaweiFG.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/heroku.php';
include 'platform/Heroku.php';
$path = getpath();
//echo 'path:'. $path;
$_GET = getGET();
@ -21,7 +25,7 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
http_response_code($re['statusCode']);
echo $re['body'];
} else {
include 'platform/normal.php';
include 'platform/Normal.php';
$path = getpath();
//echo 'path:'. $path;
$_GET = getGET();
@ -36,6 +40,7 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
echo $re['body'];
}
// Tencent SCF
function main_handler($event, $context)
{
$event = json_decode(json_encode($event), true);
@ -51,3 +56,77 @@ function main_handler($event, $context)
return main($path);
}
// Aliyun FC & Huawei FG
function handler($event, $context)
{
if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
// Aliyun FC
set_error_handler("myErrorHandler");
$tmp = array(
'method' => $event->getMethod(),
'clientIP' => $event->getAttribute("clientIP"),
'eventURI' => $event->getAttribute("eventURI"),
'path' => spurlencode($event->getAttribute("path"), '/'),
'queryString' => $event->getQueryParams(),
'headers' => $event->getHeaders(),
'body' => $event->getBody()->getContents(),
);
$event = $tmp;
$context = json_decode(json_encode($context), true);
printInput($event, $context);
unset($_POST);
unset($_GET);
unset($_COOKIE);
unset($_SERVER);
GetGlobalVariable($event);
$path = GetPathSetting($event, $context);
$re = main($path);
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['body']);
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
// Huawei FG
global $contextUserData;
$contextUserData = $context;
$event = json_decode(json_encode($event), true);
if ($event['isBase64Encoded']) $event['body'] = base64_decode($event['body']);
printInput($event, $context);
unset($_POST);
unset($_GET);
unset($_COOKIE);
unset($_SERVER);
GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context);
return main($path);
}
}
// used by Aliyun FC
function myErrorHandler($errno, $errstr, $errfile, $errline) {
if (!(error_reporting() & $errno)) {
return false;
}
switch ($errno) {
case E_USER_ERROR:
$errInfo = array(
"errorMessage" => $errstr,
"errorType" => \ServerlessFC\friendly_error_type($errno),
"stackTrace" => array(
"file" => $errfile,
"line" => $errline,
),
);
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
break;
default: // E_USER_WARNING | E_USER_NOTICE
break;
}
return true;
}

414
platform/AliyunFC.php Normal file
View File

@ -0,0 +1,414 @@
<?php
// https://help.aliyun.com/document_detail/53252.html
// https://github.com/aliyun/fc-php-sdk/blob/master/src/AliyunFC/Client.php
use AliyunFC\Client;
function printInput($event, $context)
{
if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
' . urldecode(json_encode($context, JSON_PRETTY_PRINT)) . '
';
}
function GetGlobalVariable($event)
{
$_GET = $event['queryString'];
foreach ($_GET as $k => $v) {
if ($v=='') $_GET[$k] = true;
}
$postbody = explode("&",$event['body']);
foreach ($postbody as $postvalues) {
$pos = strpos($postvalues,"=");
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
}
$cookiebody = explode("; ",$event['headers']['Cookie'][0]);
foreach ($cookiebody as $cookievalues) {
$pos = strpos($cookievalues,"=");
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
}
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
}
function GetPathSetting($event, $context)
{
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['Accept-Language'][0],';')[0],',')[0]);
$_SERVER['accountId'] = $context['accountId'];
$_SERVER['region'] = $context['region'];
$_SERVER['service_name'] = $context['service']['name'];
$_SERVER['function_name'] = $context['function']['name'];
$_SERVER['base_path'] = '/';
$path = $event['path'];
//$path = spurlencode($path, '/');
if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['clientIP'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0];
return $path;
}
function getConfig($str, $disktag = '')
{
global $InnerEnv;
global $Base64Env;
if (in_array($str, $InnerEnv)) {
if ($disktag=='') $disktag = $_SERVER['disktag'];
$env = json_decode(getenv($disktag), true);
if (isset($env[$str])) {
if (in_array($str, $Base64Env)) return equal_replace($env[$str],1);
else return $env[$str];
}
} else {
if (in_array($str, $Base64Env)) return equal_replace(getenv($str),1);
else return getenv($str);
}
return '';
}
function setConfig($arr, $disktag = '')
{
global $InnerEnv;
global $Base64Env;
if ($disktag=='') $disktag = $_SERVER['disktag'];
$disktags = explode("|",getConfig('disktag'));
$diskconfig = json_decode(getenv($disktag), true);
$tmp = [];
$indisk = 0;
$oparetdisk = 0;
foreach ($arr as $k => $v) {
if (in_array($k, $InnerEnv)) {
if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v);
else $diskconfig[$k] = $v;
$indisk = 1;
} elseif ($k=='disktag_add') {
array_push($disktags, $v);
$oparetdisk = 1;
} elseif ($k=='disktag_del') {
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$oparetdisk = 1;
} else {
if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v);
else $tmp[$k] = $v;
}
}
if ($indisk) {
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
ksort($diskconfig);
$tmp[$disktag] = json_encode($diskconfig);
}
if ($oparetdisk) {
$disktags = array_unique($disktags);
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
else $tmp['disktag'] = '';
}
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
//';
$response = updateEnvironment($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], getConfig('AccessKeyID'), getConfig('AccessKeySecret'));
//WaitSCFStat();
return $response;
}
function install()
{
global $constStr;
if ($_GET['install2']) {
$tmp['admin'] = $_POST['admin'];
setConfig($tmp);
if (needUpdate()) {
OnekeyUpate();
return message('update to github version, reinstall.
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
}
return output('Jump
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
}
if ($_GET['install1']) {
//if ($_POST['admin']!='') {
$tmp['timezone'] = $_COOKIE['timezone'];
$AccessKeyID = getConfig('AccessKeyID');
if ($AccessKeyID=='') {
$AccessKeyID = $_POST['AccessKeyID'];
$tmp['AccessKeyID'] = $AccessKeyID;
}
$AccessKeySecret = getConfig('AccessKeySecret');
if ($AccessKeySecret=='') {
$AccessKeySecret = $_POST['AccessKeySecret'];
$tmp['AccessKeySecret'] = $AccessKeySecret;
}
$response = json_decode(SetbaseConfig($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], $AccessKeyID, $AccessKeySecret), true);
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
return message($html, $title, 201);
} else {
$html .= '
<form action="?install2" method="post" onsubmit="return notnull(this);">
<label>'.getconstStr('SetAdminPassword').':<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>
<input type="submit" value="'.getconstStr('Submit').'">
</form>
<script>
function notnull(t)
{
if (t.admin.value==\'\') {
alert(\''.getconstStr('SetAdminPassword').'\');
return false;
}
return true;
}
</script>';
$title = getconstStr('SetAdminPassword');
return message($html, $title, 201);
}
//}
}
if ($_GET['install0']) {
$html .= '
<form action="?install1" method="post" onsubmit="return notnull(this);">
language:<br>';
foreach ($constStr['languages'] as $key1 => $value1) {
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') $html .= '
<a href="https://usercenter.console.aliyun.com/?#/manage/ak" target="_blank">'.getconstStr('Create').' AccessKeyID & AccessKeySecret</a><br>
<label>AccessKeyID:<input name="AccessKeyID" type="text" placeholder="" size=""></label><br>
<label>AccessKeySecret:<input name="AccessKeySecret" type="text" placeholder="" size=""></label><br>';
$html .= '
<input type="submit" value="'.getconstStr('Submit').'">
</form>
<script>
var nowtime= new Date();
var timezone = 0-nowtime.getTimezoneOffset()/60;
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie="timezone="+timezone+"; path=/; "+expires;
function changelanguage(str)
{
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
function notnull(t)
{';
if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') $html .= '
if (t.AccessKeyID.value==\'\') {
alert(\'input AccessKeyID\');
return false;
}
if (t.AccessKeySecret.value==\'\') {
alert(\'input SecretKey\');
return false;
}';
$html .= '
return true;
}
</script>';
$title = getconstStr('SelectLanguage');
return message($html, $title, 201);
}
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
$title = 'Error';
return message($html, $title, 201);
}
function getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
{
$fcClient = new Client([
"endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
"accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret
]);
return $fcClient->getFunction($service_name, $function_name);
}
function updateEnvironment($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
{
//print_r($Envs);
$fcClient = new Client([
"endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
"accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret
]);
$tmp = $fcClient->getFunction($service_name, $function_name)['data'];
//$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
foreach ($tmp['environmentVariables'] as $key => $value ) {
$tmp_env[$key] = $value;
}
foreach ($Envs as $key1 => $value1) {
$tmp_env[$key1] = $value1;
}
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
ksort($tmp_env);
$tmpdata['functionName'] = $tmp['functionName'];
$tmpdata['description'] = $tmp['description'];
$tmpdata['memorySize'] = $tmp['memorySize'];
$tmpdata['timeout'] = $tmp['timeout'];
$tmpdata['runtime'] = $tmp['runtime'];
$tmpdata['handler'] = $tmp['handler'];
$tmpdata['environmentVariables'] = $tmp_env;
$tmpdata['code']['zipFile'] = base64_encode( file_get_contents($fcClient->getFunctionCode($service_name, $function_name)['data']['url']) );
return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
}
function SetbaseConfig($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
{
//echo json_encode($Envs,JSON_PRETTY_PRINT);
$fcClient = new Client([
"endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
"accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret
]);
$tmp = $fcClient->getFunction($service_name, $function_name)['data'];
// $tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
foreach ($tmp['environmentVariables'] as $key => $value ) {
$tmp_env[$key] = $value;
}
foreach ($Envs as $key1 => $value1) {
$tmp_env[$key1] = $value1;
}
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
ksort($tmp_env);
$tmpdata['functionName'] = $function_name;
$tmpdata['description'] = 'Onedrive index and manager in Ali FC.';
$tmpdata['memorySize'] = 128;
$tmpdata['timeout'] = 30;
$tmpdata['runtime'] = 'php7.2';
$tmpdata['handler'] = 'index.handler';
$tmpdata['environmentVariables'] = $tmp_env;
$tmpdata['code']['zipFile'] = base64_encode( file_get_contents($fcClient->getFunctionCode($service_name, $function_name)['data']['url']) );
return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
}
function updateProgram($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret, $source)
{
//WaitSCFStat();
$fcClient = new Client([
"endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
"accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret
]);
$tmp = $fcClient->getFunction($service_name, $function_name)['data'];
//$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
$tmpdata['functionName'] = $tmp['functionName'];
$tmpdata['description'] = $tmp['description'];
$tmpdata['memorySize'] = $tmp['memorySize'];
$tmpdata['timeout'] = $tmp['timeout'];
$tmpdata['runtime'] = $tmp['runtime'];
$tmpdata['handler'] = $tmp['handler'];
$tmpdata['environmentVariables'] = $tmp['environmentVariables'];
$tmpdata['code']['zipFile'] = base64_encode( file_get_contents($source) );
return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
}
function api_error($response)
{
return !isset($response['data']);
}
function api_error_msg($response)
{
return $response;
return $response['Error']['Code'] . '<br>
' . $response['Error']['Message'] . '<br><br>
function_name:' . $_SERVER['function_name'] . '<br>
Region:' . $_SERVER['Region'] . '<br>
namespace:' . $_SERVER['namespace'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
}
function setConfigResponse($response)
{
return $response;
}
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';
// 从github下载对应tar.gz并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
$html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
// 获取解压出的目录名
/*
@ob_start();
passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
$html.='状态:' . $stat . '
结果:
';
$archivefolder = ob_get_clean();
if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
$outPath .= $archivefolder;
$html.=htmlspecialchars($archivefolder);
//return $html;
*/
$tmp = scandir($outPath);
$name = $auth.'-'.$project;
foreach ($tmp as $f) {
if ( substr($f, 0, strlen($name)) == $name) {
$outPath .= $f;
break;
}
}
// 将目录中文件打包成zip
$zip=new ZipArchive();
if($zip->open($source, ZipArchive::CREATE)){
addFileToZip($zip, $outPath); //调用方法对要打包的根目录进行操作并将ZipArchive的对象传递给方法
$zip->close(); //关闭处理的zip文件
}
return updateProgram($_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], getConfig('AccessKeyID'), getConfig('AccessKeySecret'), $source);
}
function addFileToZip($zip, $rootpath, $path = '')
{
if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
if (substr($path,0,1)=='/') $path = substr($path, 1);
$handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
while($filename=readdir($handler)){
if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
$nowname = path_format($rootpath.'/'.$path."/".$filename);
if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
addFileToZip($zip, $rootpath, $path."/".$filename);
}else{ //将文件加入zip对象
$zip->addFile($nowname);
$newname = $path."/".$filename;
if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
$zip->renameName($nowname, $newname);
}
}
}
@closedir($path);
}

743
platform/HuaweiFG.php Normal file
View File

@ -0,0 +1,743 @@
<?php
global $contextUserData;
function printInput($event, $context)
{
$tmp['eventID'] = $context->geteventID();
$tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
$tmp['AccessKey'] = $context->getAccessKey();
$tmp['SecretKey'] = $context->getSecretKey();
$tmp['UserData']['HW_urn'] = $context->getUserData('HW_urn');
$tmp['FunctionName'] = $context->getFunctionName();
$tmp['RunningTimeInSeconds'] = $context->getRunningTimeInSeconds();
$tmp['Version'] = $context->getVersion();
$tmp['MemorySize'] = $context->getMemorySize();
$tmp['CPUNumber'] = $context->getCPUNumber();
$tmp['ProjectID'] = $context->getProjectID();
$tmp['Package'] = $context->Package();
$tmp['Token'] = $context->getToken();
$tmp['Logger'] = $context->getLogger();
if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
' . urldecode(json_encode($tmp, JSON_PRETTY_PRINT)) . '
';
}
function GetGlobalVariable($event)
{
$_GET = $event['queryStringParameters'];
$postbody = explode("&",$event['body']);
foreach ($postbody as $postvalues) {
$pos = strpos($postvalues,"=");
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
}
$cookiebody = explode("; ",$event['headers']['cookie']);
foreach ($cookiebody as $cookievalues) {
$pos = strpos($cookievalues,"=");
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
}
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
}
function GetPathSetting($event, $context)
{
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]);
$_SERVER['function_name'] = $context->getFunctionName();
$_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name;
$path = path_format($event['pathParameters'][''].'/');
$_SERVER['base_path'] = path_format($event['path'].'/');
if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/';
} else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
}
if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
return $path;
}
function getConfig($str, $disktag = '')
{
global $InnerEnv;
global $Base64Env;
global $contextUserData;
if (in_array($str, $InnerEnv)) {
if ($disktag=='') $disktag = $_SERVER['disktag'];
$env = json_decode($contextUserData->getUserData($disktag), true);
if (isset($env[$str])) {
if (in_array($str, $Base64Env)) return equal_replace($env[$str],1);
else return $env[$str];
}
} else {
if (in_array($str, $Base64Env)) return equal_replace($contextUserData->getUserData($str),1);
else return $contextUserData->getUserData($str);
}
return '';
}
function setConfig($arr, $disktag = '')
{
global $InnerEnv;
global $Base64Env;
global $contextUserData;
if ($disktag=='') $disktag = $_SERVER['disktag'];
$disktags = explode("|",getConfig('disktag'));
$diskconfig = json_decode($contextUserData->getUserData($disktag), true);
$tmp = [];
$indisk = 0;
$oparetdisk = 0;
foreach ($arr as $k => $v) {
if (in_array($k, $InnerEnv)) {
if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v);
else $diskconfig[$k] = $v;
$indisk = 1;
} elseif ($k=='disktag_add') {
array_push($disktags, $v);
$oparetdisk = 1;
} elseif ($k=='disktag_del') {
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$oparetdisk = 1;
} else {
if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v);
else $tmp[$k] = $v;
}
}
if ($indisk) {
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
ksort($diskconfig);
$tmp[$disktag] = json_encode($diskconfig);
}
if ($oparetdisk) {
$disktags = array_unique($disktags);
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
else $tmp['disktag'] = '';
}
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
//';
$response = updateEnvironment($tmp, getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'));
// WaitSCFStat();
return $response;
}
function WaitSCFStat()
{
$trynum = 0;
while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
'.++$trynum;
}
function install()
{
global $constStr;
if ($_GET['install2']) {
$tmp['admin'] = $_POST['admin'];
setConfig($tmp);
if (needUpdate()) {
OnekeyUpate();
return message('update to github version, reinstall.
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
}
return output('Jump
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
}
if ($_GET['install1']) {
//if ($_POST['admin']!='') {
$tmp['timezone'] = $_COOKIE['timezone'];
$tmp['HW_urn'] = getConfig('HW_urn');
if ($tmp['HW_urn']=='') {
$tmp['HW_urn'] = $_POST['HW_urn'];
}
$tmp['HW_key'] = getConfig('HW_key');
if ($tmp['HW_key']=='') {
$tmp['HW_key'] = $_POST['HW_key'];
}
$tmp['HW_secret'] = getConfig('HW_secret');
if ($tmp['HW_secret']=='') {
$tmp['HW_secret'] = $_POST['HW_secret'];
}
//$response = json_decode(SetbaseConfig($tmp, $HW_urn, $HW_name, $HW_pwd), true)['Response'];
$response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
return message($html, $title, 201);
} else {
$html .= '
<form action="?install2" method="post" onsubmit="return notnull(this);">
<label>'.getconstStr('SetAdminPassword').':<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>
<input type="submit" value="'.getconstStr('Submit').'">
</form>
<script>
function notnull(t)
{
if (t.admin.value==\'\') {
alert(\''.getconstStr('SetAdminPassword').'\');
return false;
}
return true;
}
</script>';
$title = getconstStr('SetAdminPassword');
return message($html, $title, 201);
}
//}
}
if ($_GET['install0']) {
$html .= '
<form action="?install1" method="post" onsubmit="return notnull(this);">
language:<br>';
foreach ($constStr['languages'] as $key1 => $value1) {
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
在函数代码操作页上方找到URN鼠标放上去后显示URN复制填入<br>
<label>URN:<input name="HW_urn" type="text" placeholder="" size=""></label><br>
<a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
在下载的credentials.csv文件中找到对应信息填入<br>
<label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
<label>Secret Access Key:<input name="HW_secret" type="password" placeholder="" size=""></label><br>';
$html .= '
<input type="submit" value="'.getconstStr('Submit').'">
</form>
<script>
var nowtime= new Date();
var timezone = 0-nowtime.getTimezoneOffset()/60;
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie="timezone="+timezone+"; path=/; "+expires;
function changelanguage(str)
{
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
function notnull(t)
{';
if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
if (t.HW_urn.value==\'\') {
alert(\'input URN\');
return false;
}
if (t.HW_key.value==\'\') {
alert(\'input name\');
return false;
}
if (t.HW_secret.value==\'\') {
alert(\'input pwd\');
return false;
}';
$html .= '
return true;
}
</script>';
$title = getconstStr('SelectLanguage');
return message($html, $title, 201);
}
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
$title = 'Error';
return message($html, $title, 201);
}
function getfunctioninfo($HW_urn, $HW_key, $HW_secret)
{
$URN = explode(':', $HW_urn);
$Region = $URN[2];
$project_id = $URN[3];
$url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
$signer = new Signer();
$signer->Key = $HW_key;
$signer->Secret = $HW_secret;
$req = new Request('GET', $url);
$req->headers = array(
'content-type' => 'application/json;charset=utf8',
);
$req->body = '';
$curl = $signer->Sign($req);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
return $response;
}
function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
{
//echo json_encode($Envs,JSON_PRETTY_PRINT);
global $contextUserData;
$tmp_env = json_decode(json_decode(getfunctioninfo($HW_urn, $HW_key, $HW_secret),true)['user_data'],true);
foreach ($Envs as $key1 => $value1) {
$tmp_env[$key1] = $value1;
}
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
ksort($tmp_env);
$URN = explode(':', $HW_urn);
$Region = $URN[2];
$project_id = $URN[3];
$url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
$signer = new Signer();
$signer->Key = $HW_key;
$signer->Secret = $HW_secret;
$req = new Request('PUT', $url);
$req->headers = array(
'content-type' => 'application/json;charset=utf8',
);
$tmpdata['handler'] = 'index.handler';
$tmpdata['memory_size'] = $contextUserData->getMemorySize()+1-1;
$tmpdata['runtime'] = 'PHP7.3';
$tmpdata['timeout'] = $contextUserData->getRunningTimeInSeconds()+1-1;
$tmpdata['user_data'] = json_encode($tmp_env);
$req->body = json_encode($tmpdata);
$curl = $signer->Sign($req);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
return $response;
}
function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
{
//echo json_encode($Envs,JSON_PRETTY_PRINT);
$tmp_env = json_decode(json_decode(getfunctioninfo($HW_urn, $HW_key, $HW_secret),true)['user_data'],true);
foreach ($Envs as $key1 => $value1) {
$tmp_env[$key1] = $value1;
}
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
ksort($tmp_env);
// https://functiongraph.cn-north-4.myhuaweicloud.com/v2/{project_id}/fgs/functions/{function_urn}/config
$URN = explode(':', $HW_urn);
$Region = $URN[2];
$project_id = $URN[3];
$url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
$signer = new Signer();
$signer->Key = $HW_key;
$signer->Secret = $HW_secret;
$req = new Request('PUT', $url);
$req->headers = array(
'content-type' => 'application/json;charset=utf8',
);
$tmpdata['handler'] = 'index.handler';
$tmpdata['memory_size'] = 128;
$tmpdata['runtime'] = 'PHP7.3';
$tmpdata['timeout'] = 30;
$tmpdata['user_data'] = json_encode($tmp_env);
$req->body = json_encode($tmpdata);
$curl = $signer->Sign($req);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
return $response;
}
function updateProgram($HW_urn, $HW_key, $HW_secret, $source)
{
$URN = explode(':', $HW_urn);
$Region = $URN[2];
$project_id = $URN[3];
$url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/code';
$signer = new Signer();
$signer->Key = $HW_key;
$signer->Secret = $HW_secret;
$req = new Request('PUT', $url);
$req->headers = array(
'content-type' => 'application/json;charset=utf8',
);
$tmpdata['code_type'] = 'zip';
$tmpdata['func_code']['file'] = base64_encode( file_get_contents($source) );
$req->body = json_encode($tmpdata);
$curl = $signer->Sign($req);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
return $response;
}
function api_error($response)
{
return isset($response['error_code']);
}
function api_error_msg($response)
{
return $response['error_code'] . '<br>
' . $response['error_msg'] . '<br>
request_id: ' . $response['request_id'] . '<br><br>
function_name: ' . $_SERVER['function_name'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
}
function setConfigResponse($response)
{
return json_decode( $response, true );
}
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';
// 从github下载对应tar.gz并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
$html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
// 获取解压出的目录名
/*
@ob_start();
passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
$html.='状态:' . $stat . '
结果:
';
$archivefolder = ob_get_clean();
if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
$outPath .= $archivefolder;
$html.=htmlspecialchars($archivefolder);
//return $html;
*/
$tmp = scandir($outPath);
$name = $auth.'-'.$project;
foreach ($tmp as $f) {
if ( substr($f, 0, strlen($name)) == $name) {
$outPath .= $f;
break;
}
}
// 将目录中文件打包成zip
//$zip=new ZipArchive();
$zip=new PharData($source);
//if($zip->open($source, ZipArchive::CREATE)){
addFileToZip($zip, $outPath); //调用方法对要打包的根目录进行操作并将ZipArchive的对象传递给方法
// $zip->close(); //关闭处理的zip文件
//}
return updateProgram(getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'), $source);
}
function addFileToZip($zip, $rootpath, $path = '')
{
if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
if (substr($path,0,1)=='/') $path = substr($path, 1);
$handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
while($filename=readdir($handler)){
if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
$nowname = path_format($rootpath.'/'.$path."/".$filename);
if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
$zip->addEmptyDir($path."/".$filename);
addFileToZip($zip, $rootpath, $path."/".$filename);
}else{ //将文件加入zip对象
$newname = $path."/".$filename;
if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
$zip->addFile($nowname, $newname);
//$zip->renameName($nowname, $newname);
}
}
}
@closedir($path);
}
define("BasicDateFormat", "Ymd\THis\Z");
define("Algorithm", "SDK-HMAC-SHA256");
define("HeaderXDate", "X-Sdk-Date");
define("HeaderHost", "host");
define("HeaderAuthorization", "Authorization");
define("HeaderContentSha256", "X-Sdk-Content-Sha256");
class Request
{
public $method = '';
public $scheme = '';
public $host = '';
public $uri = '';
public $query = array();
public $headers = array();
public $body = '';
function __construct()
{
$args = func_get_args();
$i = count($args);
if ($i == 0) {
$this->construct(NULL, NULL, NULL, NULL);
} elseif ($i == 1) {
$this->construct($args[0], NULL, NULL, NULL);
} elseif ($i == 2) {
$this->construct($args[0], $args[1], NULL, NULL);
} elseif ($i == 3) {
$this->construct($args[0], $args[1], $args[2], NULL);
} else {
$this->construct($args[0], $args[1], $args[2], $args[3]);
}
}
function construct($method, $url, $headers, $body)
{
if ($method != NULL) {
$this->method = $method;
}
if ($url != NULL) {
$spl = explode("://", $url, 2);
$scheme = 'http';
if (count($spl) > 1) {
$scheme = $spl[0];
$url = $spl[1];
}
$spl = explode("?", $url, 2);
$url = $spl[0];
$query = array();
if (count($spl) > 1) {
foreach (explode("&", $spl[1]) as $kv) {
$spl = explode("=", $kv, 2);
$key = $spl[0];
if (count($spl) == 1) {
$value = "";
} else {
$value = $spl[1];
}
if ($key != "") {
$key = urldecode($key);
$value = urldecode($value);
if (array_key_exists($key, $query)) {
array_push($query[$key], $value);
} else {
$query[$key] = array($value);
}
}
}
}
$spl = explode("/", $url, 2);
$host = $spl[0];
if (count($spl) == 1) {
$url = "/";
} else {
$url = "/" . $spl[1];
}
$this->scheme = $scheme;
$this->host = $host;
$this->uri = urldecode($url);
$this->query = $query;
}
if ($headers != NULL) {
$this->headers = $headers;
}
if ($body != NULL) {
$this->body = $body;
}
}
}
class Signer
{
public $Key = '';
public $Secret = '';
function escape($string)
{
$entities = array('+', "%7E");
$replacements = array('%20', "~");
return str_replace($entities, $replacements, urlencode($string));
}
function findHeader($r, $header)
{
foreach ($r->headers as $key => $value) {
if (!strcasecmp($key, $header)) {
return $value;
}
}
return NULL;
}
// Build a CanonicalRequest from a regular request string
//
// CanonicalRequest =
// HTTPRequestMethod + '\n' +
// CanonicalURI + '\n' +
// CanonicalQueryString + '\n' +
// CanonicalHeaders + '\n' +
// SignedHeaders + '\n' +
// HexEncode(Hash(RequestPayload))
function CanonicalRequest($r, $signedHeaders)
{
$CanonicalURI = $this->CanonicalURI($r);
$CanonicalQueryString = $this->CanonicalQueryString($r);
$canonicalHeaders = $this->CanonicalHeaders($r, $signedHeaders);
$signedHeadersString = join(";", $signedHeaders);
$hash = $this->findHeader($r, HeaderContentSha256);
if (!$hash) {
$hash = hash("sha256", $r->body);
}
return "$r->method\n$CanonicalURI\n$CanonicalQueryString\n$canonicalHeaders\n$signedHeadersString\n$hash";
}
// CanonicalURI returns request uri
function CanonicalURI($r)
{
$pattens = explode("/", $r->uri);
$uri = array();
foreach ($pattens as $v) {
array_push($uri, $this->escape($v));
}
$urlpath = join("/", $uri);
if (substr($urlpath, -1) != "/") {
$urlpath = $urlpath . "/";
}
return $urlpath;
}
// CanonicalQueryString
function CanonicalQueryString($r)
{
$keys = array();
foreach ($r->query as $key => $value) {
array_push($keys, $key);
}
sort($keys);
$a = array();
foreach ($keys as $key) {
$k = $this->escape($key);
$value = $r->query[$key];
if (is_array($value)) {
sort($value);
foreach ($value as $v) {
$kv = "$k=" . $this->escape($v);
array_push($a, $kv);
}
} else {
$kv = "$k=" . $this->escape($value);
array_push($a, $kv);
}
}
return join("&", $a);
}
// CanonicalHeaders
function CanonicalHeaders($r, $signedHeaders)
{
$headers = array();
foreach ($r->headers as $key => $value) {
$headers[strtolower($key)] = trim($value);
}
$a = array();
foreach ($signedHeaders as $key) {
array_push($a, $key . ':' . $headers[$key]);
}
return join("\n", $a) . "\n";
}
function curlHeaders($r)
{
$header = array();
foreach ($r->headers as $key => $value) {
array_push($header, strtolower($key) . ':' . trim($value));
}
return $header;
}
// SignedHeaders
function SignedHeaders($r)
{
$a = array();
foreach ($r->headers as $key => $value) {
array_push($a, strtolower($key));
}
sort($a);
return $a;
}
// Create a "String to Sign".
function StringToSign($canonicalRequest, $t)
{
date_default_timezone_set('UTC');
$date = date(BasicDateFormat, $t);
$hash = hash("sha256", $canonicalRequest);
return "SDK-HMAC-SHA256\n$date\n$hash";
}
// Create the HWS Signature.
function SignStringToSign($stringToSign, $signingKey)
{
return hash_hmac("sha256", $stringToSign, $signingKey);
}
// Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign
function AuthHeaderValue($signature, $accessKey, $signedHeaders)
{
$signedHeadersString = join(";", $signedHeaders);
return "SDK-HMAC-SHA256 Access=$accessKey, SignedHeaders=$signedHeadersString, Signature=$signature";
}
public function Sign($r)
{
date_default_timezone_set('UTC');
$date = $this->findHeader($r, HeaderXDate);
if ($date) {
$t = date_timestamp_get(date_create_from_format(BasicDateFormat, $date));
}
if (!@$t) {
$t = time();
$r->headers[HeaderXDate] = date(BasicDateFormat, $t);
}
$queryString = $this->CanonicalQueryString($r);
if ($queryString != "") {
$queryString = "?" . $queryString;
}
$signedHeaders = $this->SignedHeaders($r);
$canonicalRequest = $this->CanonicalRequest($r, $signedHeaders);
$stringToSign = $this->StringToSign($canonicalRequest, $t);
$signature = $this->SignStringToSign($stringToSign, $this->Secret);
$authValue = $this->AuthHeaderValue($signature, $this->Key, $signedHeaders);
$r->headers[HeaderAuthorization] = $authValue;
$curl = curl_init();
$uri = str_replace(array("%2F"), array("/"), rawurlencode($r->uri));
$url = $r->scheme . '://' . $r->host . $uri . $queryString;
$headers = $this->curlHeaders($r);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $r->method);
curl_setopt($curl, CURLOPT_POSTFIELDS, $r->body);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_NOBODY, FALSE);
return $curl;
}
}

View File

@ -23,6 +23,8 @@ function GetGlobalVariable($event)
$pos = strpos($cookievalues,"=");
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
}
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
$_SERVER['USER'] = 'qcloud';
}
@ -133,9 +135,23 @@ function install()
setConfig($tmp);
if (needUpdate()) {
OnekeyUpate();
return message('update to github version, reinstall.<script>document.cookie=\'language=; path=/\';</script><meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
return message('update to github version, reinstall.
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
}
return output('Jump<script>document.cookie=\'language=; path=/\';</script><meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
return output('Jump
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
}
if ($_GET['install1']) {
//if ($_POST['admin']!='') {
@ -217,7 +233,10 @@ language:<br>';
document.cookie="timezone="+timezone+"; path=/; "+expires;
function changelanguage(str)
{
document.cookie=\'language=\'+str+\'; path=/\';
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
function notnull(t)

View File

@ -126,7 +126,14 @@ function install()
$html = api_error_msg($response);
$title = 'Error';
} else {
return output('Jump<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
return output('Jump
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
}
return message($html, $title, 201);
}
@ -156,7 +163,10 @@ language:<br>';
document.cookie="timezone="+timezone+"; path=/; "+expires;
function changelanguage(str)
{
document.cookie=\'language=\'+str+\'; path=/\';
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
function notnull(t)
@ -251,8 +261,8 @@ function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
//'original:https://github.com/qkqpttgf/OneManager-php/tarball/master/';
//'mine:https://https://github.com/BingoKingo/Tfo/tarball/master/';
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . $branch . '/';
return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'), $source)['body'], true);
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'), $source)['body'], true);
}
function setConfigResponse($response)

View File

@ -128,7 +128,14 @@ function install()
$title = 'Error';
return message($html, $title, 201);
} else {
return output('Jump<script>document.cookie=\'language=; path=/\';</script><meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
return output('Jump
<script>
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
}
}
}
@ -206,7 +213,10 @@ language:<br>';
<script>
function changelanguage(str)
{
document.cookie=\'language=\'+str+\'; path=/\';
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
</script>';
@ -252,12 +262,70 @@ Can not write config to file.<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
}
function OnekeyUpate()
{
return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true);
}
function setConfigResponse($response)
{
return $response;
}
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
{
// __DIR__ is xxx/platform
$projectPath = splitlast(__DIR__, '/')[0];
// 从github下载对应tar.gz并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = $projectPath.'/github.tar.gz';
$githubfile = file_get_contents($url);
if (!$githubfile) return 0;
file_put_contents($tarfile, $githubfile);
if (splitfirst(PHP_VERSION, '.')[0] == '7') {
$phar = new PharData($tarfile); // need php7
$phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
} else {
ob_start();
passthru('tar -xzvf '.$tarfile,$stat);
ob_get_clean();
}
unlink($tarfile);
$outPath = '';
$tmp = scandir($projectPath);
$name = $auth.'-'.$project;
foreach ($tmp as $f) {
if ( substr($f, 0, strlen($name)) == $name) {
$outPath = $projectPath . '/' . $f;
break;
}
}
//error_log($outPath);
if ($outPath=='') return 0;
//unlink($outPath.'/config.php');
rename($projectPath.'/config.php', $outPath.'/config.php');
return moveFolder($outPath, $projectPath);
}
function moveFolder($from, $to)
{
if (substr($from, -1)=='/') $from = substr($from, 0, -1);
if (substr($to, -1)=='/') $to = substr($to, 0, -1);
if (!file_exists($to)) mkdir($to, 0777);
$handler=opendir($from);
while($filename=readdir($handler)) {
if($filename != '.' && $filename != '..'){
$fromfile = $from.'/'.$filename;
$tofile = $to.'/'.$filename;
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
moveFolder($fromfile, $tofile);
}else{
//if (file_exists($tofile)) unlink($tofile);
rename($fromfile, $tofile);
if (file_exists($fromfile)) unlink($fromfile);
}
}
}
closedir($handler);
rmdir($from);
return 1;
}

View File

@ -1,12 +1,12 @@
# **Tfo**
###### A website for two-point filestorage online (tfo).
###### A website for two-point filestorage online (tfo)(20200713).
<img src="https://tfo.herokuapp.com/index/Uploaded/WebContents/Github/Tfo/Tfo.logo.svg" alt="Tfo's Logo" width="250" height="250"/>
## List of feature files 特色文件表
Information [app.json](/app.json "app.json"),[version](/version "version"),[readme.md](/readme.md "readme.md"),[conststr.php](/conststr.php "conststr.php")
UpdateAddress [heroku.php](/platform/heroku.php "heroku.php"),[scf.php](/platform/scf.php "scf.php")
UpdateAddress [Heroku.php](/platform/Heroku.php "Heroku.php"),[TencentSCF.php](/platform/TencentSCF.php "TencentSCF.php"),[HuaweiFG.php](/platform/HuaweiFG.php "HuaweiFG.php"),[AliyunFC.php](/platform/AliyunFC.php "AliyunFC.php")
Theme
@ -38,12 +38,23 @@ How to Install:
### Deploy to SCF 部署到腾讯云函数
Official: https://cloud.tencent.com/product/scf
添加网盘时SCF反应不过来会添加失败请不要删除再添加一次相同的就可以了。
~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview~~
先手动在环境变量添加Regionap-hongkong或ap-guangzhou之类具体看 https://cloud.tencent.com/document/api/583/17238 最底下,然后再安装。
添加网盘时SCF反应不过来会添加失败请不要删除再添加一次相同的就可以了。
### Deploy to Aliyun Function Compute (FC 阿里函数计算)
Official: https://fc.console.aliyun.com/
How to Install:
* 1新建函数 -- HTTP函数
* 2运行环境选择php7.2
* 3触发器认证方式选择anonymous请求方式里面点一下GET再点一下POST最终框框里面有这2个
* 4上传代码
* 5触发器中点进去找到配置自定义域名点击前往创建路径中填 /* ,其它下拉选择。
* 6访问你的域名开始安装
## Original Features 原始特性
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
下载时由程序解析出直链浏览器直接从微软Onedrive服务器下载文件服务器只消耗与微软通信的少量流量。

View File

@ -21,8 +21,8 @@
<meta name=viewport content="width=device-width,initial-scale=1">
<meta name="keywords" content="<!--Keywords-->">
<meta name="description" content="<!--Description-->">
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon" />
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<style type="text/css">
body{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:1em;color:#000;background-color:#f7f7f9;<!--BackgroundStart-->background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundUrl-->");<!--BackgroundEnd-->}
a{color:#24292e;cursor:pointer;text-decoration:none}
@ -151,7 +151,7 @@
<ion-icon name="arrow-back"></ion-icon>
</a>
<!--BackArrowEnd-->
<h3 class="table-header"><!--Path--></h3>
<h3 class="table-header"><!--PathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--PathArrayEnd--></h3>
</div>
<div class="list-body-container">
<!--EncryptedStart-->
@ -222,6 +222,7 @@
<a onclick="sortby('a');"><!--constStr@File--></a>
<!--ShowThumbnailsStart-->
&nbsp;&nbsp;&nbsp;
<label><input type="checkbox" id="originalpic"><!--constStr@OriginalPic--></label>
<button onclick="showthumbnails(this);"><!--constStr@ShowThumbnails--></button>
<!--ShowThumbnailsEnd-->
&nbsp;
@ -246,7 +247,7 @@
</li>
<!--AdminEnd-->
<ion-icon name="folder"></ion-icon>
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->/"><!--FileEncodeReplaceName--></a>
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/"><!--FileEncodeReplaceName--></a>
</td>
<td class="updated_at" id="folder_time<!--filenum-->"><!--lastModifiedDateTime--></td>
<td class="size" id="folder_size<!--filenum-->"><!--size--></td>
@ -475,11 +476,14 @@
function changelanguage(str)
{
if (str=='Language') str = '';
document.cookie='language='+str+'; path=/';
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie='language='+str+'; path=/; '+expires;
location.href = location.href;
}
<!--ListStart-->
var root = '<!--base_disk_path-->';
/*var root = '<!--base_disk_path-->';
function path_format(path) {
path = '/' + path + '/';
while (path.indexOf('//') !== -1) {
@ -499,7 +503,7 @@
}
e.innerHTML += paths[paths.length - 1];
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
});
});*/
<!--IsFileStart-->
var $url = document.getElementById('url');
if ($url) {
@ -632,29 +636,37 @@
<!--ReadmemdEnd-->
<!--ShowThumbnailsStart-->
function showthumbnails(obj) {
images = [<!--ImgExts-->];
var files=document.getElementsByName('filelist');
for ($i=0;$i<files.length;$i++) {
str=files[$i].innerText;
if (str.substr(-1)==' ') str=str.substr(0,str.length-1);
if (!str) return;
if (!str) continue;
strarry=str.split('.');
ext=strarry[strarry.length-1].toLowerCase();
images = [<!--ImgExts-->];
if (images.indexOf(ext)>-1) get_thumbnails_url(str, files[$i]);
if (images.indexOf(ext)>-1) {
if (document.getElementById('originalpic').checked==true) {
var url=files[$i].href;
url=url.substr(0,url.length-8);
files[$i].parentNode.parentNode.innerHTML='<td colspan="3"><img src="'+url+'" alt="'+str+'" onload="if (this.offsetWidth>document.getElementById(\'list-div\').offsetWidth) this.style.width=\'100%\';"></td>';
$i--;
} else {
var nurl=window.location.href;
if (nurl.substr(-1)!="/") nurl+="/";
var url=nurl+str+'?thumbnails';
get_thumbnails_url(url, str, files[$i]);
}
}
}
obj.disabled='disabled';
}
function get_thumbnails_url(str, filea) {
if (!str) return;
var nurl=window.location.href;
if (nurl.substr(-1)!="/") nurl+="/";
function get_thumbnails_url(url, name, filea) {
var xhr = new XMLHttpRequest();
xhr.open("GET", nurl+str+'?thumbnails', true);
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr.open("GET", url, true);
xhr.send('');
xhr.onload = function(e){
if (xhr.status==200) {
if (xhr.responseText!='') filea.innerHTML='<img src="'+xhr.responseText+'" alt="'+str+'">';
if (xhr.responseText!='') filea.innerHTML='<img src="'+xhr.responseText+'" alt="'+name+'">';
} else console.log(xhr.status+'\n'+xhr.responseText);
}
}
@ -812,20 +824,55 @@
tr1.setAttribute('data-to',1);
var td1=document.createElement('td');
tr1.appendChild(td1);
td1.setAttribute('style','width:30%');
td1.setAttribute('style','width:30%;word-break:break-word;');
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
var td2=document.createElement('td');
tr1.appendChild(td2);
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
if (file.size>100*1024*1024*1024) {
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
uploadbuttonshow();
return;
}
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
<!--GuestStart-->
function getext(str) {
strarry=str.split('.');
ext=strarry[strarry.length-1].toLowerCase();
var reg = new RegExp(".","g");
var a = str.replace(reg,"");
if (a == ext) ext = "";
else ext = "." + ext;
return ext;
}
var ext = getext(file.webkitRelativePath||file.name);
var spark = new SparkMD5.ArrayBuffer();
var reader = new FileReader();
var chunksize=10*1024*1024;
var asize = 0;
function readblob(start) {
var end=start+chunksize;
var blob = file.slice(start,end);
reader.readAsArrayBuffer(blob);
}
readblob(asize);
reader.onload = function(e){
td2.innerHTML='<!--constStr@Calculate--> md5: '+(asize*100/file.size).toFixed(2)+'%';
var binary = this.result;
spark.append(binary);
asize += chunksize;
if (asize < file.size) {
readblob(asize);
} else {
var filemd5 = spark.end();
td2.innerHTML='md5: '+filemd5;
upbigfilename = filemd5+ext;
<!--GuestEnd-->
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
var xhr1 = new XMLHttpRequest();
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ encodeURIComponent((file.webkitRelativePath||file.name)) +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr1.send(null);
xhr1.onload = function(e){
@ -838,14 +885,23 @@
uploadbuttonshow();
} else {
td2.innerHTML='<!--constStr@UploadStart--> ...';
binupfile(file,html['uploadUrl'],timea+'_'+i);
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
}
}
if (xhr1.status==409) {
td2.innerHTML='md5: '+filemd5;
tdnum = timea+'_'+i;
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
}
if (i<files.length-1) {
i++;
getuplink(i);
}
}
<!--GuestStart-->
}
}
<!--GuestEnd-->
}
}
function size_format(num) {
@ -866,7 +922,7 @@
}
return num.toFixed(2) + ' GB';
}
function binupfile(file,url,tdnum){
function binupfile(file,url,tdnum,filename){
var label=document.getElementById('upfile_td2_'+tdnum);
var reader = new FileReader();
var StartStr='';
@ -887,9 +943,7 @@
var a = html['nextExpectedRanges'][0];
newstartsize = Number( a.slice(0,a.indexOf("-")) );
StartTime = new Date();
<!--AdminStart-->
asize = newstartsize;
<!--AdminEnd-->
if (newstartsize==0) {
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
} else {
@ -903,19 +957,9 @@
reader.readAsArrayBuffer(blob);
}
readblob(asize);
<!--GuestStart-->
var spark = new SparkMD5.ArrayBuffer();
<!--GuestEnd-->
reader.onload = function(e){
var binary = this.result;
<!--GuestStart-->
spark.append(binary);
if (asize < newstartsize) {
asize += chunksize;
readblob(asize);
return;
}
<!--GuestEnd-->
var xhr = new XMLHttpRequest();
xhr.open("PUT", url, true);
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
@ -936,38 +980,12 @@
if (response['size']>0) {
// contain size, upload finish. 有size说明是最终返回上传结束
var xhr3 = new XMLHttpRequest();
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+encodeURIComponent((file.webkitRelativePath||file.name)));
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr3.send(null);
xhr3.onload = function(e){
console.log(xhr3.responseText+','+xhr3.status);
}
<!--GuestStart-->
var filemd5 = spark.end();
var xhr4 = new XMLHttpRequest();
xhr4.open("GET", '?action=uploaded_rename&filename='+encodeURIComponent((file.webkitRelativePath||file.name))+'&filemd5='+filemd5);
xhr4.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr4.send(null);
xhr4.onload = function(e){
console.log(xhr4.responseText+','+xhr4.status);
var filename;
//if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name'];
//if (xhr4.status==409) filename = filemd5 + (file.webkitRelativePath||file.name).substr((file.webkitRelativePath||file.name).indexOf('.'));
filename = JSON.parse(xhr4.responseText)['name'];
if (filename=='') {
alert('<!--constStr@UploadErrorUpAgain-->');
uploadbuttonshow();
return;
}
var lasturl = location.href;
if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/';
lasturl += filename + '?preview';
//window.open(lasturl);
document.getElementById('upfile_a_'+tdnum).href = lasturl;
document.getElementById('upfile_a1_'+tdnum).href = filename;
document.getElementById('upfile_cpbt_'+tdnum).style.display = "";
}
<!--GuestEnd-->
EndTime=new Date();
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
if (newstartsize==0) {
@ -995,7 +1013,7 @@
xhr.send(binary);
}
} else {
if (window.location.pathname.indexOf('%23')>0||(file.webkitRelativePath||file.name).indexOf('%23')>0) {
if (window.location.pathname.indexOf('%23')>0||filename.indexOf('%23')>0) {
label.innerHTML='<font color="red"><!--constStr@UploadFail23--></font>';
} else {
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';

1414
theme/nchyn_grey.html Normal file

File diff suppressed because it is too large Load Diff

377
theme/nexmoe1.html Normal file
View File

@ -0,0 +1,377 @@
<!--IconValuesStart-->
{
"music":"audiotrack",
"video":"ondemand_video",
"img":"image",
"default":"insert_drive_file"
}
<!--IconValuesEnd-->
<!DOCTYPE html>
<html lang="<!--constStr@language-->">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title><!--Title--></title>
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/css/mdui.css">
<style>
body{background-color:#f2f5fa;padding-bottom:60px;<!--BackgroundStart-->background-position:center bottom;background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundUrl-->");<!--BackgroundEnd-->}
.nexmoe-item{margin:20px -8px 0!important;padding:15px!important;border-radius:5px;background-color:#fff;-webkit-box-shadow:0 .5em 3em rgba(161,177,204,.4);box-shadow:0 .5em 3em rgba(161,177,204,.4);background-color:#fff}
.mdui-img-fluid,.mdui-video-fluid{border-radius:5px;border:1px solid #eee}
.mdui-list{padding:0}
.mdui-list-item{margin:0!important;border-radius:5px;padding:0 10px 0 5px!important;border:1px solid #eee;margin-bottom:10px!important}
.mdui-list-item:last-child{margin-bottom:0!important}
.mdui-list-item:first-child{border:none}
.mdui-toolbar{width:auto;margin-top:60px!important}
.mdui-appbar .mdui-toolbar{height:56px;font-size:16px}
.mdui-toolbar>*{padding:0 6px;margin:0 2px;}
.mdui-toolbar>.mdui-typo-headline{padding:0 16px 0 0}
.mdui-toolbar>i{padding:0}
.mdui-toolbar>a{padding:0 16px;line-height:30px;border-radius:30px;border:1px solid #eee;opacity:.87}
.mdui-toolbar>a:hover,a.mdui-typo-headline,a.active{opacity:1}
.mdui-container{max-width:980px}
.mdui-list>.th{background-color:initial}
.mdui-list-item>a{width:100%;line-height:48px}
.mdui-toolbar>a:last-child{opacity:1;background-color:#1e89f2;color:#ffff}
.more-disk{display: inline-block;max-width: 100px;}
.more-disk div{
list-style:none;
position:absolute;display:none;background:#ffffff;border-radius:5px;margin:0 0 0 -10px;/*padding:0 7px;*/color:#205D67;z-index:1;
box-shadow: 0 0.5em 3em rgba(161,177,204,.4);
}
.more-disk:hover div{display:block}
.more-disk div li{line-height:normal;padding: 3px 10px;}
.more-disk div li a{text-decoration: none; color:rgba(0,0,0,.3);}
.more-disk div li a:hover{color:rgba(0,0,0,.87);}
.more-disk div li a[now]{color:rgba(0,0,0,1);}
@media screen and (max-width:980px){
.mdui-list-item .mdui-text-right{display:none}
.mdui-container{width:100%!important;margin:0}
/*.mdui-toolbar>*{display:none}*/
.mdui-toolbar>a:last-child,.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child{display:block}
}
</style>
<!--customCss-->
<script src="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/js/mdui.min.js"></script>
</head>
<body class="mdui-theme-primary-blue-grey mdui-theme-accent-blue">
<div class="mdui-container">
<div class="mdui-container-fluid">
<div class="mdui-toolbar nexmoe-item" id="toolbar">
<a href="<!--base_path-->"><!--Sitename--></a>
<!--MultiDiskAreaStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<div class="more-disk">
<span><!--DiskNameNow--></span>
<div>
<!--MultiDisksStart-->
<li><a href="<!--MultiDisksUrl-->" <!--MultiDisksNow-->><!--MultiDisksName--></a></li>
<!--MultiDisksEnd-->
</div>
</div>
<!--MultiDiskAreaEnd-->
<!--PathArrayStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<a href="<!--PathArrayLink-->"><!--PathArrayName--></a>
<!--PathArrayEnd-->
</div>
</div>
<!--ListStart-->
<div class="mdui-container-fluid">
<!--EncryptedStart-->
<div class="mdui-col-md-6 mdui-col-offset-md-3">
<!--<center><h1 class="mdui-typo-display-2-opacity">这是一个受保护的文件夹,您需要提供访问密码才能查看。</h1></center>-->
<form action="" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<i class="mdui-icon material-icons">https</i>
<label class="mdui-textfield-label"><!--constStr@InputPassword--></label>
<input name="password1" class="mdui-textfield-input" type="password"/>
</div>
<br>
<button type="submit" class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme">
<i class="mdui-icon material-icons">fingerprint</i>
<!--constStr@Submit-->
</button>
</form>
</div>
<!--EncryptedEnd-->
<!--GuestUploadStart-->
<!--
<div class="nexmoe-item" style="padding: 100px!important;">
<div class="mdui-typo-display-3-opacity" style="text-align:center;">OneImages</div>
<form action="" method="post" enctype="multipart/form-data">
<input class="mdui-center" type="file" style="margin: 50px 0;" name="file" />
<div class="mdui-row-xs-3">
<div class="mdui-col"></div>
<div class="mdui-col">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple"><!--constStr@Upload--></button>
</div>
</div>
</form>
</div>
-->
<!--GuestUploadEnd-->
<!--HeadomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--HeadomfContent-->
</div>
<!--HeadomfEnd-->
<!--HeadmdStart-->
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0">
<!--HeadmdContent-->
</div>
<!--HeadmdEnd-->
<!--IsFileStart-->
<!--IsimgFileStart-->
<div class="nexmoe-item">
<img class="mdui-img-fluid mdui-center" src="<!--FileDownUrl-->"/>
</div>
<!--IsimgFileEnd-->
<!--IstxtFileStart-->
<div class="nexmoe-item">
<pre id="editor" style="white-space: pre-wrap;"><!--TxtContent--></pre>
</div>
<!--IstxtFileEnd-->
<!--IsmusicFileStart-->
<div class="nexmoe-item">
<audio class="mdui-center" src="<!--FileDownUrl-->" controls autoplay style="width: 100%;" ></audio>
</div>
<!--IsmusicFileEnd-->
<!--IsofficeFileStart-->
<div class="nexmoe-item">
<iframe id="office-a" src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->" style="width: 100%;height: 800px" frameborder="0"></iframe>
</div>
<!--IsofficeFileEnd-->
<!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<div class="nexmoe-item">
<div class="mdui-center" id="dplayer"></div>
</div>
<script>
const dp = new DPlayer({
container: document.getElementById('dplayer'),
lang:'zh-cn',
video: {
url: '<!--FileDownUrl-->',
type: 'auto'
}
});
</script>
<!--IsvideoFileEnd-->
<!--IsOtherFileStart-->
<div class="nexmoe-item"><!--constStr@FileNotSupport--></div>
<!--IsOtherFileEnd-->
<a href="<!--FileEncodeReplaceUrl-->" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">file_download</i></a>
<!--IsFileEnd-->
<!--IsFolderStart-->
<style>
.thumb .th{
display: none;
}
.thumb .mdui-text-right{
display: none;
}
.thumb .mdui-list-item a ,.thumb .mdui-list-item {
width:217px;
height: 230px;
float: left;
margin: 10px 10px !important;
}
.thumb .mdui-col-xs-12,.thumb .mdui-col-sm-7{
width:100% !important;
height:230px;
}
.thumb .mdui-list-item .mdui-icon{
font-size:100px;
display: block;
margin-top: 40px;
color: #7ab5ef;
}
.thumb .mdui-list-item span{
float: left;
display: block;
text-align: center;
width:100%;
position: absolute;
top: 180px;
}
</style>
<div class="nexmoe-item">
<div class="mdui-row">
<ul class="mdui-list">
<li class="mdui-list-item th">
<div class="mdui-col-xs-12 mdui-col-sm-7"><!--constStr@File--> <i class="mdui-icon material-icons icon-sort" data-sort="name" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-3 mdui-text-right"><!--constStr@EditTime--> <i class="mdui-icon material-icons icon-sort" data-sort="date" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--constStr@Size--> <i class="mdui-icon material-icons icon-sort" data-sort="size" data-order="downward">expand_more</i></div>
</li>
<!--BackArrowStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--BackArrowUrl-->">
<div class="mdui-col-xs-12 mdui-col-sm-7">
<i class="mdui-icon material-icons">arrow_upward</i>
..
</div>
<div class="mdui-col-sm-3 mdui-text-right"></div>
<div class="mdui-col-sm-2 mdui-text-right"></div>
</a>
</li>
<!--BackArrowEnd-->
<!--FolderListStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--FileEncodeReplaceUrl-->/">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons">folder_open</i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</li>
<!--FolderListEnd-->
<!--FileListStart-->
<li class="mdui-list-item file mdui-ripple">
<a href="<!--FileEncodeReplaceUrl-->?preview" target="_blank">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons"><!--IconValue--></i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</li>
<!--FileListEnd-->
<!--MorePageStart-->
<form action="" method="POST" id="nextpageform">
<input type="hidden" id="pagenum" name="pagenum" value="">
<li class="mdui-list-item th">
<div class="mdui-col-sm-6 mdui-left mdui-text-left">
<!--PrePageStart-->
<a onclick="nextpage(<!--PrePageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@PrePage--></a>
<!--PrePageEnd-->
<!--NextPageStart-->
<a onclick="nextpage(<!--NextPageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@NextPage--></a>
<!--NextPageEnd-->
</div>
<div class="mdui-col-sm-6 mdui-right mdui-text-right">
<div class="mdui-right mdui-text-right"><span class="mdui-chip-title">Page: <!--MorePageListStart--><!--MorePageListEnd--><!--MorePageListNowStart--><!--PageNum--><!--MorePageListNowEnd-->/<!--MaxPageNum--></span></div>
</div>
</li>
</form>
<!--MorePageEnd-->
</ul>
</div>
</div>
<!--ReadmemdStart-->
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0">
<!--ReadmemdContent-->
</div>
<!--ReadmemdEnd-->
<!--FootomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--FootomfContent-->
</div>
<!--FootomfEnd-->
</div>
<!--ShowThumbnailsStart-->
<a href="javascript:thumb();" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">format_list_bulleted</i></a>
<!--ShowThumbnailsEnd-->
<!--IsFolderEnd-->
<!--ListEnd-->
<!--MdRequireStart--><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><!--MdRequireEnd-->
<script>
<!--MorePageStart-->
function nextpage(num) {
document.getElementById('pagenum').value=num;
document.getElementById('nextpageform').submit();
}
<!--MorePageEnd-->
$ = mdui.JQ;
$.fn.extend({
sortElements: function (comparator, getSortable) {
getSortable = getSortable || function () { return this; };
var placements = this.map(function () {
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function () {
parentNode.insertBefore(this, nextSibling);
parentNode.removeChild(nextSibling);
};
});
return [].sort.call(this, comparator).each(function (i) {
placements[i].call(getSortable.call(this));
});
}
});
function downall() {
let dl_link_list = Array.from(document.querySelectorAll("li a"))
.map(x => x.href) // 所有list中的链接
.filter(x => x.slice(-1) != "/"); // 筛选出非文件夹的文件下载链接
let blob = new Blob([dl_link_list.join("\r\n")], {
type: 'text/plain'
}); // 构造Blog对象
let a = document.createElement('a'); // 伪造一个a对象
a.href = window.URL.createObjectURL(blob); // 构造href属性为Blob对象生成的链接
a.download = "folder_download_link.txt"; // 文件名称,你可以根据你的需要构造
a.click() // 模拟点击
a.remove();
}
<!--ShowThumbnailsStart-->
function thumb(){
if($('.mdui-fab i').text() == "apps"){
$('.mdui-fab i').text("format_list_bulleted");
$('.nexmoe-item').removeClass('thumb');
$('.nexmoe-item .mdui-icon').show();
$('.nexmoe-item .mdui-list-item').css("background","");
}else{
$('.mdui-fab i').text("apps");
$('.nexmoe-item').addClass('thumb');
$('.mdui-col-xs-12 i.mdui-icon').each(function(){
if($(this).text() == "image"){
var thumbnails = $(this).parent().parent().attr('href');
thumbnails = thumbnails.substr(0, thumbnails.length-8)+'?thumbnails&location';
$(this).hide();
$(this).parent().parent().parent().css("background","url("+thumbnails+") no-repeat center top");
}
});
}
}
<!--ShowThumbnailsEnd-->
$(function(){
$('.file a').each(function(){
$(this).on('click', function () {
var form = $('<form target=_blank method=post></form>').attr('action', $(this).attr('href')).get(0);
$(document.body).append(form);
form.submit();
$(form).remove();
return false;
});
});
$('.icon-sort').on('click', function () {
let sort_type = $(this).attr("data-sort"), sort_order = $(this).attr("data-order");
let sort_order_to = (sort_order === "less") ? "more" : "less";
$('li[data-sort]').sortElements(function (a, b) {
let data_a = $(a).attr("data-sort-" + sort_type), data_b = $(b).attr("data-sort-" + sort_type);
let rt = data_a.localeCompare(data_b, undefined, {numeric: true});
return (sort_order === "more") ? 0-rt : rt;
});
$(this).attr("data-order", sort_order_to).text("expand_" + sort_order_to);
});
});
document.querySelectorAll('.markdown').forEach(function (e) {
e.innerHTML = marked(e.innerHTML);
});
</script>
</body>
</html>

580
theme/nexmoe2.html Normal file
View File

@ -0,0 +1,580 @@
<!--IconValuesStart-->
{
"music":"audiotrack",
"video":"ondemand_video",
"img":"image",
"default":"insert_drive_file"
}
<!--IconValuesEnd-->
<!DOCTYPE html>
<html lang="<!--constStr@language-->">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title><!--Title--></title>
<link rel="stylesheet" href="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/css/mdui.css">
<script src="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/js/mdui.min.js"></script>
<script src="//cdn.bootcss.com/jquery/1.12.3/jquery.min.js"></script>
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/glightbox/dist/css/glightbox.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<style>
body{<!--BackgroundStart-->background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundUrl-->");<!--BackgroundEnd-->}
.mdui-appbar .mdui-toolbar{
height:64px;
font-size: 15px;
}
.mdui-toolbar>*{
padding: 0 6px;
margin: 0 2px;
opacity:0.5;
}
.mdui-toolbar>.mdui-typo-headline{
padding: 0 1px 0 0;
}
.mdui-toolbar>i{
padding: 0;
}
.mdui-toolbar>a:hover,a.mdui-typo-headline,a.active{
opacity:1;
}
.mdui-container{
max-width:950px;
}
.mdui-list-item{
-webkit-transition:none;
transition:none;
}
.mdui-list>.th{
background-color:initial;
}
.mdui-list-item>a{
width:100%;
line-height: 48px
}
.mdui-list-item{
margin: 2px 0px;
padding:0;
}
.mdui-toolbar>a:last-child{
opacity:1;
}
#instantclick-bar {
background: white;
}
.mdui-video-fluid {
height: -webkit-fill-available;
}
.dplayer-video-wrap .dplayer-video {
height: -webkit-fill-available !important;
}
.gslide iframe, .gslide video {
height: -webkit-fill-available;
}
@media screen and (max-width:950px) {
.mdui-list-item .mdui-text-right{
display: none;
}
.mdui-container{
width:100% !important;
margin:0px;
}
.mdui-toolbar>*{
display: none;
}
.mdui-toolbar>a:last-child,.mdui-toolbar>a:nth-last-of-type(2),.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child,.mdui-toolbar-spacer{
display: block;
}
}
.spec-col{padding:.9em;display:flex;align-items:center;white-space:nowrap;flex:1 50%;min-width:225px}
.spec-type{font-size:1.35em}
.spec-value{font-size:1.25em}
.spec-text{float:left}
.device-section{padding-top:30px}
.spec-device-img{height:auto;height:340px;padding-bottom:30px}
#dl-header{margin:0}
#dl-section{padding-top:10px}
#dl-latest{position:relative;top:50%;transform:translateY(-50%)}
</style>
</head>
<body class=" mdui-appbar-with-toolbar mdui-theme-primary-indigo mdui-theme-accent-pink">
<header class="mdui-appbar mdui-appbar-fixed mdui-color-theme mdui-appbar-inset">
<div class="mdui-toolbar mdui-color-theme">
<span class="mdui-btn mdui-typo-headline mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#main-drawer', swipe: true}" mdui-tooltip="{content: '菜单'}"><i class="mdui-icon material-icons">menu</i></span>
<a href="<!--base_path-->" class="mdui-typo-headline"><!--Sitename--></a>
<!--PathArrayStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<a href="<!--PathArrayLink-->"><!--PathArrayName--></a>
<!--PathArrayEnd-->
<div class="mdui-toolbar-spacer"></div>
<!--ShowThumbnailsStart-->
<a href="javascript:thumb();" id="thumb" class="mdui-btn mdui-btn-icon" mdui-tooltip="{content: '切换显示'}"><i class="mdui-icon material-icons">format_list_bulleted</i></a>
<!--ShowThumbnailsEnd-->
</div>
</header>
<div class="mdui-drawer mdui-drawer-close mdui-color-indigo-50" id="main-drawer">
<div class="mdui-grid-tile">
<!--<a><img src="//image.suning.cn/uimg/ZR/share_order/158562104413864293.jpg"/></a>-->
<div class="mdui-grid-tile-actions mdui-grid-tile-actions-gradient">
<div class="mdui-grid-tile-text">
<div class="mdui-grid-tile-title"><!--Title--></div>
<div class="mdui-grid-tile-subtitle">OneManager</div>
</div>
</div>
</div>
<div class="mdui-list" mdui-collapse="{accordion: true}">
<a href="<!--base_path-->" class="mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon material-icons">home</i>
<div class="mdui-list-item-content"><!--constStr@Home--></div>
</a>
<!--MultiDiskAreaStart-->
<!--MultiDisksStart-->
<a href="<!--MultiDisksUrl-->" class="mdui-list-item mdui-ripple" <!--MultiDisksNow-->>
<i class="mdui-list-item-icon mdui-icon material-icons">cloud</i>
<div class="mdui-list-item-content"><!--MultiDisksName--></div>
</a>
<!--MultiDisksEnd-->
<!--MultiDiskAreaEnd-->
<a href="https://github.com/qkqpttgf/OneManager-php" class="mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon material-icons">code</i>
<div class="mdui-list-item-content">Github</div>
</a>
</div>
</div>
<!--ListStart-->
<!--EncryptedStart-->
<div class="mdui-col-md-6 mdui-col-offset-md-3">
<!--<center><h1 class="mdui-typo-display-2-opacity">这是一个受保护的文件夹,您需要提供访问密码才能查看。</h1></center>-->
<form action="" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<i class="mdui-icon material-icons">https</i>
<label class="mdui-textfield-label"><!--constStr@InputPassword--></label>
<input name="password1" class="mdui-textfield-input" type="password"/>
</div>
<br>
<button type="submit" class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme">
<i class="mdui-icon material-icons">fingerprint</i>
<!--constStr@Submit-->
</button>
</form>
</div>
<!--EncryptedEnd-->
<!--GuestUploadStart-->
<!--
<div class="nexmoe-item" style="padding: 100px!important;">
<div class="mdui-typo-display-3-opacity" style="text-align:center;">OneImages</div>
<form action="" method="post" enctype="multipart/form-data">
<input class="mdui-center" type="file" style="margin: 50px 0;" name="file" />
<div class="mdui-row-xs-3">
<div class="mdui-col"></div>
<div class="mdui-col">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple"><!--constStr@Upload--></button>
</div>
</div>
</form>
</div>
-->
<!--GuestUploadEnd-->
<!--IsFileStart-->
<div class="mdui-container-fluid">
<!--IsimgFileStart-->
<div class="nexmoe-item">
<img class="mdui-img-fluid mdui-center" src="<!--FileDownUrl-->"/>
</div>
<!--IsimgFileEnd-->
<!--IstxtFileStart-->
<div class="nexmoe-item">
<pre id="editor" style="white-space: pre-wrap;"><!--TxtContent--></pre>
</div>
<!--IstxtFileEnd-->
<!--IsmusicFileStart-->
<div class="nexmoe-item">
<audio class="mdui-center" src="<!--FileDownUrl-->" controls autoplay style="width: 100%;" ></audio>
</div>
<!--IsmusicFileEnd-->
<!--IsofficeFileStart-->
<div class="nexmoe-item">
<iframe id="office-a" src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->" style="width: 100%;height: 800px" frameborder="0"></iframe>
</div>
<!--IsofficeFileEnd-->
<!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<div class="nexmoe-item">
<div class="mdui-center" id="dplayer"></div>
</div>
<script>
const dp = new DPlayer({
container: document.getElementById('dplayer'),
lang:'zh-cn',
video: {
url: '<!--FileDownUrl-->',
type: 'auto'
}
});
</script>
<!--IsvideoFileEnd-->
<!--IsOtherFileStart-->
<div class="nexmoe-item"><!--constStr@FileNotSupport--></div>
<!--IsOtherFileEnd-->
</div>
<a href="<!--FileEncodeReplaceUrl-->" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">file_download</i></a>
<!--IsFileEnd-->
<!--IsFolderStart-->
<div class="mdui-container">
<div class="mdui-container-fluid"></div>
<div class="mdui-container-fluid">
<!--HeadomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--HeadomfContent-->
</div>
<!--HeadomfEnd-->
<!--HeadmdStart-->
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0">
<!--HeadmdContent-->
</div>
<!--HeadmdEnd-->
<style>
.thumb .th{
display: none;
}
.thumb .mdui-text-right{
display: none;
}
.thumb .mdui-list-item a ,.thumb .mdui-list-item {
width:213px;
height: 230px;
float: left;
margin: 10px 10px !important;
}
.thumb .mdui-col-xs-12,.thumb .mdui-col-sm-7{
width:100% !important;
height:230px;
}
.thumb .mdui-list-item .mdui-icon{
font-size:100px;
display: block;
margin-top: 40px;
color: #7ab5ef;
}
.thumb .mdui-list-item span{
float: left;
display: block;
text-align: center;
width:100%;
position: absolute;
top: 180px;
}
.thumb .forcedownload {
display: none;
}
</style>
<div class="nexmoe-item">
<div class="mdui-row">
<ul class="mdui-list">
<li class="mdui-list-item th" style="padding-right:36px;">
<div class="mdui-col-xs-12 mdui-col-sm-7"><!--constStr@File--> <i class="mdui-icon material-icons icon-sort" data-sort="name" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-3 mdui-text-right"><!--constStr@EditTime--> <i class="mdui-icon material-icons icon-sort" data-sort="date" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--constStr@Size--> <i class="mdui-icon material-icons icon-sort" data-sort="size" data-order="downward">expand_more</i></div>
</li>
<!--BackArrowStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--BackArrowUrl-->">
<div class="mdui-col-xs-12 mdui-col-sm-7">
<i class="mdui-icon material-icons">arrow_upward</i>
..
</div>
<div class="mdui-col-sm-3 mdui-text-right"></div>
<div class="mdui-col-sm-2 mdui-text-right"></div>
</a>
</li>
<!--BackArrowEnd-->
<!--FolderListStart-->
<li class="mdui-list-item mdui-ripple" data-sort data-sort-name="<!--FileEncodeReplaceName-->" data-sort-date="<!--lastModifiedDateTime-->" data-sort-size="<!--size-->" style="padding-right:36px;">
<a href="<!--FileEncodeReplaceUrl-->/">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons">folder_open</i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</li>
<!--FolderListEnd-->
<!--FileListStart-->
<li class="mdui-list-item file mdui-ripple" data-sort data-sort-name="<!--FileEncodeReplaceName-->" data-sort-date="<!--lastModifiedDateTime-->" data-sort-size="<!--size-->" data-readypreview="<!--FileExt-->">
<a class="<!--FileExtType-->" data-name="<!--FileEncodeReplaceName-->" href="<!--FileEncodeReplaceUrl-->?preview" target="_blank">
<!--<?php if(isImage($item['name']) and $_COOKIE["image_mode"] == "1"):?>
<img class="mdui-img-fluid" src="<?php echo get_absolute_path($root.$path).rawurlencode($item['name']); ?>">
<?php else:?>-->
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons"><!--IconValue--></i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
<div class="forcedownload " >
<a title="<!--constStr@Download-->" href="<!--FileEncodeReplaceUrl-->">
<button class="mdui-btn mdui-ripple mdui-btn-icon"><i class="mdui-icon material-icons">file_download</i></button>
</a>
</div>
</li>
<!--FileListEnd-->
<!--MorePageStart-->
<form action="" method="POST" id="nextpageform">
<input type="hidden" id="pagenum" name="pagenum" value="">
<li class="mdui-list-item th">
<div class="mdui-col-sm-6 mdui-left mdui-text-left">
<!--PrePageStart-->
<a onclick="nextpage(<!--PrePageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@PrePage--></a>
<!--PrePageEnd-->
<!--NextPageStart-->
<a onclick="nextpage(<!--NextPageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@NextPage--></a>
<!--NextPageEnd-->
</div>
<div class="mdui-col-sm-6 mdui-right mdui-text-right">
<div class="mdui-right mdui-text-right"><span class="mdui-chip-title">Page: <!--MorePageListStart--><!--MorePageListEnd--><!--MorePageListNowStart--><!--PageNum--><!--MorePageListNowEnd-->/<!--MaxPageNum--></span></div>
</div>
</li>
</form>
<!--MorePageEnd-->
</ul>
</div>
</div>
<!--ReadmemdStart-->
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0">
<!--ReadmemdContent-->
</div>
<!--ReadmemdEnd-->
<!--FootomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--FootomfContent-->
</div>
<!--FootomfEnd-->
</div>
</div>
<!--IsFolderEnd-->
<!--ListEnd-->
<script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!--MdRequireStart--><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><!--MdRequireEnd-->
<script>
<!--MorePageStart-->
function nextpage(num) {
document.getElementById('pagenum').value=num;
document.getElementById('nextpageform').submit();
}
<!--MorePageEnd-->
var $$ = mdui.JQ;
$$(function() {
$$('.file .iframe').each(function() {
$$(this).on('click', function() {
url=$$(this).attr('href');
//url=url.substr(0,url.length-8);
layer.open({
type: 2,
title: '<a target="_blank" href="'+url+'">'+ $$(this).find('span').text()+'(点击新窗口打开)</a>', //jia,
//shadeClose: true,
move: false,
shade: false,
maxmin: true,
area: ['100%', '100%'],
content: url //le
,min: function(layero){
//zi;
layero.css({top: '90%'})
}
});
return false;
});
});
$('.file .dl').each(function () {
$(this).on('click', function () {
var form = $('<form target=_blank method=post></form>').attr('action', $(this).attr('href')).get(0);
$(document.body).append(form);
form.submit();
$(form).remove();
return false;
});
});
});
window.TC=window.TC||{};
jQuery(".file .audio").click(function(e){
e.preventDefault();
TC.preview_audio(this);
});
TC.preview_audio = function(aud){
if(!TC.aplayer){
TC.aplayerList=[];
jQuery(".file .audio").each(function(){
var ext = jQuery(this).data("readypreview");
var n = jQuery(this).find("span").text();
var l = n.replace("."+ext,".lrc");
var la = jQuery('a[data-name="'+l+'"]');
var lrc = undefined;
if(la.length>0){
lrc = la[0].href+"?s";
}
TC.aplayerList.push({
name:n,
url:this.href.substr(0,this.href.length-8),
artist:" ",
lrc:lrc
});
})
jQuery('<div id="aplayer">').appendTo("body");
TC.aplayer = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
audio: TC.aplayerList,
lrcType: 3
});
}
var k=-1;
for(var i in TC.aplayerList){
if(TC.aplayerList[i].name==jQuery(aud).data("name")){
k=i;
break;
}
}
if(k>=0){
TC.aplayer.list.switch(k);
TC.aplayer.play();
TC.aplayer.setMode("normal");
}
}
$ = mdui.JQ;
$.fn.extend({
sortElements: function (comparator, getSortable) {
getSortable = getSortable || function () { return this; };
var placements = this.map(function () {
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function () {
parentNode.insertBefore(this, nextSibling);
parentNode.removeChild(nextSibling);
};
});
return [].sort.call(this, comparator).each(function (i) {
placements[i].call(getSortable.call(this));
});
}
});
var lightbox = GLightbox();
function downall() {
let dl_link_list = Array.from(document.querySelectorAll("li a"))
.map(x => x.href) // 所有list中的链接
.filter(x => x.slice(-1) != "/"); // 筛选出非文件夹的文件下载链接
let blob = new Blob([dl_link_list.join("\r\n")], {
type: 'text/plain'
}); // 构造Blog对象
let a = document.createElement('a'); // 伪造一个a对象
a.href = window.URL.createObjectURL(blob); // 构造href属性为Blob对象生成的链接
a.download = "folder_download_link.txt"; // 文件名称,你可以根据你的需要构造
a.click() // 模拟点击
a.remove();
}
<!--ShowThumbnailsStart-->
function thumb(){
if($('#thumb i').text() == "apps"){
$('#thumb i').text("format_list_bulleted");
$('.nexmoe-item').removeClass('thumb');
$('.nexmoe-item .mdui-icon').show();
$('.nexmoe-item .mdui-list-item').css("background","");
}else{
$('#thumb i').text("apps");
$('.nexmoe-item').addClass('thumb');
$('.mdui-col-xs-12 i.mdui-icon').each(function(){
//if($(this).text() == "image" || $(this).text() == "ondemand_video"){
if($(this).text() == "image"){
var thumbnails = $(this).parent().parent().attr('href');
//var thumb =(href.indexOf('?') == -1)?'?t=220':'&t=220';
thumbnails = thumbnails.substr(0, thumbnails.length-8)+'?thumbnails&location';
$(this).hide();
//$(this).parent().parent().parent().css("background","url("+href+thumb+") no-repeat center top");
$(this).parent().parent().parent().css("background","url("+thumbnails+") no-repeat center top");
}
});
}
}
<!--ShowThumbnailsEnd-->
$(function(){
$('.icon-sort').on('click', function () {
let sort_type = $(this).attr("data-sort"), sort_order = $(this).attr("data-order");
let sort_order_to = (sort_order === "less") ? "more" : "less";
$('li[data-sort]').sortElements(function (a, b) {
let data_a = $(a).attr("data-sort-" + sort_type), data_b = $(b).attr("data-sort-" + sort_type);
let rt = data_a.localeCompare(data_b, undefined, {numeric: true});
return (sort_order === "more") ? 0-rt : rt;
});
$(this).attr("data-order", sort_order_to).text("expand_" + sort_order_to);
});
});
var ckname='image_mode';
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function setCookie(key,value,day){
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(key);
if(cval!=null)
document.cookie= key + "="+cval+";expires="+exp.toGMTString();
var date = new Date();
var nowDate = date.getDate();
date.setDate(nowDate + day);
var cookie = key+"="+value+"; expires="+date;
document.cookie = cookie;
return cookie;
}
$('#image_view').on('click', function () {
if($(this).prop('checked') == true){
setCookie(ckname,1,1);
window.location.href=window.location.href;
}else{
setCookie(ckname,0,1);
window.location.href=window.location.href;
}
});
document.querySelectorAll('.markdown').forEach(function (e) {
e.innerHTML = marked(e.innerHTML);
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

606
theme/renexmoe.html Normal file
View File

@ -0,0 +1,606 @@
<!--IconValuesStart-->
{
"music":"audiotrack",
"video":"ondemand_video",
"img":"image",
"default":"insert_drive_file"
}
<!--IconValuesEnd-->
<script>
var primary_color = "orange";
var accent_color = "deep-orange";
var bug = 0;
</script>
<!DOCTYPE html>
<html lang="<!--constStr@language-->">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title><!--Title--></title>
<link rel="stylesheet" href="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/css/mdui.css">
<script src="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/js/mdui.min.js"></script>
<script src="https://cdn.my-file.cn/mduilw/MDUILW/jquery.min.js"></script>
<!--<script src="https://cdn.my-file.cn/mduilw/MDUILW/jquery.pjax.js"></script>-->
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/glightbox/dist/css/glightbox.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<style>
body{
<!--BackgroundStart-->
background-repeat:no-repeat;
background-size:cover;
background-attachment:fixed;
background-image:url("<!--BackgroundUrl-->");
<!--BackgroundEnd-->
}
.mdui-appbar .mdui-toolbar{
height:64px;
font-size: 15px;
}
.mdui-toolbar>*{
padding: 0 6px;
margin: 0 2px;
opacity:0.5;
}
.mdui-toolbar>.mdui-typo-headline{
padding: 0 1px 0 0;
}
.mdui-toolbar>i{
padding: 0;
}
.mdui-toolbar>a:hover,a.mdui-typo-headline,a.active{
opacity:1;
}
.mdui-container{
max-width:950px;
}
.mdui-list-item{
-webkit-transition:none;
transition:none;
}
.mdui-toolbar>a:last-child{
opacity:1;
}
#instantclick-bar {
background: white;
}
.mdui-video-fluid {
height: -webkit-fill-available;
}
.dplayer-video-wrap .dplayer-video {
height: -webkit-fill-available !important;
}
.gslide iframe, .gslide video {
height: -webkit-fill-available;
}
@media screen and (max-width:950px) {
.mdui-list-item .mdui-text-right{
display: none;
}
.mdui-container{
width:100% !important;
margin:0px;
}
.mdui-toolbar>*{
display: none;
}
.mdui-toolbar>a:last-child,.mdui-toolbar>a:nth-last-of-type(2),.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child,.mdui-toolbar-spacer{
display: block;
}
}
.spec-col{padding:.9em;display:flex;align-items:center;white-space:nowrap;flex:1 50%;min-width:225px}
.spec-type{font-size:1.35em}
.spec-value{font-size:1.25em}
.spec-text{float:left}
.device-section{padding-top:30px}
.spec-device-img{height:auto;height:340px;padding-bottom:30px}
#dl-header{margin:0}
#dl-section{padding-top:10px}
#dl-latest{position:relative;top:50%;transform:translateY(-50%)}
</style>
</head>
<body id="main-body">
<header class="mdui-appbar">
<div class="mdui-toolbar mdui-color-theme mdui-appbar-inset">
<span class="mdui-btn mdui-typo-headline mdui-btn-icon mdui-ripple" mdui-drawer="{target: '#main-drawer', swipe: true}" mdui-tooltip="{content: '菜单'}"><i class="mdui-icon material-icons mdui-text-color-white-icon">menu</i></span>
<a href="<!--base_path-->" class="mdui-typo-headline"><!--Sitename--></a>
<!--PathArrayStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<a href="<!--PathArrayLink-->"><!--PathArrayName--></a>
<!--PathArrayEnd-->
<div class="mdui-toolbar-spacer"></div>
<!--ShowThumbnailsStart-->
<a href="javascript:thumb();" id="thumb" class="mdui-btn mdui-btn-icon mdui-ripple" mdui-tooltip="{content: '切换显示'}"><i class="mdui-icon material-icons">format_list_bulleted</i></a>
<!--ShowThumbnailsEnd-->
</div>
</header>
<div class="mdui-drawer mdui-drawer-close" id="main-drawer">
<div class="mdui-list" mdui-collapse="{accordion: true}">
<li class="mdui-list-item mdui-ripple" href="javascript:void(0);" onclick="darkmod_use()">
<a class="mdui-list-item-icon mdui-icon material-icons">brightness_4</a>
<a class="mdui-list-item-content">深色模式</a>
</li>
<li class="mdui-list-item mdui-ripple">
<a href="<!--base_path-->" class="mdui-list-item-icon mdui-icon material-icons">home</a>
<a href="<!--base_path-->" class="mdui-list-item-content"><!--constStr@Home--></a>
</li>
<!--MultiDiskAreaStart-->
<!--MultiDisksStart-->
<a href="<!--MultiDisksUrl-->" class="mdui-list-item mdui-ripple" <!--MultiDisksNow-->>
<i class="mdui-list-item-icon mdui-icon material-icons">cloud</i>
<div class="mdui-list-item-content"><!--MultiDisksName--></div>
</a>
<!--MultiDisksEnd-->
<!--MultiDiskAreaEnd-->
<a href="https://github.com/qkqpttgf/OneManager-php" class="mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon material-icons">code</i>
<div class="mdui-list-item-content">Github</div>
</a>
</div>
</div>
<!--ListStart-->
<!--EncryptedStart-->
<div class="mdui-col-md-6 mdui-col-offset-md-3" id="pjax-main">
<!--<center><h1 class="mdui-typo-display-2-opacity">这是一个受保护的文件夹,您需要提供访问密码才能查看。</h1></center>-->
<form action="" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<i class="mdui-icon material-icons">https</i>
<label class="mdui-textfield-label"><!--constStr@InputPassword--></label>
<input name="password1" class="mdui-textfield-input" type="password"/>
</div>
<br>
<button type="submit" class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme">
<i class="mdui-icon material-icons">fingerprint</i>
<!--constStr@Submit-->
</button>
</form>
</div>
<!--EncryptedEnd-->
<!--GuestUploadStart-->
<!--
<div class="nexmoe-item" style="padding: 100px!important;" id="pjax-main">
<div class="mdui-typo-display-3-opacity" style="text-align:center;">OneImages</div>
<form action="" method="post" enctype="multipart/form-data">
<input class="mdui-center" type="file" style="margin: 50px 0;" name="file" />
<div class="mdui-row-xs-3">
<div class="mdui-col"></div>
<div class="mdui-col">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple"><!--constStr@Upload--></button>
</div>
</div>
</form>
</div>
-->
<!--GuestUploadEnd-->
<!--IsFileStart-->
<div class="mdui-container-fluid" id="pjax-main">
<!--IsimgFileStart-->
<div class="nexmoe-item">
<img class="mdui-img-fluid mdui-center mdui-m-t-5 "src="<!--FileDownUrl-->"/>
</div>
<!--IsimgFileEnd-->
<!--IstxtFileStart-->
<div class="nexmoe-item">
<pre id="editor" style="white-space: pre-wrap;"><!--TxtContent--></pre>
</div>
<!--IstxtFileEnd-->
<!--IsmusicFileStart-->
<div class="nexmoe-item">
<audio class="mdui-center" src="<!--FileDownUrl-->" controls autoplay style="width: 100%;" ></audio>
</div>
<!--IsmusicFileEnd-->
<!--IsofficeFileStart-->
<div class="nexmoe-item">
<iframe id="office-a" src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->" style="width: 100%;height: 800px" frameborder="0"></iframe>
</div>
<!--IsofficeFileEnd-->
<!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<div class="nexmoe-item mdui-center" style="width: 70%;height:90%;" >
<div id="dplayer"></div>
</div>
<script>
const dp = new DPlayer({
container: document.getElementById('dplayer'),
lang:'zh-cn',
video: {
url: '<!--FileDownUrl-->',
type: 'auto'
}
});
</script>
<!--IsvideoFileEnd-->
<!--IsOtherFileStart-->
<div class="nexmoe-item"><!--constStr@FileNotSupport--></div>
<!--IsOtherFileEnd-->
</div>
<a href="<!--FileEncodeReplaceUrl-->" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">file_download</i></a>
<!--IsFileEnd-->
<!--IsFolderStart-->
<div class="mdui-container">
<div class="mdui-container-fluid"></div>
<div class="mdui-container-fluid">
<!--HeadomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--HeadomfContent-->
</div>
<!--HeadomfEnd-->
<!--HeadmdStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">face</i></span>
<span class="mdui-chip-title">HEAD.md</span>
</div>-->
<!--HeadmdContent-->
</div>
<!--HeadmdEnd-->
<style>
.thumb .th{
display: none;
}
.thumb .mdui-text-right{
display: none;
}
.thumb .mdui-list-item a ,.thumb .mdui-list-item {
width:213px;
height: 230px;
float: left;
margin: 10px 10px !important;
}
.thumb .mdui-col-xs-12,.thumb .mdui-col-sm-7{
width:100% !important;
height:230px;
}
.thumb .mdui-list-item .mdui-icon{
font-size:100px;
display: block;
margin-top: 40px;
color: #7ab5ef;
}
.thumb .mdui-list-item span{
float: left;
display: block;
text-align: center;
width:100%;
position: absolute;
top: 180px;
}
.thumb .forcedownload {
display: none;
}
</style>
<div class="nexmoe-item">
<div class="mdui-row">
<ul class="mdui-list">
<li class="mdui-list-item th mdui-ripple" style="padding-right:36px;">
<div class="mdui-col-xs-12 mdui-col-sm-7"><!--constStr@File--> <i class="mdui-icon material-icons icon-sort" data-sort="name" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-3 mdui-text-right"><!--constStr@EditTime--> <i class="mdui-icon material-icons icon-sort" data-sort="date" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--constStr@Size--> <i class="mdui-icon material-icons icon-sort" data-sort="size" data-order="downward">expand_more</i></div>
</li>
<!--BackArrowStart-->
<li class="mdui-list-item mdui-ripple">
<div class="mdui-row mdui-col-sm-12">
<a href="<!--BackArrowUrl-->">
<div class="mdui-col-xs-7">
<i class="mdui-icon material-icons">arrow_upward</i>
..
</div>
<div class="mdui-col-xs-3 mdui-text-right"></div>
<div class="mdui-col-xs-2 mdui-text-right"></div>
</a>
</div>
</li>
<!--BackArrowEnd-->
<!--FolderListStart-->
<li class="mdui-list-item mdui-ripple" data-sort data-sort-name="<!--FileEncodeReplaceName-->" data-sort-date="<!--lastModifiedDateTime-->" data-sort-size="<!--size-->" style="padding-right:36px;">
<div class="mdui-row mdui-col-sm-12">
<a href="<!--FileEncodeReplaceUrl-->/">
<div class="mdui-col-xs-7 mdui-text-truncate">
<i class="mdui-icon material-icons">folder_open</i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-xs-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-xs-2 mdui-text-right"><!--size--></div>
</a>
</div>
</li>
<!--FolderListEnd-->
<!--FileListStart-->
<li class="mdui-list-item file mdui-ripple" data-sort data-sort-name="<!--FileEncodeReplaceName-->" data-sort-date="<!--lastModifiedDateTime-->" data-sort-size="<!--size-->" data-readypreview="<!--FileExt-->">
<a class="<!--FileExtType-->" data-name="<!--FileEncodeReplaceName-->" href="<!--FileEncodeReplaceUrl-->?preview" target="_blank">
<!--<?php if(isImage($item['name']) and $_COOKIE["image_mode"] == "1"):?>
<img class="mdui-img-fluid" src="<?php echo get_absolute_path($root.$path).rawurlencode($item['name']); ?>">
<?php else:?>-->
<div class="mdui-row mdui-col-sm-12">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons"><!--IconValue--></i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</div>
<div class="forcedownload " >
<a title="<!--constStr@Download-->" href="<!--FileEncodeReplaceUrl-->">
<button class="mdui-btn mdui-ripple mdui-btn-icon"><i class="mdui-icon material-icons">file_download</i></button>
</a>
</div>
</li>
<!--FileListEnd-->
<!--MorePageStart-->
<form action="" method="POST" id="nextpageform">
<input type="hidden" id="pagenum" name="pagenum" value="">
<li class="mdui-list-item th">
<div class="mdui-col-sm-6 mdui-left mdui-text-left">
<!--PrePageStart-->
<a onclick="nextpage(<!--PrePageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@PrePage--></a>
<!--PrePageEnd-->
<!--NextPageStart-->
<a onclick="nextpage(<!--NextPageNum-->);" class="mdui-btn mdui-btn-raised"><!--constStr@NextPage--></a>
<!--NextPageEnd-->
</div>
<div class="mdui-col-sm-6 mdui-right mdui-text-right">
<div class="mdui-right mdui-text-right"><span class="mdui-chip-title">Page: <!--MorePageListStart--><!--MorePageListEnd--><!--MorePageListNowStart--><!--PageNum--><!--MorePageListNowEnd-->/<!--MaxPageNum--></span></div>
</div>
</li>
</form>
<!--MorePageEnd-->
</ul>
</div>
</div>
<!--ReadmemdStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">face</i></span>
<span class="mdui-chip-title">README.md</span>
</div>-->
<!--ReadmemdContent-->
</div>
<!--ReadmemdEnd-->
<!--FootomfStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--FootomfContent-->
</div>
<!--FootomfEnd-->
</div>
</div>
<!--IsFolderEnd-->
<!--ListEnd-->
<script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<script>
<!--MorePageStart-->
function nextpage(num) {
document.getElementById('pagenum').value=num;
document.getElementById('nextpageform').submit();
}
<!--MorePageEnd-->
var $$ = mdui.JQ;
$$(function() {
$$('.file .iframe').each(function() {
$$(this).on('click', function() {
url=$$(this).attr('href');
//url=url.substr(0,url.length-8);
layer.open({
type: 2,
title: '<a target="_blank" href="'+url+'">'+ $$(this).find('span').text()+'(点击新窗口打开)</a>', //jia,
//shadeClose: true,
move: false,
shade: false,
maxmin: true,
area: ['100%', '100%'],
content: url //le
,min: function(layero){
//zi;
layero.css({top: '90%'})
}
});
return false;
});
});
$('.file .dl').each(function () {
$(this).on('click', function () {
var form = $('<form target=_blank method=post></form>').attr('action', $(this).attr('href')).get(0);
$(document.body).append(form);
form.submit();
$(form).remove();
return false;
});
});
});
window.TC=window.TC||{};
jQuery(".file .audio").click(function(e){
e.preventDefault();
TC.preview_audio(this);
});
TC.preview_audio = function(aud){
if(!TC.aplayer){
TC.aplayerList=[];
jQuery(".file .audio").each(function(){
var ext = jQuery(this).data("readypreview");
var n = jQuery(this).find("span").text();
var l = n.replace("."+ext,".lrc");
var la = jQuery('a[data-name="'+l+'"]');
var lrc = undefined;
if(la.length>0){
lrc = la[0].href+"?s";
}
TC.aplayerList.push({
name:n,
url:this.href.substr(0,this.href.length-8),
artist:" ",
lrc:lrc
});
})
jQuery('<div id="aplayer">').appendTo("body");
TC.aplayer = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
audio: TC.aplayerList,
lrcType: 3
});
}
var k=-1;
for(var i in TC.aplayerList){
if(TC.aplayerList[i].name==jQuery(aud).data("name")){
k=i;
break;
}
}
if(k>=0){
TC.aplayer.list.switch(k);
TC.aplayer.play();
TC.aplayer.setMode("normal");
}
}
$ = mdui.JQ;
$.fn.extend({
sortElements: function (comparator, getSortable) {
getSortable = getSortable || function () { return this; };
var placements = this.map(function () {
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function () {
parentNode.insertBefore(this, nextSibling);
parentNode.removeChild(nextSibling);
};
});
return [].sort.call(this, comparator).each(function (i) {
placements[i].call(getSortable.call(this));
});
}
});
var lightbox = GLightbox();
function downall() {
let dl_link_list = Array.from(document.querySelectorAll("li a"))
.map(x => x.href) // 所有list中的链接
.filter(x => x.slice(-1) != "/"); // 筛选出非文件夹的文件下载链接
let blob = new Blob([dl_link_list.join("\r\n")], {
type: 'text/plain'
}); // 构造Blog对象
let a = document.createElement('a'); // 伪造一个a对象
a.href = window.URL.createObjectURL(blob); // 构造href属性为Blob对象生成的链接
a.download = "folder_download_link.txt"; // 文件名称,你可以根据你的需要构造
a.click() // 模拟点击
a.remove();
}
<!--ShowThumbnailsStart-->
function thumb(){
if($('#thumb i').text() == "apps"){
$('#thumb i').text("format_list_bulleted");
$('.nexmoe-item').removeClass('thumb');
$('.nexmoe-item .mdui-icon').show();
$('.nexmoe-item .mdui-list-item').css("background","");
}else{
$('#thumb i').text("apps");
$('.nexmoe-item').addClass('thumb');
$('.mdui-col-xs-12 i.mdui-icon').each(function(){
//if($(this).text() == "image" || $(this).text() == "ondemand_video"){
if($(this).text() == "image"){
var thumbnails = $(this).parent().parent().attr('href');
//var thumb =(href.indexOf('?') == -1)?'?t=220':'&t=220';
thumbnails = thumbnails.substr(0, thumbnails.length-8)+'?thumbnails&location';
$(this).hide();
//$(this).parent().parent().parent().css("background","url("+href+thumb+") no-repeat center top");
$(this).parent().parent().parent().css("background","url("+thumbnails+") no-repeat center top");
}
});
}
}
<!--ShowThumbnailsEnd-->
$(function(){
$('.icon-sort').on('click', function () {
let sort_type = $(this).attr("data-sort"), sort_order = $(this).attr("data-order");
let sort_order_to = (sort_order === "less") ? "more" : "less";
$('li[data-sort]').sortElements(function (a, b) {
let data_a = $(a).attr("data-sort-" + sort_type), data_b = $(b).attr("data-sort-" + sort_type);
let rt = data_a.localeCompare(data_b, undefined, {numeric: true});
return (sort_order === "more") ? 0-rt : rt;
});
$(this).attr("data-order", sort_order_to).text("expand_" + sort_order_to);
});
});
var ckname='image_mode';
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function setCookie(key,value,day){
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(key);
if(cval!=null)
document.cookie= key + "="+cval+";expires="+exp.toGMTString();
var date = new Date();
var nowDate = date.getDate();
date.setDate(nowDate + day);
var cookie = key+"="+value+"; expires="+date;
document.cookie = cookie;
return cookie;
}
$('#image_view').on('click', function () {
if($(this).prop('checked') == true){
setCookie(ckname,1,1);
window.location.href=window.location.href;
}else{
setCookie(ckname,0,1);
window.location.href=window.location.href;
}
});
var mainbody = document.getElementById("main-body");
var darkmod = 0;
var pri_class = "mdui-theme-primary-"+primary_color;
var acc_class = "mdui-theme-accent-"+accent_color;
mainbody.classList.add(acc_class);
mainbody.classList.add(pri_class);
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
{mainbody.classList.add("mdui-theme-layout-dark");darkmod = 1}
function darkmod_use(){
if (darkmod == 1){
mainbody.classList.remove("mdui-theme-layout-dark");darkmod = 0;
} else {
mainbody.classList.add("mdui-theme-layout-dark");darkmod = 1;
}};
//$(document).pjax('a', '#pjax-main' , {fragment:'#pjax-main', timeout:8000});
</script>
</body>
</html>

View File

@ -1,5 +1,6 @@
<font color=#CCCCCC >
Update Data:
20200607-1856.19 add platform: Aliyun Function Compute. add setting: replace sharepoint.com to a proxy server name. add setting: disableShowThumb,customTheme. add function: php hosting website can update by a click 现在可以安装到阿里函数计算FC了。php空间可以一键更新了。可以设置某个盘替换sharpoint.com域名为你的反代域名。新增disableShowThumb,customTheme。
20200503-1848.18 Rebuild theme. Add custom Css & custom Script, add FunctionalityFile: head.omf & foot.omf 重建主题文件结构。增加自定义css与自定义script。增加2个功能文件head.omf、foot.omf。
20200402-1830.17 Oneclick update can select which branch to update. Now use the accept language instead of the language config.一键更新可以选择哪个分支了。现在开始使用浏览器语言抛弃language设置。
20200326-0001.16 You can add sharepoint site drive as a disk,you must reinstall after update.可以将sharepoint网站添加成一个盘由于结构改变升级后只能重装。