copy disk, change onedrive/sharepoint.

pull/194/head
root 2021-01-18 15:59:39 +08:00
parent 85cdc6b211
commit 11e87f9ea8
11 changed files with 75 additions and 19 deletions

View File

@ -40,21 +40,22 @@ $EnvConfigs = [
'Driver' => 0b100,
'client_id' => 0b100,
'client_secret' => 0b101,
'diskname' => 0b111,
'domain_path' => 0b111,
'downloadencrypt' => 0b110,
'guestup_path' => 0b111,
'sharepointSite' => 0b101,
'shareurl' => 0b101,
//'sharecookie' => 0b101,
'shareapiurl' => 0b101,
'siteid' => 0b100,
'domainforproxy' => 0b111,
'public_path' => 0b111,
'refresh_token' => 0b100,
'token_expires' => 0b100,
'default_drive_id' => 0b100,
'default_sbox_drive_id'=> 0b100,
'diskname' => 0b111,
'domain_path' => 0b111,
'downloadencrypt' => 0b110,
'guestup_path' => 0b111,
'domainforproxy' => 0b111,
'public_path' => 0b111,
];
$timezones = array(
@ -1078,7 +1079,7 @@ function EnvOpt($needUpdate = 0)
if (isset($_POST['submit1'])) {
$_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) {
if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename') {
if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy') {
$tmp[$k] = $v;
}
if ($k=='disktag_newname') {
@ -1275,7 +1276,7 @@ function EnvOpt($needUpdate = 0)
<table border=1 width=100%>
<tr>
<td>
<form action="" method="post" style="margin: 0">
<form action="" method="post" style="margin: 0" onsubmit="return deldiskconfirm(this);">
<input type="hidden" name="disktag_del" value="'.$disktag.'">
<input type="submit" name="submit1" value="'.getconstStr('DelDisk').'">
</form>
@ -1286,12 +1287,16 @@ function EnvOpt($needUpdate = 0)
<input type="text" name="disktag_newname" value="'.$disktag.'" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '">
<input type="submit" name="submit1" value="'.getconstStr('RenameDisk').'">
</form>
<form action="" method="post" style="margin: 0">
<input type="hidden" name="disktag_copy" value="' . $disktag . '">
<input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '">
</form>
</td>
</tr>
<tr>
<td>Driver</td>
<td>' . getConfig('Driver', $disktag);
if (baseclassofdrive($disk_tmp)=='Onedrive') $html .= ' <a href="?AddDisk=' . get_class($disk_tmp) . '&disktag=' . $disktag . '&SelectDrive">Change Driver type' . getconstStr(' ') . '</a>';
if ($diskok && baseclassofdrive($disk_tmp)=='Onedrive') $html .= ' <a href="?AddDisk=' . get_class($disk_tmp) . '&disktag=' . $disktag . '&SelectDrive">' . getconstStr('ChangeOnedrivetype') . '</a>';
$html .= '</td>
</tr>
';
@ -1371,13 +1376,18 @@ function EnvOpt($needUpdate = 0)
<form name="updateform" action="" method="post">
<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>
<button name="QueryBranchs" onclick="querybranchs();return false;">'.getconstStr('QueryBranchs').'</button>
<select name="branch">
<option value="master">master</option>
</select>
<input type="submit" name="updateProgram" value="'.getconstStr('updateProgram').'">
</form>
<script>
function deldiskconfirm(t) {
var msg="' . getconstStr('Delete') . ' ??";
if (confirm(msg)==true) return true;
else return false;
}
function renametag(t) {
if (t.disktag_newname.value==\'\') {
alert(\''.getconstStr('DiskTag').'\');

View File

@ -407,12 +407,20 @@ $constStr = [
'fa' => 'پاک کردن این دیسک',
'ar-sa' => 'حذف هذا القرص',
],
'CopyDisk' => [
'en-us' => 'Copy this Disk',
'zh-cn' => '复制此盘',
],
'RenameDisk' => [
'en-us' => 'Rename Disk Tag',
'zh-cn' => '改变标签',
'zh-tw' => '修改標籤',
'ar-sa' => 'تغيير التسمية',
],
'ChangeOnedrivetype' => [
'en-us' => 'Change Onedrive/Sharepoint',
'zh-cn' => '切换Onedrive/Sharepoint',
],
'AddDisk' => [
'en-us' => 'Add Disk',
'zh-cn' => '添加盘',

View File

@ -415,7 +415,10 @@ class Onedrive {
} else {
return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
}*/
$tmp = null;
if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive';
elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
$tmp['sharepointSite'] = '';
$tmp['siteid'] = '';
} elseif ($_POST['DriveType']=='Custom') {
// sitename计算siteid
$tmp1 = $this->get_siteid($_POST['sharepointSite']);
@ -454,6 +457,7 @@ class Onedrive {
}
if (isset($_GET['SelectDrive'])) {
if (get_class($this)=='Sharelink') return message('Can not change to other.', 'Back', 201);
if ($this->access_token == '') {
$refresh_token = getConfig('refresh_token', $this->disktag);
if (!$refresh_token) {
@ -576,13 +580,7 @@ class Onedrive {
$f = substr($_POST['disktag_add'], 0, 1);
if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_';
if (isCommonEnv($_POST['disktag_add'])) {
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
<script>
var expd = new Date();
expd.setTime(expd.getTime()+1);
var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires;
</script>', 'Error', 201);
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 201);
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
<script>

View File

@ -96,6 +96,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tmp[$newtag] = getConfig($v);
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -86,6 +86,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tmp[$newtag] = getConfig($v);
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -92,6 +92,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tmp[$newtag] = getConfig($v);
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -110,6 +110,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tmp[$newtag] = getConfig($v);
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -123,6 +123,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$envs[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$envs[$newtag] = $envs[$v];
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -105,6 +105,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$envs[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$envs[$newtag] = $envs[$v];
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -93,6 +93,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tmp[$newtag] = getConfig($v);
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {

View File

@ -104,6 +104,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]);
$envs[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$envs[$newtag] = $envs[$v];
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {