Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41350cc604 | ||
|
|
372a42bc05 | ||
|
|
b8c4cc1312 | ||
|
|
4e434ede6b | ||
|
|
086ac6d3e0 | ||
|
|
26b49c7a69 | ||
|
|
10a071df64 | ||
|
|
352a078829 | ||
|
|
de5ccd74cb | ||
|
|
218e7e5230 | ||
|
|
40eca60aba | ||
|
|
67da665f11 | ||
|
|
6b5c26b897 | ||
|
|
4d48228d8a | ||
|
|
20d210945e | ||
|
|
95a62a9d81 | ||
|
|
6ed09dde72 | ||
|
|
bc38d419e0 | ||
|
|
432fdc5f46 | ||
|
|
7c09b0f33c | ||
|
|
b0f10e1434 | ||
|
|
7a4398a55b | ||
|
|
9ed1b58c8d | ||
|
|
4add1167db |
+183
-43
@@ -1120,57 +1120,67 @@ function adminoperate($path)
|
||||
{
|
||||
$path1 = path_format($_SERVER['list_path'] . path_format($path));
|
||||
if (substr($path1,-1)=='/') $path1=substr($path1,0,-1);
|
||||
$tmpget = $_GET;
|
||||
$tmppost = $_POST;
|
||||
$tmparr['statusCode'] = 0;
|
||||
if (isset($_GET['rename_newname'])&&$_GET['rename_newname']!=$_GET['rename_oldname'] && $_GET['rename_newname']!='') {
|
||||
if ( (isset($tmpget['rename_newname'])&&$tmpget['rename_newname']!=$tmpget['rename_oldname'] && $tmpget['rename_newname']!='') || (isset($tmppost['rename_newname'])&&$tmppost['rename_newname']!=$tmppost['rename_oldname'] && $tmppost['rename_newname']!='') ) {
|
||||
if (isset($tmppost['rename_newname'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// rename 重命名
|
||||
$oldname = spurlencode($_GET['rename_oldname']);
|
||||
$oldname = spurlencode(${$VAR}['rename_oldname']);
|
||||
$oldname = path_format($path1 . '/' . $oldname);
|
||||
$data = '{"name":"' . $_GET['rename_newname'] . '"}';
|
||||
$data = '{"name":"' . ${$VAR}['rename_newname'] . '"}';
|
||||
//echo $oldname;
|
||||
$result = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']);
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
}
|
||||
if (isset($_GET['delete_name'])) {
|
||||
if (isset($tmpget['delete_name']) || isset($tmppost['delete_name'])) {
|
||||
if (isset($tmppost['delete_name'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// delete 删除
|
||||
$filename = spurlencode($_GET['delete_name']);
|
||||
$filename = spurlencode(${$VAR}['delete_name']);
|
||||
$filename = path_format($path1 . '/' . $filename);
|
||||
//echo $filename;
|
||||
$result = MSAPI('DELETE', $filename, '', $_SERVER['access_token']);
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
}
|
||||
if (isset($_GET['operate_action'])&&$_GET['operate_action']==getconstStr('Encrypt')) {
|
||||
if ( (isset($tmpget['operate_action'])&&$tmpget['operate_action']==getconstStr('Encrypt')) || (isset($tmppost['operate_action'])&&$tmppost['operate_action']==getconstStr('Encrypt')) ) {
|
||||
if (isset($tmppost['operate_action'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// encrypt 加密
|
||||
if (getConfig('passfile')=='') return message(getconstStr('SetpassfileBfEncrypt'),'',403);
|
||||
if ($_GET['encrypt_folder']=='/') $_GET['encrypt_folder']=='';
|
||||
$foldername = spurlencode($_GET['encrypt_folder']);
|
||||
if (${$VAR}['encrypt_folder']=='/') ${$VAR}['encrypt_folder']=='';
|
||||
$foldername = spurlencode(${$VAR}['encrypt_folder']);
|
||||
$filename = path_format($path1 . '/' . $foldername . '/' . urlencode(getConfig('passfile')));
|
||||
//echo $foldername;
|
||||
$result = MSAPI('PUT', $filename, $_GET['encrypt_newpass'], $_SERVER['access_token']);
|
||||
$result = MSAPI('PUT', $filename, ${$VAR}['encrypt_newpass'], $_SERVER['access_token']);
|
||||
$path1 = path_format($path1 . '/' . $foldername );
|
||||
if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
|
||||
savecache('path_' . $path1 . '/?password', '', $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
}
|
||||
if (isset($_GET['move_folder'])) {
|
||||
if (isset($tmpget['move_folder']) || isset($tmppost['move_folder'])) {
|
||||
if (isset($tmppost['move_folder'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// move 移动
|
||||
$moveable = 1;
|
||||
if ($path == '/' && $_GET['move_folder'] == '/../') $moveable=0;
|
||||
if ($_GET['move_folder'] == $_GET['move_name']) $moveable=0;
|
||||
if ($path == '/' && ${$VAR}['move_folder'] == '/../') $moveable=0;
|
||||
if (${$VAR}['move_folder'] == ${$VAR}['move_name']) $moveable=0;
|
||||
if ($moveable) {
|
||||
$filename = spurlencode($_GET['move_name']);
|
||||
$filename = spurlencode(${$VAR}['move_name']);
|
||||
$filename = path_format($path1 . '/' . $filename);
|
||||
if ($_GET['move_folder'] == '/../') {
|
||||
if (${$VAR}['move_folder'] == '/../') {
|
||||
$foldername = path_format('/' . urldecode($path1) . '/');
|
||||
$foldername = substr($foldername, 0, -1);
|
||||
$foldername = splitlast($foldername, '/')[0];
|
||||
} else $foldername = path_format('/' . urldecode($path1) . '/' . $_GET['move_folder']);
|
||||
} else $foldername = path_format('/' . urldecode($path1) . '/' . ${$VAR}['move_folder']);
|
||||
$data = '{"parentReference":{"path": "/drive/root:'.$foldername.'"}}';
|
||||
$result = MSAPI('PATCH', $filename, $data, $_SERVER['access_token']);
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
if ($_GET['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
|
||||
else $path2 = path_format( $path1 . '/' . $_GET['move_folder'] . '/' );
|
||||
if (${$VAR}['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
|
||||
else $path2 = path_format( $path1 . '/' . ${$VAR}['move_folder'] . '/' );
|
||||
if ($path2!='/'&&substr($path2,-1)=='/') $path2=substr($path2,0,-1);
|
||||
savecache('path_' . $path2, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
@@ -1178,11 +1188,13 @@ function adminoperate($path)
|
||||
return output('{"error":"'.getconstStr('CannotMove').'"}', 403);
|
||||
}
|
||||
}
|
||||
if (isset($_GET['copy_name'])) {
|
||||
if (isset($tmpget['copy_name']) || isset($tmppost['copy_name'])) {
|
||||
if (isset($tmppost['copy_name'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// copy 复制
|
||||
$filename = spurlencode($_GET['copy_name']);
|
||||
$filename = spurlencode(${$VAR}['copy_name']);
|
||||
$filename = path_format($path1 . '/' . $filename);
|
||||
$namearr = splitlast($_GET['copy_name'], '.');
|
||||
$namearr = splitlast(${$VAR}['copy_name'], '.');
|
||||
if ($namearr[0]!='') {
|
||||
$newname = $namearr[0] . ' (' . getconstStr('Copy') . ')';
|
||||
if ($namearr[1]!='') $newname .= '.' . $namearr[1];
|
||||
@@ -1209,14 +1221,14 @@ function adminoperate($path)
|
||||
}
|
||||
//echo $result['stat'].$result['body'];
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
//if ($_GET['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
|
||||
//else $path2 = path_format( $path1 . '/' . $_GET['move_folder'] . '/' );
|
||||
//if ($tmpget['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
|
||||
//else $path2 = path_format( $path1 . '/' . $tmpget['move_folder'] . '/' );
|
||||
//savecache('path_' . $path2, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
}
|
||||
if (isset($_POST['editfile'])) {
|
||||
if (isset($tmppost['editfile'])) {
|
||||
// edit 编辑
|
||||
$data = $_POST['editfile'];
|
||||
$data = $tmppost['editfile'];
|
||||
/*TXT一般不会超过4M,不用二段上传
|
||||
$filename = $path1 . ':/createUploadSession';
|
||||
$response=MSAPI('POST',$filename,'{"item": { "@microsoft.graph.conflictBehavior": "replace" }}',$_SERVER['access_token']);
|
||||
@@ -1227,21 +1239,23 @@ function adminoperate($path)
|
||||
$resultarry = json_decode($result,true);
|
||||
if (isset($resultarry['error'])) return message($resultarry['error']['message']. '<hr><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>','Error',403);
|
||||
}
|
||||
if (isset($_GET['create_name'])) {
|
||||
if (isset($tmpget['create_name']) || isset($tmppost['create_name'])) {
|
||||
if (isset($tmppost['create_name'])) $VAR = 'tmppost';
|
||||
else $VAR = 'tmpget';
|
||||
// create 新建
|
||||
if ($_GET['create_type']=='file') {
|
||||
$filename = spurlencode($_GET['create_name']);
|
||||
if (${$VAR}['create_type']=='file') {
|
||||
$filename = spurlencode(${$VAR}['create_name']);
|
||||
$filename = path_format($path1 . '/' . $filename);
|
||||
$result = MSAPI('PUT', $filename, $_GET['create_text'], $_SERVER['access_token']);
|
||||
$result = MSAPI('PUT', $filename, ${$VAR}['create_text'], $_SERVER['access_token']);
|
||||
}
|
||||
if ($_GET['create_type']=='folder') {
|
||||
$data = '{ "name": "' . $_GET['create_name'] . '", "folder": { }, "@microsoft.graph.conflictBehavior": "rename" }';
|
||||
if (${$VAR}['create_type']=='folder') {
|
||||
$data = '{ "name": "' . ${$VAR}['create_name'] . '", "folder": { }, "@microsoft.graph.conflictBehavior": "rename" }';
|
||||
$result = MSAPI('children', $path1, $data, $_SERVER['access_token']);
|
||||
}
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output($result['body'], $result['stat']);
|
||||
}
|
||||
if (isset($_GET['RefreshCache'])) {
|
||||
if (isset($tmpget['RefreshCache'])) {
|
||||
$path1 = path_format($_SERVER['list_path'] . path_format($path));
|
||||
if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
|
||||
savecache('path_' . $path1 . '/?password', '', $_SERVER['disktag'], 1);
|
||||
@@ -1708,13 +1722,14 @@ function get_refresh_token()
|
||||
<input type="text" name="sharepointSiteAddress" style="width:100%" placeholder="'.getconstStr('InputSharepointSiteAddress').'"><br>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
<br>';
|
||||
if ($_SERVER['language']=='zh-cn') $html .= '你要理解 scfonedrive.github.io 是github上的静态网站,<br>除非github真的挂掉了,<br>不然,稍后你如果连不上,请检查你的运营商或其它“你懂的”问题!<br>';
|
||||
$html .='
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
function notnull(t) {
|
||||
if (t.disktag_add.value==\'\') {
|
||||
alert(\''.getconstStr('OnedriveDiskTag').'\');
|
||||
return false;
|
||||
@@ -1724,7 +1739,7 @@ function get_refresh_token()
|
||||
alert("Do not input ' . $envs . '");
|
||||
return false;
|
||||
}
|
||||
var reg = /^[a-zA-Z]([-_a-zA-Z0-9]{1,20})$/;
|
||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
||||
if (!reg.test(t.disktag_add.value)) {
|
||||
alert(\''.getconstStr('TagFormatAlert').'\');
|
||||
return false;
|
||||
@@ -1762,11 +1777,15 @@ function get_refresh_token()
|
||||
function EnvOpt($needUpdate = 0)
|
||||
{
|
||||
global $constStr;
|
||||
global $CommonEnv;
|
||||
global $ShowedCommonEnv;
|
||||
global $ShowedInnerEnv;
|
||||
global $timezones;
|
||||
asort($ShowedCommonEnv);
|
||||
asort($ShowedInnerEnv);
|
||||
$envs = '';
|
||||
foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', ';
|
||||
|
||||
$html = '<title>OneManager '.getconstStr('Setup').'</title>';
|
||||
if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) {
|
||||
$response = setConfigResponse(OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch']));
|
||||
@@ -1784,9 +1803,26 @@ function EnvOpt($needUpdate = 0)
|
||||
if (isset($_POST['submit1'])) {
|
||||
$_SERVER['disk_oprating'] = '';
|
||||
foreach ($_POST as $k => $v) {
|
||||
if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') {
|
||||
if (in_array($k, $ShowedCommonEnv) || in_array($k, $ShowedInnerEnv) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename') {
|
||||
$tmp[$k] = $v;
|
||||
}
|
||||
if ($k=='disktag_newname') {
|
||||
$v = preg_replace('/[^0-9a-zA-Z|_]/i', '', $v);
|
||||
$f = substr($v, 0, 1);
|
||||
if (strlen($v)==1) $v .= '_';
|
||||
if (in_array($v, $CommonEnv)) {
|
||||
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button><script>document.cookie=\'disktag=; path=/\';</script>', 'Error', 201);
|
||||
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
|
||||
return message('Please start with letters');
|
||||
} else {
|
||||
$tmp[$k] = $v;
|
||||
}
|
||||
}
|
||||
if ($k=='disktag_sort') {
|
||||
$td = implode('|', json_decode($v));
|
||||
if (strlen($td)==strlen(getConfig('disktag'))) $tmp['disktag'] = $td;
|
||||
else return message('Something wrong.');
|
||||
}
|
||||
if ($k == 'disk') $_SERVER['disk_oprating'] = $v;
|
||||
}
|
||||
/*if ($tmp['domain_path']!='') {
|
||||
@@ -1803,7 +1839,6 @@ function EnvOpt($needUpdate = 0)
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
} else {
|
||||
//WaitSCFStat();
|
||||
$html .= getconstStr('Success') . '!<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
$title = getconstStr('Setup');
|
||||
@@ -1882,18 +1917,102 @@ function EnvOpt($needUpdate = 0)
|
||||
<tr><td><input type="submit" name="submit1" value="'.getconstStr('Setup').'"></td></tr>
|
||||
</form>
|
||||
</table><br>';
|
||||
foreach (explode("|",getConfig('disktag')) as $disktag) {
|
||||
$disktags = explode('|', getConfig('disktag'));
|
||||
if (count($disktags)>1) {
|
||||
$html .= '
|
||||
<script src="//cdn.bootcss.com/Sortable/1.8.3/Sortable.js"></script>
|
||||
<style>
|
||||
.sortable-ghost {
|
||||
opacity: 0.4;
|
||||
background-color: #1748ce;
|
||||
}
|
||||
|
||||
#sortdisks td {
|
||||
cursor: move;
|
||||
}
|
||||
</style>
|
||||
<table border=1>
|
||||
<form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);">
|
||||
<tr id="sortdisks">
|
||||
<input type="hidden" name="disktag_sort" value="">';
|
||||
$num = 0;
|
||||
foreach ($disktags as $disktag) {
|
||||
if ($disktag!='') {
|
||||
$num++;
|
||||
$html .= '
|
||||
<td>' . $disktag . '</td>';
|
||||
}
|
||||
}
|
||||
$html .= '
|
||||
</tr>
|
||||
<tr><td colspan="' . $num . '">' . getconstStr('DragSort') . '<input type="submit" name="submit1" value="' . getconstStr('SubmitSortdisks') . '"></td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<script>
|
||||
var disks=' . json_encode($disktags) . ';
|
||||
function change(arr, oldindex, newindex) {
|
||||
//console.log(oldindex + "," + newindex);
|
||||
tmp=arr.splice(oldindex-1, 1);
|
||||
if (oldindex > newindex) {
|
||||
tmp1=JSON.parse(JSON.stringify(arr));
|
||||
tmp1.splice(newindex-1, arr.length-newindex+1);
|
||||
tmp2=JSON.parse(JSON.stringify(arr));
|
||||
tmp2.splice(0, newindex-1);
|
||||
} else {
|
||||
tmp1=JSON.parse(JSON.stringify(arr));
|
||||
tmp1.splice(newindex-1, arr.length-newindex+1);
|
||||
tmp2=JSON.parse(JSON.stringify(arr));
|
||||
tmp2.splice(0, newindex-1);
|
||||
}
|
||||
arr=tmp1.concat(tmp, tmp2);
|
||||
//console.log(arr);
|
||||
return arr;
|
||||
}
|
||||
function dragsort(t) {
|
||||
if (t.disktag_sort.value==\'\') {
|
||||
alert(\'' . getconstStr('DragSort') . '\');
|
||||
return false;
|
||||
}
|
||||
envs = [' . $envs . '];
|
||||
if (envs.indexOf(t.disktag_sort.value)>-1) {
|
||||
alert("Do not input ' . $envs . '");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Sortable.create(document.getElementById(\'sortdisks\'), {
|
||||
animation: 150,
|
||||
onEnd: function (evt) { //拖拽完毕之后发生该事件
|
||||
//console.log(evt.oldIndex);
|
||||
//console.log(evt.newIndex);
|
||||
if (evt.oldIndex!=evt.newIndex) {
|
||||
disks=change(disks, evt.oldIndex, evt.newIndex);
|
||||
document.getElementById(\'sortdisks_form\').disktag_sort.value=JSON.stringify(disks);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script><br>';
|
||||
}
|
||||
foreach ($disktags as $disktag) {
|
||||
if ($disktag!='') {
|
||||
$html .= '
|
||||
<table border=1 width=100%>
|
||||
<form action="" method="post">
|
||||
<tr>
|
||||
<td colspan="2">'.$disktag.':
|
||||
<td>
|
||||
<form action="" method="post" style="margin: 0">
|
||||
<input type="hidden" name="disktag_del" value="'.$disktag.'">
|
||||
<input type="submit" name="submit1" value="'.getconstStr('DelDisk').'">
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form action="" method="post" style="margin: 0" onsubmit="return renametag(this);">
|
||||
<input type="hidden" name="disktag_rename" value="'.$disktag.'">
|
||||
<input type="text" name="disktag_newname" value="'.$disktag.'">
|
||||
<input type="submit" name="submit1" value="'.getconstStr('RenameDisk').'">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</form>';
|
||||
';
|
||||
if (getConfig('refresh_token', $disktag)!='') {
|
||||
$html .= '
|
||||
<form name="'.$disktag.'" action="" method="post">
|
||||
@@ -1906,7 +2025,7 @@ function EnvOpt($needUpdate = 0)
|
||||
</tr>';
|
||||
}
|
||||
$html .= '
|
||||
<tr><td><input type="submit" name="submit1" value="'.getconstStr('Setup').'"></td></tr>
|
||||
<tr><td></td><td><input type="submit" name="submit1" value="'.getconstStr('Setup').'"></td></tr>
|
||||
</form>';
|
||||
} else {
|
||||
$html .= '
|
||||
@@ -1954,6 +2073,27 @@ function EnvOpt($needUpdate = 0)
|
||||
<input type="submit" name="updateProgram" value="'.getconstStr('updateProgram').'">
|
||||
</form>
|
||||
<script>
|
||||
function renametag(t) {
|
||||
if (t.disktag_newname.value==\'\') {
|
||||
alert(\''.getconstStr('OnedriveDiskTag').'\');
|
||||
return false;
|
||||
}
|
||||
if (t.disktag_newname.value==t.disktag_rename.value) {
|
||||
return false;
|
||||
}
|
||||
envs = [' . $envs . '];
|
||||
if (envs.indexOf(t.disktag_newname.value)>-1) {
|
||||
alert("Do not input ' . $envs . '");
|
||||
return false;
|
||||
}
|
||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
||||
if (!reg.test(t.disktag_newname.value)) {
|
||||
alert(\''.getconstStr('TagFormatAlert').'\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function querybranchs()
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
+17
-2
@@ -127,7 +127,7 @@ $constStr = [
|
||||
'Onedrive_ver' => 'Onedrive版本',
|
||||
],
|
||||
'zh-tw' => [
|
||||
'admin' => '管理密碼,不添加時不顯示登入頁面且無法登入。',
|
||||
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
|
||||
'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?admin\',而是\'?此設置的值\'。',
|
||||
'autoJumpFirstDisk' => '用於多盤,如果設1,將會自動跳到第一個盤。',
|
||||
'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
|
||||
@@ -311,6 +311,16 @@ $constStr = [
|
||||
'ko-kr' => '플랫폼 변수',
|
||||
'fa' => 'پیکربندی پلتفرم',
|
||||
],
|
||||
'DragSort' => [
|
||||
'en-us' => 'Drag to Sort Disk',
|
||||
'zh-cn' => '拖拽改变顺序',
|
||||
'zh-tw' => '拖曳改變順序',
|
||||
],
|
||||
'SubmitSortdisks' => [
|
||||
'en-us' => 'Submit Sort',
|
||||
'zh-cn' => '确认排序',
|
||||
'zh-tw' => '確認排序',
|
||||
],
|
||||
'DelDisk' => [
|
||||
'en-us' => 'Del This Disk',
|
||||
'zh-cn' => '删除此盘',
|
||||
@@ -319,10 +329,15 @@ $constStr = [
|
||||
'ko-kr' => '이 디스크를 삭제',
|
||||
'fa' => 'پاک کردن این دیسک',
|
||||
],
|
||||
'RenameDisk' => [
|
||||
'en-us' => 'Rename Disk Tag',
|
||||
'zh-cn' => '改变标签',
|
||||
'zh-tw' => '修改標籤',
|
||||
],
|
||||
'AddDisk' => [
|
||||
'en-us' => 'Add Onedrive Disk',
|
||||
'zh-cn' => '添加Onedrive盘',
|
||||
'zh-tw' => '添加Onedrive盤',
|
||||
'zh-tw' => '新增Onedrive盤',
|
||||
'ja' => 'Onedriveを追加',
|
||||
'ko-kr' => 'Onedrive 추가',
|
||||
'fa' => 'اضافه کردن دیسک Onedrive',
|
||||
|
||||
+13
-5
@@ -78,11 +78,11 @@ function setConfig($arr, $disktag = '')
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
@@ -90,11 +90,13 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
@@ -105,12 +107,18 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$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'));
|
||||
|
||||
+12
-4
@@ -72,7 +72,7 @@ function setConfig($arr, $disktag = '')
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
@@ -80,11 +80,13 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
@@ -95,12 +97,18 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$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('SecretId'), getConfig('SecretKey'));
|
||||
|
||||
+31
-5
@@ -15,6 +15,24 @@ function getpath()
|
||||
|
||||
function getGET()
|
||||
{
|
||||
//error_log('POST:' . json_encode($_POST));
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
//error_log('RAW:' . $tmpdata);
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
//error_log('PHPINPUT:' . $tmpdata);
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
//error_log('POSTformPHPINPUT:' . json_encode($_POST));
|
||||
}
|
||||
}
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
@@ -65,7 +83,7 @@ function setConfig($arr, $disktag = '')
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
@@ -73,11 +91,13 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
@@ -88,11 +108,17 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = null;
|
||||
} else {
|
||||
$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'] = '';
|
||||
else $tmp['disktag'] = null;
|
||||
}
|
||||
}
|
||||
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
|
||||
@@ -96,7 +96,7 @@ function setConfig($arr, $disktag = '')
|
||||
$diskconfig = json_decode($contextUserData->getUserData($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
@@ -104,11 +104,13 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
@@ -119,12 +121,18 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$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'));
|
||||
|
||||
@@ -118,6 +118,8 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
@@ -130,11 +132,17 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
$envs[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
$response = updateEnvironment($envs, getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'));
|
||||
@@ -340,7 +348,7 @@ function getfunctioncode($HW_urn, $HW_key, $HW_secret)
|
||||
' . '/' . $bucket . '/' . $path;
|
||||
|
||||
$signature = base64_encode(hash_hmac('sha1', $StringToSign, $HW_secret, true));
|
||||
$response = curl_request($url, false, [ 'Authorization' => 'OBS ' . $HW_key . ':' . $signature, 'x-obs-date' => $date, 'Content-Type' => '' ]);
|
||||
$response = curl('GET', $url, false, [ 'Authorization' => 'OBS ' . $HW_key . ':' . $signature, 'x-obs-date' => $date, 'Content-Type' => '' ]);
|
||||
//if ($response['stat']==200) return $response['body'];
|
||||
if ($response['stat']==0) return json_encode( [ 'error_code' => 'Network', 'error_msg' => 'Network error in getting code.' ] );
|
||||
else return $response['body'];
|
||||
|
||||
+36
-17
@@ -18,6 +18,20 @@ function getpath()
|
||||
|
||||
function getGET()
|
||||
{
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
@@ -46,8 +60,12 @@ function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
//include 'config.php';
|
||||
$s = file_get_contents('.data/config.php');
|
||||
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
@@ -73,12 +91,15 @@ function setConfig($arr, $disktag = '')
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
//include 'config.php';
|
||||
$s = file_get_contents('.data/config.php');
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
@@ -93,6 +114,8 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
@@ -105,17 +128,24 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
unset($envs[$arr['disktag_rename']]);
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
|
||||
//echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
$response = file_put_contents('.data/config.php', $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
$response = file_put_contents($configPath, $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
if ($response>0) return json_encode( [ 'response' => 'success' ] );
|
||||
return json_encode( [ 'message' => 'Failed to write config.', 'code' => 'failed' ] );
|
||||
}
|
||||
@@ -245,17 +275,6 @@ function ConfigWriteable()
|
||||
return false;
|
||||
}
|
||||
|
||||
function RewriteEngineOn()
|
||||
{
|
||||
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
|
||||
$tmpurl = $http_type . $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
|
||||
$tmpurl .= path_format($_SERVER['base_path'] . '/.data/config.php');
|
||||
$tmp = curl_request($tmpurl);
|
||||
if ($tmp['stat']==200) return false;
|
||||
if ($tmp['stat']==201) return true; //when install return 201, after installed return 404 or 200;
|
||||
return false;
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['message']);
|
||||
|
||||
@@ -79,7 +79,7 @@ function setConfig($arr, $disktag = '')
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
@@ -87,11 +87,13 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
@@ -102,12 +104,18 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$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['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
|
||||
|
||||
@@ -103,6 +103,8 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
@@ -115,11 +117,17 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag'));
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
$envs[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
$response = updateEnvironment($envs, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
|
||||
@@ -539,7 +547,7 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe
|
||||
$headers['X-TC-Timestamp'] = $timestamp;
|
||||
$headers['X-TC-Version'] = $version;
|
||||
$headers['X-TC-Region'] = $region;
|
||||
return curl_request('https://'.$host, $payload, $headers)['body'];
|
||||
return curl('POST', 'https://'.$host, $payload, $headers)['body'];
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
|
||||
@@ -104,5 +104,15 @@ If there is 'index.html' file, program will only show the content of 'index.html
|
||||
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
|
||||
点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
|
||||
|
||||
# Functional files 功能性文件
|
||||
### favicon.ico
|
||||
put it in the showing home folder of FIRST disk (maybe not root of onedrive). 放在第一个盘的显示目录(不一定是onedrive根目录)。
|
||||
### index.html
|
||||
show content of index.html as html. 将index.html以静态网页显示出来。
|
||||
### head.md readme.md
|
||||
it will showed at top or bottom as markdown. 以MD语法显示在顶部或底部。
|
||||
### head.omf foot.omf
|
||||
it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。
|
||||
|
||||
QQ Group: 943919989 (请看完上面的中英双语再加群,谢谢!)
|
||||
Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
|
||||
|
||||
+3
-3
@@ -1112,9 +1112,8 @@
|
||||
function submit_operate(str) {
|
||||
var num=document.getElementById(str+'_sid').value;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", '?'+serializeForm(str+'_form'));
|
||||
xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr.send(null);
|
||||
xhr.open("POST", '');
|
||||
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
|
||||
xhr.onload = function(e){
|
||||
var html;
|
||||
if (xhr.status<300) {
|
||||
@@ -1134,6 +1133,7 @@
|
||||
document.getElementById(str+'_div').style.display='none';
|
||||
document.getElementById('mask').style.display='none';
|
||||
}
|
||||
xhr.send(serializeForm(str+'_form'));
|
||||
return false;
|
||||
}
|
||||
function addelement(html) {
|
||||
|
||||
+466
-1
File diff suppressed because one or more lines are too long
@@ -1,7 +1,10 @@
|
||||
20201215-1400.28
|
||||
fix: hackers can upload files to ANY folder (or create a new folder) in your Onedrive. add language zh-tw. now, on heroku, xhr can post. fix: 2 or more space in file name cause bugs.
|
||||
修复:构造代码后可以上传文件到你Onedrive的任意目录(甚至创建新目录)。新增zh-tw语言。xhr的post在heroku会接收了,改回post。修复:文件名有多个空格相连时造成bug。
|
||||
|
||||
20201106-1730.27
|
||||
Add theme. A code used in CloudFlare Workers. Admin not need password in folder. Add caddy2 rewrite rule. Add new platform Glitch. <font color=red>web hosting and VPS user should backup your config.php, after update, copy it to .data foloder.</font>
|
||||
添加主题。添加一段用于CF workers的代码。加密目录管理员不需要密码了。添加caddy2伪静态。新增Glitch平台。<font color=red>虚拟主机与VPS用户请备份config.php,升级后,手动将它覆盖到.data目录。</font>
|
||||
|
||||
20200828-1420.26
|
||||
nginx rewrite rule exclude .well-known folder, as auto SSL. add web.config to rewrite in IIS. now in windwos can do with \ in path. in aliyun FC & huawei FG API, use my code. CN 21Vianet client_id&secret expire. update description now only show new.
|
||||
nginx的伪静态中排除.well-known目录,方便自动SSL。添加IIS的伪静态。与linux不同,处理windows下目录用\分隔。FC、FG中使用自己代码对接平台。<font color=red>世纪互联旧API即将过期失效,升级后世纪互联的盘需要删除重新添加。</font>更新说明只显示部分。
|
||||
|
||||
Reference in New Issue
Block a user