2021-01-15 03:10:08 +00:00
|
|
|
<?php
|
|
|
|
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
|
|
|
|
|
|
|
class Sharepoint extends Onedrive {
|
|
|
|
|
|
|
|
function __construct($tag) {
|
|
|
|
$this->disktag = $tag;
|
|
|
|
$this->redirect_uri = 'https://scfonedrive.github.io';
|
|
|
|
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
|
|
|
$this->client_id = getConfig('client_id', $tag);
|
|
|
|
$this->client_secret = getConfig('client_secret', $tag);
|
|
|
|
} else {
|
|
|
|
$this->client_id = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
|
2021-02-06 08:43:02 +00:00
|
|
|
$this->client_secret = '_I5gOpmG5vTC2Ts_K._wCW4nN1km~4Pk52';
|
2021-01-15 03:10:08 +00:00
|
|
|
}
|
|
|
|
$this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
|
|
|
|
$this->api_url = 'https://graph.microsoft.com/v1.0';
|
2021-03-28 08:39:06 +00:00
|
|
|
$this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All https://graph.microsoft.com/Sites.ReadWrite.All offline_access';
|
2021-01-16 03:28:19 +00:00
|
|
|
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
2021-01-15 03:10:08 +00:00
|
|
|
|
|
|
|
$this->client_secret = urlencode($this->client_secret);
|
|
|
|
$this->scope = urlencode($this->scope);
|
|
|
|
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
|
|
|
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
|
|
|
}
|
2021-01-17 11:01:47 +00:00
|
|
|
|
|
|
|
public function ext_show_innerenv()
|
|
|
|
{
|
|
|
|
return [ 'sharepointSite', 'siteid' ];
|
|
|
|
}
|
|
|
|
}
|