Update common.php

新增“重置此盘”选项,
修复“设置”按钮不显示的问题,
修复 client_secret 和 refresh_token 等过期的问题。
pull/696/head
Nyaser 2023-07-13 22:53:14 +08:00 committed by GitHub
parent ef70b6bcb5
commit 33e6b32fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 3 deletions

View File

@ -1430,6 +1430,23 @@ function EnvOpt($needUpdate = 0)
if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy' || $k=='client_secret') { if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy' || $k=='client_secret') {
$tmp[$k] = $v; $tmp[$k] = $v;
} }
if ($k=='disktag_reset') {
global $slash;
$disktype = getConfig('Driver', $_GET['disktag']);
if (!$disktype) return false;
if (!class_exists($disktype)) require 'disk' . $slash . $disktype . '.php';
$drive = new $disktype($_GET['disktag']);
return message('
<a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
<script>
url=location.protocol + "//" + location.host + "' . $url . '?install2&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($drive) . '";
url="' . $drive->oauth_url . 'authorize?scope=' . $drive->scope . '&response_type=code&client_id=' . $drive->client_id . '&redirect_uri=' . $drive->redirect_uri . '&state=' . '"+encodeURIComponent(url);
document.getElementById(\'a1\').href=url;
//window.open(url,"_blank");
location.href = url;
</script>
', getconstStr('Wait') . ' 1s', 201);
}
if ($k=='disktag_newname') { if ($k=='disktag_newname') {
$v = preg_replace('/[^0-9a-zA-Z|_]/i', '', $v); $v = preg_replace('/[^0-9a-zA-Z|_]/i', '', $v);
$f = substr($v, 0, 1); $f = substr($v, 0, 1);
@ -1690,6 +1707,13 @@ output:
<input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '"> <input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '">
</form> </form>
</td> </td>
<td>
<form action="" method="post" style="margin: 0" onsubmit="return rediskconfirm(this);">
<input type="hidden" name="disktag_reset" value="' . $disktag . '">
<input name="_admin" type="hidden" value="">
<input type="submit" name="submit1" value="' . getconstStr('ResetDisk') . '">
</form>
</td>
</tr> </tr>
</table> </table>
<form name="' . $disktag . '" action="" method="post"> <form name="' . $disktag . '" action="" method="post">
@ -1755,14 +1779,14 @@ output:
</td> </td>
</tr>'; </tr>';
} }
$frame .= '
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>';
} else { } else {
$frame .= ' $frame .= '
<tr> <tr>
<td colspan="2">' . ($disk_tmp->error['body']?$disk_tmp->error['stat'] . '<br>' . $disk_tmp->error['body']:'Add this disk again.') . '</td> <td colspan="2">' . ($disk_tmp->error['body']?$disk_tmp->error['stat'] . '<br>' . $disk_tmp->error['body']:'Add this disk again.') . '</td>
</tr>'; </tr>';
} }
$frame .= '
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>';
$frame .= ' $frame .= '
</table> </table>
</form> </form>
@ -1771,7 +1795,8 @@ output:
function deldiskconfirm(t) { function deldiskconfirm(t) {
var msg="' . getconstStr('Delete') . ' ??"; var msg="' . getconstStr('Delete') . ' ??";
if (confirm(msg)==true) return true; if (confirm(msg)==true) return true;
else return false; //else
return false;
} }
function cpdiskconfirm(t) { function cpdiskconfirm(t) {
var msg="' . getconstStr('Copy') . ' ??"; var msg="' . getconstStr('Copy') . ' ??";
@ -1779,6 +1804,12 @@ output:
//else //else
return false; return false;
} }
function rediskconfirm(t) {
var msg="' . getconstStr('ResetDisk') . ' ??";
if (confirm(msg)==true) return true;
//else
return false;
}
function renametag(t) { function renametag(t) {
if (t.disktag_newname.value==\'\') { if (t.disktag_newname.value==\'\') {
alert(\'' . getconstStr('DiskTag') . '\'); alert(\'' . getconstStr('DiskTag') . '\');