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, 'Driver' => 0b100,
'client_id' => 0b100, 'client_id' => 0b100,
'client_secret' => 0b101, 'client_secret' => 0b101,
'diskname' => 0b111,
'domain_path' => 0b111,
'downloadencrypt' => 0b110,
'guestup_path' => 0b111,
'sharepointSite' => 0b101, 'sharepointSite' => 0b101,
'shareurl' => 0b101, 'shareurl' => 0b101,
//'sharecookie' => 0b101, //'sharecookie' => 0b101,
'shareapiurl' => 0b101, 'shareapiurl' => 0b101,
'siteid' => 0b100, 'siteid' => 0b100,
'domainforproxy' => 0b111,
'public_path' => 0b111,
'refresh_token' => 0b100, 'refresh_token' => 0b100,
'token_expires' => 0b100, 'token_expires' => 0b100,
'default_drive_id' => 0b100, 'default_drive_id' => 0b100,
'default_sbox_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( $timezones = array(
@ -1078,7 +1079,7 @@ function EnvOpt($needUpdate = 0)
if (isset($_POST['submit1'])) { if (isset($_POST['submit1'])) {
$_SERVER['disk_oprating'] = ''; $_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) { 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; $tmp[$k] = $v;
} }
if ($k=='disktag_newname') { if ($k=='disktag_newname') {
@ -1275,7 +1276,7 @@ function EnvOpt($needUpdate = 0)
<table border=1 width=100%> <table border=1 width=100%>
<tr> <tr>
<td> <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="hidden" name="disktag_del" value="'.$disktag.'">
<input type="submit" name="submit1" value="'.getconstStr('DelDisk').'"> <input type="submit" name="submit1" value="'.getconstStr('DelDisk').'">
</form> </form>
@ -1286,12 +1287,16 @@ function EnvOpt($needUpdate = 0)
<input type="text" name="disktag_newname" value="'.$disktag.'" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '"> <input type="text" name="disktag_newname" value="'.$disktag.'" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '">
<input type="submit" name="submit1" value="'.getconstStr('RenameDisk').'"> <input type="submit" name="submit1" value="'.getconstStr('RenameDisk').'">
</form> </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> </td>
</tr> </tr>
<tr> <tr>
<td>Driver</td> <td>Driver</td>
<td>' . getConfig('Driver', $disktag); <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> $html .= '</td>
</tr> </tr>
'; ';
@ -1371,13 +1376,18 @@ function EnvOpt($needUpdate = 0)
<form name="updateform" action="" method="post"> <form name="updateform" action="" method="post">
<input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf"> <input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" size="12" placeholder="project" value="OneManager-php"> <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"> <select name="branch">
<option value="master">master</option> <option value="master">master</option>
</select> </select>
<input type="submit" name="updateProgram" value="'.getconstStr('updateProgram').'"> <input type="submit" name="updateProgram" value="'.getconstStr('updateProgram').'">
</form> </form>
<script> <script>
function deldiskconfirm(t) {
var msg="' . getconstStr('Delete') . ' ??";
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').'\');

View File

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

View File

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

View File

@ -96,6 +96,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = ''; $tmp[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -86,6 +86,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = ''; $tmp[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -92,6 +92,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = ''; $tmp[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -110,6 +110,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = ''; $tmp[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -123,6 +123,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$envs[$v] = ''; $envs[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -105,6 +105,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$envs[$v] = ''; $envs[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -93,6 +93,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = ''; $tmp[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {

View File

@ -104,6 +104,11 @@ function setConfig($arr, $disktag = '')
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [ $v ]);
$envs[$v] = ''; $envs[$v] = '';
$operatedisk = 1; $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') { } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else { } else {