diff --git a/disk/Onedrive.php b/disk/Onedrive.php index 3ae42a0..35c2158 100644 --- a/disk/Onedrive.php +++ b/disk/Onedrive.php @@ -446,7 +446,7 @@ class Onedrive { $envs = ''; foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', '; - $url = path_format($_SERVER['PHP_SELF'] . '/'); + $url = path_format($_SERVER['base_path'] . '/'); //$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0'; if (isset($_GET['Finish'])) { @@ -478,8 +478,8 @@ class Onedrive { } else { return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']); }*/ - if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive'; - elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN'; + if ($tmp['Driver']=='Sharepoint') $tmp['Driver'] = 'Onedrive'; + elseif ($tmp['Driver']=='SharepointCN') $tmp['Driver'] = 'OnedriveCN'; $tmp['sharepointSite'] = ''; $tmp['siteid'] = ''; } elseif ($_POST['DriveType']=='Custom') { @@ -492,14 +492,14 @@ class Onedrive { //if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']); $tmp['siteid'] = $siteid; $tmp['sharepointSite'] = $_POST['sharepointSite']; - if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; - elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; + if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint'; + elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; } else { // 直接是siteid $tmp['siteid'] = $_POST['DriveType']; $tmp['sharepointSite'] = $_POST['sharepointSiteUrl']; - if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; - elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; + if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint'; + elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; } $response = setConfigResponse( setConfig($tmp, $this->disktag) ); @@ -520,11 +520,11 @@ class Onedrive { console.log(i++); } else { clearInterval(uploadList); - location.href = "' . $url . '"; + location.href = "' . $url . '?setup&disktag=' . $_GET['disktag'] . '"; } }, 1000); '; - return message($html, getconstStr('WaitJumpIndex'), 201, 1); + return message($html, getconstStr('Wait'), 201, 1); } } @@ -554,12 +554,13 @@ class Onedrive { $title = 'Select Driver'; $html = '
-
-
'; + +
'; if ($sites[0]!='') foreach ($sites as $k => $v) { $html .= ' '; } $html .= ' @@ -576,22 +577,42 @@ class Onedrive {
- '; + } + function notnull(t) + { + if (t.DriveType.value==\'\') { + alert(\'Select a Disk\'); + return false; + } + if (t.DriveType.value==\'Custom\') { + if (t.sharepointSite.value==\'\') { + alert(\'sharepoint Site Address\'); + return false; + } + } + return true; + } + +'; return message($html, $title, 201); } @@ -611,7 +632,7 @@ class Onedrive { texta[i].style.height = texta[i].scrollHeight + \'px\'; } '; - $tmptoken['Driver'] = get_class($this); + $tmptoken['Driver'] = $_GET['AddDisk']; $tmptoken['refresh_token'] = $refresh_token; $tmptoken['token_expires'] = time()+7*24*60*60; $response = setConfigResponse( setConfig($tmptoken, $this->disktag) ); @@ -629,7 +650,7 @@ class Onedrive { console.log(i++); } else { clearInterval(uploadList); - location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; + location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; } }, 1000); '; @@ -641,7 +662,7 @@ class Onedrive { } if (isset($_GET['install1'])) { - if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { + //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { return message(' ' . getconstStr('JumptoOffice') . ' ', getconstStr('Wait') . ' 1s', 201); - } else { - return message('Something error, retry after a few seconds.', 'Retry', 201); - } + //} else { + // return message('Something error, retry after a few seconds.', 'Retry', 201); + //} } if (isset($_GET['install0'])) { @@ -681,7 +702,8 @@ class Onedrive { //$this->disktag = $_POST['disktag_add']; $tmp['disktag_add'] = $_POST['disktag_add']; $tmp['diskname'] = $_POST['diskname']; - $tmp['Driver'] = $_POST['Drive_ver']; + //$tmp['Driver'] = $_POST['Drive_ver']; + $tmp['Driver'] = $_GET['AddDisk']; if ($_POST['Drive_ver']=='Sharelink') { $tmp['shareurl'] = $_POST['shareurl']; } else { @@ -701,7 +723,7 @@ class Onedrive { } else { $title = getconstStr('MayinEnv'); $html = getconstStr('Wait'); - if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver']; + if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_GET['AddDisk']; $html .= '';