├── .data
└── config.php
├── .htaccess
├── .replit
├── CFWorkers.js
├── CFWorkers_rand.js
├── app.json
├── common.php
├── conststr.php
├── disk
├── Aliyundrive.php
├── BaiduDisk.php
├── Googledrive.php
├── Onedrive.php
├── OnedriveCN.php
├── Sharelink.php
├── Sharepoint.php
└── SharepointCN.php
├── glitch.json
├── index.php
├── js
├── marked.js
├── sha1.min.js
└── spark-md5.min.js
├── platform
├── AliyunFC.php
├── BaiduCFC.php
├── Heroku.php
├── HuaweiFG_env.php
├── HuaweiFG_file.php
├── Normal.php
├── Replit.php
├── Replit_old.php
├── TencentSCF_env.php
├── TencentSCF_file.php
├── Vercel.php
└── Vercel_env.php
├── readme.md
├── readme
├── button.png
├── tfo.logo.png
├── tfo.logo.svg
└── tfo.logo.transparent.png
├── readme_cn.md
├── readme_original.md
├── readme_original_cn.md
├── theme
├── 403.html
├── Onedrive-dev.html
├── apache.html
├── classic.html
├── flatcard.html
├── iis.html
├── nchyn_grey.html
├── nexmoe1.html
├── nexmoe2.html
├── nginx.html
├── old_ly_white.php
├── old_lybwb.php
├── old_minus.php
├── old_ov_bingrandom.php
├── old_ov_landscape.php
├── old_ov_onemoe.php
├── old_ov_secondary.php
├── old_purenice.php
├── old_ruoli_blue.php
├── old_ruoli_violet.php
├── old_tfo_md.html
├── old_tfo_md.php
├── old_tfo_mdtr.html
├── old_tfo_mdtr.php
├── old_tfo_mdtr_nmd.php
├── old_tfo_mdtrbaw.php
├── onemoe.html
├── purecool.html
├── renexmoe.html
├── tfo.html
└── tfo_lssm.html
├── update.sh
├── vendor
├── autoload.php
├── composer
│ ├── ClassLoader.php
│ ├── LICENSE
│ ├── autoload_classmap.php
│ ├── autoload_namespaces.php
│ ├── autoload_psr4.php
│ ├── autoload_real.php
│ ├── autoload_static.php
│ └── installed.json
└── doctrine
│ └── cache
│ └── lib
│ └── Doctrine
│ └── Common
│ └── Cache
│ ├── Cache.php
│ ├── CacheProvider.php
│ ├── ClearableCache.php
│ ├── FileCache.php
│ ├── FilesystemCache.php
│ ├── FlushableCache.php
│ ├── MultiGetCache.php
│ └── MultiPutCache.php
├── version
├── web.config
└── writeable.sh
/.data/config.php:
--------------------------------------------------------------------------------
1 | {
21 | let url=new URL(event.request.url);
22 | if (url.protocol == 'http:') {
23 | url.protocol = 'https:'
24 | event.respondWith( Response.redirect(url.href) )
25 | } else {
26 | let response = null;
27 | let nd = new Date();
28 | if (nd.getDate()%2) {
29 | host = SingleDay
30 | } else {
31 | host = DoubleDay
32 | }
33 | if (host.substr(0, 7)!='http://'&&host.substr(0, 8)!='https://') host = 'http://' + host;
34 |
35 | response = fetchAndApply(host, event.request);
36 |
37 | event.respondWith( response );
38 | }
39 | })
40 |
41 | async function fetchAndApply(host, request) {
42 | let f_url = new URL(request.url);
43 | let a_url = new URL(host);
44 | let replace_path = a_url.pathname;
45 | if (replace_path.substr(replace_path.length-1)!='/') replace_path += '/';
46 | let replaced_path = '/';
47 | let query = f_url.search;
48 | let path = f_url.pathname;
49 | if (host.substr(host.length-1)=='/') path = path.substr(1);
50 | f_url.href = host + path + query;
51 |
52 | let response = null;
53 | if (!CFproxy) {
54 | response = await fetch(f_url, request);
55 | } else {
56 | let method = request.method;
57 | let body = request.body;
58 | let request_headers = request.headers;
59 | let new_request_headers = new Headers(request_headers);
60 | new_request_headers.set('Host', f_url.host);
61 | new_request_headers.set('Referer', request.url);
62 |
63 | response = await fetch(f_url.href, {
64 | method: method,
65 | body: body,
66 | headers: new_request_headers
67 | });
68 | }
69 |
70 | let out_headers = new Headers(response.headers);
71 | if (out_headers.get('Content-Disposition')=='attachment') out_headers.delete('Content-Disposition');
72 | let out_body = null;
73 | let contentType = out_headers.get('Content-Type');
74 | if (contentType.includes("application/text")) {
75 | out_body = await response.text();
76 | while (out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
77 | } else if (contentType.includes("text/html")) {
78 | out_body = await response.text();
79 | while (replace_path!='/'&&out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
80 | } else {
81 | out_body = await response.body;
82 | }
83 |
84 | let out_response = new Response(out_body, {
85 | status: response.status,
86 | headers: out_headers
87 | })
88 |
89 | return out_response;
90 | }
91 |
--------------------------------------------------------------------------------
/CFWorkers_rand.js:
--------------------------------------------------------------------------------
1 |
2 | // Hosts Array
3 | // 服务器数组
4 | const H = [
5 | 'https://herooneindex.herokuapp.com/',
6 | 'https://onemanager.glitch.me/',
7 | 'https://onemanager-php.vercel.app/'
8 | ]
9 |
10 | // View Type
11 | // 1 , only first host,
12 | // 只第一条Host记录有用
13 | // 2 , view top 2 host as odd/even days,
14 | // 只有前两条记录有效,分别单双日运行
15 | // 3 , view random host
16 | // 所有记录随机访问
17 | const T = 1
18 |
19 | // CF proxy all, true/false
20 | // 一切给CF代理,true或false
21 | const CFproxy = true
22 |
23 | // Used in cloudflare workers
24 | // // // // // //
25 |
26 | addEventListener('fetch', event => {
27 | let url=new URL(event.request.url);
28 | if (url.protocol == 'http:') {
29 | // force HTTPS
30 | url.protocol = 'https:'
31 | event.respondWith( Response.redirect(url.href) )
32 | } else {
33 | let host = null;
34 | if (T===1) {
35 | host = H[0];
36 | }
37 | if (T===2) {
38 | host = H[new Date().getDate()%2];
39 | }
40 | if (T===3) {
41 | let n = H.length;
42 | host = H[Math.round(Math.random()*n*10)%n];
43 | }
44 | //console.log(host)
45 | if (host.substr(0, 7)!='http://'&&host.substr(0, 8)!='https://') host = 'http://' + host;
46 |
47 | let response = fetchAndApply(host, event.request);
48 |
49 | event.respondWith( response );
50 | }
51 | })
52 |
53 | async function fetchAndApply(host, request) {
54 | let f_url = new URL(request.url);
55 | let a_url = new URL(host);
56 | let replace_path = a_url.pathname;
57 | if (replace_path.substr(replace_path.length-1)!='/') replace_path += '/';
58 | let replaced_path = '/';
59 | let query = f_url.search;
60 | let path = f_url.pathname;
61 | if (host.substr(host.length-1)=='/') path = path.substr(1);
62 | f_url.href = host + path + query;
63 |
64 | let response = null;
65 | if (!CFproxy) {
66 | response = await fetch(f_url, request);
67 | } else {
68 | let method = request.method;
69 | let body = request.body;
70 | let request_headers = request.headers;
71 | let new_request_headers = new Headers(request_headers);
72 | new_request_headers.set('Host', f_url.host);
73 | new_request_headers.set('Referer', request.url);
74 | response = await fetch(f_url.href, {
75 | /*cf: {
76 | cacheEverything: true,
77 | cacheTtl: 1000,
78 | mirage: true,
79 | polish: "on",
80 | minify: {
81 | javascript: true,
82 | css: true,
83 | html: true,
84 | }
85 | },*/
86 | method: method,
87 | body: body,
88 | headers: new_request_headers
89 | });
90 | }
91 |
92 | let out_headers = new Headers(response.headers);
93 | if (out_headers.get('Content-Disposition')=='attachment') out_headers.delete('Content-Disposition');
94 | let out_body = null;
95 | let contentType = out_headers.get('Content-Type');
96 | if (contentType.includes("application/text")) {
97 | out_body = await response.text();
98 | while (replace_path!='/'&&out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
99 | } else if (contentType.includes("text/html")) {
100 | //f_url.href +
101 | out_body = await response.text();
102 | while (replace_path!='/'&&out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
103 | } else {
104 | out_body = await response.body;
105 | }
106 |
107 | let out_response = new Response(out_body, {
108 | status: response.status,
109 | headers: out_headers
110 | })
111 |
112 | return out_response;
113 | }
114 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Tfo",
3 | "description": "Deploy Tfo to heroku",
4 | "website": "https://github.com/BingoKingo/Tfo",
5 | "repository": "https://github.com/BingoKingo/Tfo",
6 | "success_url": "/"
7 | }
8 |
--------------------------------------------------------------------------------
/disk/OnedriveCN.php:
--------------------------------------------------------------------------------
1 | disktag = $tag;
8 | $this->redirect_uri = 'https://scfonedrive.github.io';
9 | if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
10 | $this->client_id = getConfig('client_id', $tag);
11 | $this->client_secret = getConfig('client_secret', $tag);
12 | } else {
13 | $this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
14 | $this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
15 | }
16 | $this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
17 | $this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
18 | $this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
19 | $res = $this->get_access_token(getConfig('refresh_token', $tag));
20 |
21 | $this->client_secret = urlencode($this->client_secret);
22 | $this->scope = urlencode($this->scope);
23 | $this->DownurlStrName = '@microsoft.graph.downloadUrl';
24 | $this->ext_api_url = '/me/drive/root';
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/disk/Sharelink.php:
--------------------------------------------------------------------------------
1 | disktag = $tag;
8 | $this->redirect_uri = 'https://scfonedrive.github.io';
9 | $this->api_url = getConfig('shareapiurl', $tag);
10 | $res = $this->get_access_token(1);
11 | //$this->ext_api_url = '/me/drive/root';
12 | $this->DownurlStrName = '@content.downloadUrl';
13 | }
14 |
15 | public function ext_show_innerenv()
16 | {
17 | return [ 'shareurl' ];
18 | }
19 |
20 | protected function get_access_token($refresh_token) {
21 | if (!($this->access_token = getcache('access_token', $this->disktag))) {
22 | $shareurl = getConfig('shareurl', $this->disktag);
23 | if (!($this->sharecookie = getcache('sharecookie', $this->disktag))) {
24 | $res = curl('GET', $shareurl, '', [], 1);
25 | error_log1(json_encode($res, JSON_PRETTY_PRINT));
26 | if (isset($res['returnhead']['Set-Cookie'])) $this->sharecookie = $res['returnhead']['Set-Cookie'];
27 | if (isset($res['returnhead']['set-cookie'])) $this->sharecookie = $res['returnhead']['set-cookie'];
28 | if ($this->sharecookie=='') {
29 | $this->error = $res;
30 | return false;
31 | }
32 | savecache('sharecookie', $this->sharecookie, $this->disktag);
33 | }
34 | $tmp1 = splitlast($shareurl, '/')[0];
35 | $account = splitlast($tmp1, '/')[1];
36 | $domain = splitlast($shareurl, '/:')[0];
37 | $response = curl('POST',
38 | $domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE",
39 | '{"parameters":{"__metadata":{"type":"SP.RenderListDataParameters"},"RenderOptions":136967,"AllowMultipleValueFilterForTaxonomyFields":true,"AddRequiredFields":true}}',
40 | [ 'Accept' => 'application/json;odata=verbose', 'Content-Type' => 'application/json;odata=verbose', 'origin' => $domain, 'Cookie' => $this->sharecookie ]
41 | );
42 | if ($response['stat']==200) $ret = json_decode($response['body'], true);
43 | $this->access_token = splitlast($ret['ListSchema']['.driveAccessToken'],'=')[1];
44 | $this->api_url = $ret['ListSchema']['.driveUrl'].'/root';
45 | if (!$this->access_token) {
46 | error_log1($domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE");
47 | error_log1('failed to get share access_token. response' . json_encode($ret));
48 | //$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
49 | $response['body'] .= '
' .json_decode($response['body'], true)['error']['message']['value'];
50 | $response['body'] .= '
failed to get shareurl access_token.';
51 | $this->error = $response;
52 | return false;
53 | //throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
54 | }
55 | //$tmp = $ret;
56 | //$tmp['access_token'] = '******';
57 | //error_log1('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
58 | savecache('access_token', $this->access_token, $this->disktag);
59 | $tmp1 = null;
60 | if (getConfig('shareapiurl', $this->disktag)!=$this->api_url) $tmp1['shareapiurl'] = $this->api_url;
61 | //if (getConfig('sharecookie', $this->disktag)!=$this->sharecookie) $tmp1['sharecookie'] = $this->sharecookie;
62 | if (!!$tmp1) setConfig($tmp1, $this->disktag);
63 | return true;
64 | }
65 | return true;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/disk/Sharepoint.php:
--------------------------------------------------------------------------------
1 | disktag = $tag;
8 | $this->redirect_uri = 'https://scfonedrive.github.io';
9 | if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
10 | $this->client_id = getConfig('client_id', $tag);
11 | $this->client_secret = getConfig('client_secret', $tag);
12 | } else {
13 | $this->client_id = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
14 | $this->client_secret = '_I5gOpmG5vTC2Ts_K._wCW4nN1km~4Pk52';
15 | }
16 | $this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
17 | $this->api_url = 'https://graph.microsoft.com/v1.0';
18 | $this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All https://graph.microsoft.com/Sites.ReadWrite.All offline_access';
19 | $res = $this->get_access_token(getConfig('refresh_token', $tag));
20 |
21 | $this->client_secret = urlencode($this->client_secret);
22 | $this->scope = urlencode($this->scope);
23 | $this->DownurlStrName = '@microsoft.graph.downloadUrl';
24 | $this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
25 | }
26 |
27 | public function ext_show_innerenv()
28 | {
29 | return [ 'sharepointSite', 'siteid' ];
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/disk/SharepointCN.php:
--------------------------------------------------------------------------------
1 | disktag = $tag;
8 | $this->redirect_uri = 'https://scfonedrive.github.io';
9 | if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
10 | $this->client_id = getConfig('client_id', $tag);
11 | $this->client_secret = getConfig('client_secret', $tag);
12 | } else {
13 | $this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
14 | $this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
15 | }
16 | $this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
17 | $this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
18 | $this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
19 | $res = $this->get_access_token(getConfig('refresh_token', $tag));
20 |
21 | $this->client_secret = urlencode($this->client_secret);
22 | $this->scope = urlencode($this->scope);
23 | $this->DownurlStrName = '@microsoft.graph.downloadUrl';
24 | $this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
25 | }
26 |
27 | public function ext_show_innerenv()
28 | {
29 | return [ 'sharepointSite', 'siteid' ];
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/glitch.json:
--------------------------------------------------------------------------------
1 | {
2 | "start": "php -S 0.0.0.0:8080 index.php"
3 | }
4 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | '. json_encode($_SERVER, JSON_PRETTY_PRINT).'';
11 | //echo '
'. json_encode($_ENV, JSON_PRETTY_PRINT).'
';
12 | global $platform;
13 | $platform = checkPlatform();
14 | function checkPlatform() {
15 | if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud')
16 | return 'SCF';
17 | if (isset($_SERVER['FC_FUNC_CODE_PATH']))
18 | return 'FC';
19 | if (isset($_SERVER['RUNTIME_LOG_PATH']) && $_SERVER['RUNTIME_LOG_PATH']=='/home/snuser/log')
20 | return 'FG';
21 | if (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7')
22 | return 'CFC';
23 | if (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app')
24 | return 'Heroku';
25 | if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user')
26 | return 'Vercel';
27 | if (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/')
28 | return 'Replit';
29 | return 'Normal';
30 | }
31 | function writebackPlatform($p) {
32 | if ('SCF'==$p) $_SERVER['USER']='qcloud';
33 | if ('FC'==$p) $_SERVER['FC_FUNC_CODE_PATH']=getenv('FC_FUNC_CODE_PATH');
34 | if ('FG'==$p) $_SERVER['RUNTIME_LOG_PATH']='/home/snuser/log';
35 | if ('CFC'==$p) $_SERVER['BCE_CFC_RUNTIME_NAME']='php7';
36 | //if ('Heroku'==$p) $_SERVER['HEROKU_APP_DIR']='/app';
37 | if ('Vercel'==$p) $_SERVER['DOCUMENT_ROOT']='/var/task/user';
38 | //if ('Replit'==$p) $_SERVER['DOCUMENT_ROOT']='/home/runner/';
39 | }
40 | if ('SCF'==$platform) {
41 | if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
42 | else include 'platform/TencentSCF_env.php';
43 | } elseif ('FC'==$platform) {
44 | include 'platform/AliyunFC.php';
45 | } elseif ('FG'==$platform) {
46 | //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
47 | //else include 'platform/HuaweiFG_env.php';
48 | echo 'FG' . PHP_EOL;
49 | } elseif ('CFC'==$platform) {
50 | include 'platform/BaiduCFC.php';
51 | } elseif ('Heroku'==$platform) {
52 | include 'platform/Heroku.php';
53 | $path = getpath();
54 | //echo 'path:'. $path;
55 | $_GET = getGET();
56 | //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
57 | $re = main($path);
58 | $sendHeaders = array();
59 | foreach ($re['headers'] as $headerName => $headerVal) {
60 | header($headerName . ': ' . $headerVal, true);
61 | }
62 | http_response_code($re['statusCode']);
63 | if ($re['isBase64Encoded']) echo base64_decode($re['body']);
64 | else echo $re['body'];
65 | } elseif ('Vercel'==$platform) {
66 | if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
67 | else include 'platform/Vercel.php';
68 |
69 | writebackPlatform('Vercel');
70 | $path = getpath();
71 | //echo 'path:'. $path;
72 | $_GET = getGET();
73 | //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
74 | $re = main($path);
75 | $sendHeaders = array();
76 | foreach ($re['headers'] as $headerName => $headerVal) {
77 | header($headerName . ': ' . $headerVal, true);
78 | }
79 | http_response_code($re['statusCode']);
80 | if ($re['isBase64Encoded']) echo base64_decode($re['body']);
81 | else echo $re['body'];
82 | } elseif ('Replit'==$platform) {
83 | include 'platform/Replit.php';
84 |
85 | $path = getpath();
86 | //echo 'path:'. $path;
87 | $_GET = getGET();
88 | //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
89 |
90 | $re = main($path);
91 | $sendHeaders = array();
92 | foreach ($re['headers'] as $headerName => $headerVal) {
93 | header($headerName . ': ' . $headerVal, true);
94 | }
95 | http_response_code($re['statusCode']);
96 | if ($re['isBase64Encoded']) echo base64_decode($re['body']);
97 | else echo $re['body'];
98 | } else {
99 | include 'platform/Normal.php';
100 | if (!function_exists('curl_init')) {
101 | http_response_code(500);
102 | echo 'Need curl, please install php-curl.';
103 | exit(1);
104 | }
105 | $path = getpath();
106 | //echo 'path:'. $path;
107 | $_GET = getGET();
108 | //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
109 | $re = main($path);
110 | $sendHeaders = array();
111 | foreach ($re['headers'] as $headerName => $headerVal) {
112 | header($headerName . ': ' . $headerVal, true);
113 | }
114 | http_response_code($re['statusCode']);
115 | if ($re['isBase64Encoded']) echo base64_decode($re['body']);
116 | else echo $re['body'];
117 | }
118 |
119 | // Tencent SCF
120 | function main_handler($event, $context)
121 | {
122 | $event = json_decode(json_encode($event), true);
123 | $context = json_decode(json_encode($context), true);
124 | printInput($event, $context);
125 | if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
126 | if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
127 | }
128 | unset($_POST);
129 | unset($_GET);
130 | unset($_COOKIE);
131 | unset($_SERVER);
132 | writebackPlatform('SCF');
133 | GetGlobalVariable($event);
134 | //echo ''. json_encode($_COOKIE, JSON_PRETTY_PRINT).'
';
135 | $path = GetPathSetting($event, $context);
136 |
137 | return main($path);
138 | }
139 |
140 | // Aliyun FC & Huawei FG & Baidu CFC
141 | function handler($event, $context)
142 | {
143 | global $platform;
144 | if ('FC'==$platform) {
145 | // Aliyun FC
146 | set_error_handler("myErrorHandler");
147 | $tmp = array(
148 | 'method' => $event->getMethod(),
149 | 'clientIP' => $event->getAttribute("clientIP"),
150 | 'requestURI' => $event->getAttribute("requestURI"),
151 | 'path' => spurlencode($event->getAttribute("path"), '/'),
152 | 'queryString' => $event->getQueryParams(),
153 | 'headers' => $event->getHeaders(),
154 | 'body' => $event->getBody()->getContents(),
155 | );
156 | $event = $tmp;
157 | $context = json_decode(json_encode($context), true);
158 | printInput($event, $context);
159 | unset($_POST);
160 | unset($_GET);
161 | unset($_COOKIE);
162 | unset($_SERVER);
163 | writebackPlatform('FC');
164 | GetGlobalVariable($event);
165 | $path = GetPathSetting($event, $context);
166 |
167 | $re = main($path);
168 |
169 | return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], ($re['isBase64Encoded']?base64_decode($re['body']):$re['body']));
170 |
171 | } elseif ('FG'==$platform) {
172 | // Huawei FG
173 | global $contextUserData;
174 | $contextUserData = $context;
175 | if ($context->getUserData('ONEMANAGER_CONFIG_SAVE')=='file') include_once 'platform/HuaweiFG_file.php';
176 | else include_once 'platform/HuaweiFG_env.php';
177 |
178 | $event = json_decode(json_encode($event), true);
179 | if ($event['isBase64Encoded']) $event['body'] = base64_decode($event['body']);
180 |
181 | printInput($event, $context);
182 | unset($_POST);
183 | unset($_GET);
184 | unset($_COOKIE);
185 | unset($_SERVER);
186 | writebackPlatform('FG');
187 | GetGlobalVariable($event);
188 | //echo ''. json_encode($_COOKIE, JSON_PRETTY_PRINT).'
';
189 | $path = GetPathSetting($event, $context);
190 |
191 | return main($path);
192 |
193 | } elseif ('CFC'==$platform) {
194 | // Baidu CFC
195 | //$html = ''. json_encode($event, JSON_PRETTY_PRINT).'
';
196 | //$html .= ''. json_encode($context, JSON_PRETTY_PRINT).'
';
197 | //$html .= ''. json_encode($_SERVER, JSON_PRETTY_PRINT).'
';
198 | //$html .= $event['path'];
199 | //$html .= $context['functionBrn'];
200 | //return json_encode(output($html), JSON_FORCE_OBJECT);
201 |
202 | printInput($event, $context);
203 | unset($_POST);
204 | unset($_GET);
205 | unset($_COOKIE);
206 | unset($_SERVER);
207 | writebackPlatform('CFC');
208 | GetGlobalVariable($event);
209 | //echo ''. json_encode($_COOKIE, JSON_PRETTY_PRINT).'
';
210 | $path = GetPathSetting($event, $context);
211 |
212 | return json_encode(main($path), JSON_FORCE_OBJECT);
213 |
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/js/sha1.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Minified by jsDelivr using UglifyJS v3.1.10.
3 | * Original file: /npm/js-sha1@0.6.0/src/sha1.js
4 | *
5 | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 | */
7 | !function(){"use strict";function Sha1(t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var root="object"==typeof window?window:{},NODE_JS=!root.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS&&(root=global);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD="function"==typeof define&&define.amd,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(t){return function(h){return new Sha1(!0).update(h)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Sha1},t.update=function(h){return t.create().update(h)};for(var h=0;h>2]|=t[i]<>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(o[e>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=64?(this.block=o[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha1.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,h=this.lastByteIndex;t[16]=this.block,t[h>>2]|=EXTRA[3&h],this.block=t[16],h>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var t,h,s=this.h0,e=this.h1,i=this.h2,r=this.h3,o=this.h4,H=this.blocks;for(t=16;t<80;++t)h=H[t-3]^H[t-8]^H[t-14]^H[t-16],H[t]=h<<1|h>>>31;for(t=0;t<20;t+=5)s=(h=(e=(h=(i=(h=(r=(h=(o=(h=s<<5|s>>>27)+(e&i|~e&r)+o+1518500249+H[t]<<0)<<5|o>>>27)+(s&(e=e<<30|e>>>2)|~s&i)+r+1518500249+H[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|~o&e)+i+1518500249+H[t+2]<<0)<<5|i>>>27)+(r&(o=o<<30|o>>>2)|~r&s)+e+1518500249+H[t+3]<<0)<<5|e>>>27)+(i&(r=r<<30|r>>>2)|~i&o)+s+1518500249+H[t+4]<<0,i=i<<30|i>>>2;for(;t<40;t+=5)s=(h=(e=(h=(i=(h=(r=(h=(o=(h=s<<5|s>>>27)+(e^i^r)+o+1859775393+H[t]<<0)<<5|o>>>27)+(s^(e=e<<30|e>>>2)^i)+r+1859775393+H[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^e)+i+1859775393+H[t+2]<<0)<<5|i>>>27)+(r^(o=o<<30|o>>>2)^s)+e+1859775393+H[t+3]<<0)<<5|e>>>27)+(i^(r=r<<30|r>>>2)^o)+s+1859775393+H[t+4]<<0,i=i<<30|i>>>2;for(;t<60;t+=5)s=(h=(e=(h=(i=(h=(r=(h=(o=(h=s<<5|s>>>27)+(e&i|e&r|i&r)+o-1894007588+H[t]<<0)<<5|o>>>27)+(s&(e=e<<30|e>>>2)|s&i|e&i)+r-1894007588+H[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|o&e|s&e)+i-1894007588+H[t+2]<<0)<<5|i>>>27)+(r&(o=o<<30|o>>>2)|r&s|o&s)+e-1894007588+H[t+3]<<0)<<5|e>>>27)+(i&(r=r<<30|r>>>2)|i&o|r&o)+s-1894007588+H[t+4]<<0,i=i<<30|i>>>2;for(;t<80;t+=5)s=(h=(e=(h=(i=(h=(r=(h=(o=(h=s<<5|s>>>27)+(e^i^r)+o-899497514+H[t]<<0)<<5|o>>>27)+(s^(e=e<<30|e>>>2)^i)+r-899497514+H[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^e)+i-899497514+H[t+2]<<0)<<5|i>>>27)+(r^(o=o<<30|o>>>2)^s)+e-899497514+H[t+3]<<0)<<5|e>>>27)+(i^(r=r<<30|r>>>2)^o)+s-899497514+H[t+4]<<0,i=i<<30|i>>>2;this.h0=this.h0+s<<0,this.h1=this.h1+e<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+o<<0},Sha1.prototype.hex=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,e=this.h3,i=this.h4;return HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[h>>28&15]+HEX_CHARS[h>>24&15]+HEX_CHARS[h>>20&15]+HEX_CHARS[h>>16&15]+HEX_CHARS[h>>12&15]+HEX_CHARS[h>>8&15]+HEX_CHARS[h>>4&15]+HEX_CHARS[15&h]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,e=this.h3,i=this.h4;return[t>>24&255,t>>16&255,t>>8&255,255&t,h>>24&255,h>>16&255,h>>8&255,255&h,s>>24&255,s>>16&255,s>>8&255,255&s,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),h=new DataView(t);return h.setUint32(0,this.h0),h.setUint32(4,this.h1),h.setUint32(8,this.h2),h.setUint32(12,this.h3),h.setUint32(16,this.h4),t};var exports=createMethod();COMMON_JS?module.exports=exports:(root.sha1=exports,AMD&&define(function(){return exports}))}();
8 | //# sourceMappingURL=/sm/dad6bd9f16f12d9db4b0e4eaae5c5f614cb87edf6808e087afac03051831773b.map
9 |
--------------------------------------------------------------------------------
/js/spark-md5.min.js:
--------------------------------------------------------------------------------
1 | (function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5});
--------------------------------------------------------------------------------
/platform/Heroku.php:
--------------------------------------------------------------------------------
1 | ';
26 | $stat = 201;
27 | }
28 | //return message($html, $title, $stat);
29 | }
30 | $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
31 | $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
32 | $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_X_FORWARDED_PROTO'];
33 | $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
34 | $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
35 | $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
36 | $p = strpos($_SERVER['REQUEST_URI'],'?');
37 | if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
38 | else $path = $_SERVER['REQUEST_URI'];
39 | $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
40 | return substr($path, 1);
41 | //return spurlencode($path, '/');
42 | }
43 |
44 | function getGET()
45 | {
46 | //error_log1('POST:' . json_encode($_POST));
47 | if (!$_POST) {
48 | if (!!$HTTP_RAW_POST_DATA) {
49 | $tmpdata = $HTTP_RAW_POST_DATA;
50 | //error_log1('RAW:' . $tmpdata);
51 | } else {
52 | $tmpdata = file_get_contents('php://input');
53 | //error_log1('PHPINPUT:' . $tmpdata);
54 | }
55 | if (!!$tmpdata) {
56 | $postbody = explode("&", $tmpdata);
57 | foreach ($postbody as $postvalues) {
58 | $pos = strpos($postvalues,"=");
59 | $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
60 | }
61 | //error_log1('POSTformPHPINPUT:' . json_encode($_POST));
62 | }
63 | }
64 | $p = strpos($_SERVER['REQUEST_URI'],'?');
65 | if ($p>0) {
66 | $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
67 | $getstrarr = explode("&",$getstr);
68 | foreach ($getstrarr as $getvalues) {
69 | if ($getvalues != '') {
70 | $pos = strpos($getvalues, "=");
71 | //echo $pos;
72 | if ($pos > 0) {
73 | $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
74 | } else {
75 | $getarry[urldecode($getvalues)] = true;
76 | }
77 | }
78 | }
79 | }
80 | if (isset($getarry)) {
81 | return $getarry;
82 | } else {
83 | return [];
84 | }
85 | }
86 |
87 | function getConfig($str, $disktag = '')
88 | {
89 | if (isInnerEnv($str)) {
90 | if ($disktag=='') $disktag = $_SERVER['disktag'];
91 | $env = json_decode(getenv($disktag), true);
92 | if (isset($env[$str])) {
93 | if (isBase64Env($str)) return base64y_decode($env[$str]);
94 | else return $env[$str];
95 | }
96 | } else {
97 | if (isBase64Env($str)) return base64y_decode(getenv($str));
98 | else return getenv($str);
99 | }
100 | return '';
101 | }
102 |
103 | function setConfig($arr, $disktag = '')
104 | {
105 | if ($disktag=='') $disktag = $_SERVER['disktag'];
106 | $disktags = explode("|",getConfig('disktag'));
107 | if ($disktag!='') $diskconfig = json_decode(getenv($disktag), true);
108 | $tmp = [];
109 | $indisk = 0;
110 | $operatedisk = 0;
111 | foreach ($arr as $k => $v) {
112 | if (isCommonEnv($k)) {
113 | if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
114 | else $tmp[$k] = $v;
115 | } elseif (isInnerEnv($k)) {
116 | if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
117 | else $diskconfig[$k] = $v;
118 | $indisk = 1;
119 | } elseif ($k=='disktag_add') {
120 | array_push($disktags, $v);
121 | $operatedisk = 1;
122 | } elseif ($k=='disktag_del') {
123 | $disktags = array_diff($disktags, [ $v ]);
124 | $tmp[$v] = '';
125 | $operatedisk = 1;
126 | } elseif ($k=='disktag_copy') {
127 | $newtag = $v . '_' . date("Ymd_His");
128 | $tmp[$newtag] = getConfig($v);
129 | array_push($disktags, $newtag);
130 | $operatedisk = 1;
131 | } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
132 | if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
133 | } else {
134 | $tmp[$k] = json_encode($v);
135 | }
136 | }
137 | if ($indisk) {
138 | $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
139 | ksort($diskconfig);
140 | $tmp[$disktag] = json_encode($diskconfig);
141 | }
142 | if ($operatedisk) {
143 | if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
144 | $tags = [];
145 | foreach ($disktags as $tag) {
146 | if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
147 | else array_push($tags, $tag);
148 | }
149 | $tmp['disktag'] = implode('|', $tags);
150 | $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
151 | $tmp[$arr['disktag_rename']] = null;
152 | } else {
153 | $disktags = array_unique($disktags);
154 | foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
155 | if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
156 | else $tmp['disktag'] = null;
157 | }
158 | }
159 | foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
160 |
161 | return setHerokuConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
162 | error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
163 | }
164 |
165 | function install()
166 | {
167 | global $constStr;
168 | if ($_GET['install1']) {
169 | if ($_POST['admin']!='') {
170 | $tmp['admin'] = $_POST['admin'];
171 | //$tmp['language'] = $_POST['language'];
172 | $tmp['timezone'] = $_COOKIE['timezone'];
173 | $APIKey = $_POST['APIKey'];
174 | $tmp['APIKey'] = $APIKey;
175 | $HerokuappId = getConfig('HerokuappId');
176 | if ($HerokuappId=='') {
177 | $function_name = getConfig('function_name');
178 | if ($function_name=='') {
179 | $tmp1 = substr($_SERVER['HTTP_HOST'], 0, strrpos($_SERVER['HTTP_HOST'], '.'));
180 | $maindomain = substr($tmp1, strrpos($tmp1, '.')+1);
181 | if ($maindomain=='herokuapp') $function_name = substr($tmp1, 0, strrpos($tmp1, '.'));
182 | else return message('Please visit from xxxx.herokuapp.com', '', 500);
183 | $res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name, '', $APIKey);
184 | $response = json_decode($res['body'], true);
185 | if (isset($response['build_stack'])) {
186 | $HerokuappId = $response['id'];
187 | } else {
188 | return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
189 | }
190 | }
191 | }
192 | $tmp['HerokuappId'] = $HerokuappId;
193 | $response = json_decode(setHerokuConfig($tmp, $HerokuappId, $APIKey)['body'], true);
194 | if (api_error($response)) {
195 | $html = api_error_msg($response);
196 | $title = 'Error';
197 | return message($html, $title, 400);
198 | } else {
199 | $html = getconstStr('Success') . '
200 | ';
216 | return message($html, $title, 201, 1);
217 | }
218 | }
219 | }
220 | if ($_GET['install0']) {
221 | $html .= '
222 |
236 | ';
266 | $title = getconstStr('SelectLanguage');
267 | return message($html, $title, 201);
268 | }
269 | $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
270 | $title = 'Install';
271 | return message($html, $title, 201);
272 | }
273 |
274 | function HerokuAPI($method, $url, $data = '', $apikey)
275 | {
276 | if ($method=='PATCH'||$method=='POST') {
277 | $headers['Content-Type'] = 'application/json';
278 | }
279 | $headers['Authorization'] = 'Bearer ' . $apikey;
280 | $headers['Accept'] = 'application/vnd.heroku+json; version=3';
281 | //if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
282 | //if (!isset($headers['Referer'])) $headers['Referer'] = $url;
283 | $sendHeaders = array();
284 | foreach ($headers as $headerName => $headerVal) {
285 | $sendHeaders[] = $headerName . ': ' . $headerVal;
286 | }
287 | error_log1($method . $url . $data . $apikey);
288 | $ch = curl_init();
289 | curl_setopt($ch, CURLOPT_URL, $url);
290 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
291 | curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
292 | curl_setopt($ch, CURLOPT_TIMEOUT, 5);
293 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
294 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
295 | curl_setopt($ch, CURLOPT_HEADER, 0);
296 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
297 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
298 | curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
299 | $response['body'] = curl_exec($ch);
300 | $response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
301 | curl_close($ch);
302 | error_log1($response['stat'].'
303 | '.$response['body'].'
304 | ');
305 | return $response;
306 | }
307 |
308 | function getHerokuConfig($HerokuappId, $apikey)
309 | {
310 | return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', '', $apikey);
311 | }
312 |
313 | function setHerokuConfig($env, $HerokuappId, $apikey)
314 | {
315 | $data = json_encode($env);
316 | if (substr($data, 0, 1)=='{') return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', $data, $apikey);
317 | }
318 |
319 | function updateHerokuapp($HerokuappId, $apikey, $source)
320 | {
321 | $tmp['source_blob']['url'] = $source;
322 | $data = json_encode($tmp);
323 | $response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
324 | $result = json_decode( $response['body'], true );
325 | $result['DplStatus'] = $result['id'];
326 | $response['body'] = json_encode($result);
327 | return $response;
328 | }
329 |
330 | function api_error($response)
331 | {
332 | return isset($response['id'])&&isset($response['message']);
333 | }
334 |
335 | function api_error_msg($response)
336 | {
337 | return $response['id'] . '
338 | ' . $response['message'] . '
339 | function_name:' . $_SERVER['function_name'] . '
340 | ';
341 | }
342 |
343 | // Tfo
344 | function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
345 | {
346 | //'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
347 | $source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
348 | return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
349 | }
350 |
351 | function setConfigResponse($response)
352 | {
353 | return json_decode( $response['body'], true );
354 | }
355 |
356 | function WaitFunction($buildId = '') {
357 | // GET /apps/{app_id_or_name}/builds/{build_id}
358 | if ($buildId=='1') return true;
359 | $response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
360 | if ($response['stat']==200) {
361 | $result = json_decode($response['body'], true);
362 | if ($result['status']=="succeeded") return true;
363 | else return false;
364 | } else {
365 | $response['body'] .= $url;
366 | return $response;
367 | }
368 | }
369 |
370 | function changeAuthKey() {
371 | if ($_POST['APIKey']!='') {
372 | $APIKey = $_POST['APIKey'];
373 | $tmp['APIKey'] = $APIKey;
374 | $response = setConfigResponse( setHerokuConfig($tmp, getConfig('HerokuappId'), $APIKey) );
375 | if (api_error($response)) {
376 | $html = api_error_msg($response);
377 | $title = 'Error';
378 | return message($html, $title, 400);
379 | } else {
380 | $html = getconstStr('Success') . '
381 | ';
393 | return message($html, $title, 201, 1);
394 | }
395 | }
396 | $html = '
397 |
402 | ';
412 | return message($html, 'Change platform Auth token or key', 200);
413 | }
414 |
415 | function smallfileupload($drive, $path) {
416 | if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
417 | if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
418 | return $drive->smallfileupload($path, $_FILES['file1']);
419 | }
420 |
--------------------------------------------------------------------------------
/platform/Normal.php:
--------------------------------------------------------------------------------
1 | 0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
23 | else $path = $_SERVER['REQUEST_URI'];
24 | $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
25 | return $path;
26 | }
27 |
28 | function getGET()
29 | {
30 | if (!$_POST) {
31 | if (!!$HTTP_RAW_POST_DATA) {
32 | $tmpdata = $HTTP_RAW_POST_DATA;
33 | } else {
34 | $tmpdata = file_get_contents('php://input');
35 | }
36 | if (!!$tmpdata) {
37 | $postbody = explode("&", $tmpdata);
38 | foreach ($postbody as $postvalues) {
39 | $pos = strpos($postvalues,"=");
40 | $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
41 | }
42 | }
43 | }
44 | if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
45 | $p = strpos($_SERVER['REQUEST_URI'],'?');
46 | if ($p>0) {
47 | $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
48 | $getstrarr = explode("&",$getstr);
49 | foreach ($getstrarr as $getvalues) {
50 | if ($getvalues != '') {
51 | $pos = strpos($getvalues, "=");
52 | //echo $pos;
53 | if ($pos > 0) {
54 | $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
55 | } else {
56 | $getarry[urldecode($getvalues)] = true;
57 | }
58 | }
59 | }
60 | }
61 | if (isset($getarry)) {
62 | return $getarry;
63 | } else {
64 | return [];
65 | }
66 | }
67 |
68 | function getConfig($str, $disktag = '')
69 | {
70 | global $slash;
71 | $projectPath = splitlast(__DIR__, $slash)[0];
72 | $configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
73 | $s = file_get_contents($configPath);
74 | $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
75 | if ($configs!='') {
76 | $envs = json_decode($configs, true);
77 | if (isInnerEnv($str)) {
78 | if ($disktag=='') $disktag = $_SERVER['disktag'];
79 | if (isset($envs[$disktag][$str])) {
80 | if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
81 | else return $envs[$disktag][$str];
82 | }
83 | } else {
84 | if (isset($envs[$str])) {
85 | if (isBase64Env($str)) return base64y_decode($envs[$str]);
86 | else return $envs[$str];
87 | }
88 | }
89 | }
90 | return '';
91 | }
92 |
93 | function setConfig($arr, $disktag = '')
94 | {
95 | global $slash;
96 | if ($disktag=='') $disktag = $_SERVER['disktag'];
97 | $projectPath = splitlast(__DIR__, $slash)[0];
98 | $configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
99 | $s = file_get_contents($configPath);
100 | $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
101 | if ($configs!='') $envs = json_decode($configs, true);
102 | $disktags = explode("|", getConfig('disktag'));
103 | $indisk = 0;
104 | $operatedisk = 0;
105 | foreach ($arr as $k => $v) {
106 | if (isCommonEnv($k)) {
107 | if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
108 | else $envs[$k] = $v;
109 | } elseif (isInnerEnv($k)) {
110 | if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
111 | else $envs[$disktag][$k] = $v;
112 | $indisk = 1;
113 | } elseif ($k=='disktag_add') {
114 | array_push($disktags, $v);
115 | $operatedisk = 1;
116 | } elseif ($k=='disktag_del') {
117 | $disktags = array_diff($disktags, [ $v ]);
118 | $envs[$v] = '';
119 | $operatedisk = 1;
120 | } elseif ($k=='disktag_copy') {
121 | $newtag = $v . '_' . date("Ymd_His");
122 | $envs[$newtag] = $envs[$v];
123 | array_push($disktags, $newtag);
124 | $operatedisk = 1;
125 | } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
126 | if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
127 | } else {
128 | //$tmpdisk = json_decode($v, true);
129 | //var_dump($tmpdisk);
130 | //error_log(json_encode($tmpdisk));
131 | //if ($tmpdisk===null)
132 | $envs[$k] = $v;
133 | //else $envs[$k] = $tmpdisk;
134 | }
135 | }
136 | if ($indisk) {
137 | $diskconfig = $envs[$disktag];
138 | $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
139 | ksort($diskconfig);
140 | $envs[$disktag] = $diskconfig;
141 | }
142 | if ($operatedisk) {
143 | if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
144 | $tags = [];
145 | foreach ($disktags as $tag) {
146 | if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
147 | else array_push($tags, $tag);
148 | }
149 | $envs['disktag'] = implode('|', $tags);
150 | $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
151 | unset($envs[$arr['disktag_rename']]);
152 | } else {
153 | $disktags = array_unique($disktags);
154 | foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
155 | if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
156 | else $envs['disktag'] = '';
157 | }
158 | }
159 | $envs = array_filter($envs, 'array_value_isnot_null');
160 | //ksort($envs);
161 | sortConfig($envs);
162 |
163 | //echo ''. json_encode($envs, JSON_PRETTY_PRINT).'
';
164 | $prestr = '0) return json_encode( [ 'response' => 'success' ] );
168 | return json_encode( [ 'message' => 'Failed to write config.', 'code' => 'failed' ] );
169 | }
170 |
171 | function install()
172 | {
173 | global $constStr;
174 | if ($_GET['install2']) {
175 | if ($_POST['admin']!='') {
176 | $tmp['admin'] = $_POST['admin'];
177 | //$tmp['language'] = $_COOKIE['language'];
178 | $tmp['timezone'] = $_COOKIE['timezone'];
179 | $response = setConfigResponse( setConfig($tmp) );
180 | if (api_error($response)) {
181 | $html = api_error_msg($response);
182 | $title = 'Error';
183 | return message($html, $title, 201);
184 | } else {
185 | return output('Jump
186 |
192 | ', 302);
193 | }
194 | }
195 | }
196 | if ($_GET['install1']) {
197 | if (!ConfigWriteable()) {
198 | $html .= getconstStr('MakesuerWriteable');
199 | $title = 'Error';
200 | return message($html, $title, 201);
201 | }
202 | /*if (!RewriteEngineOn()) {
203 | $html .= getconstStr('MakesuerRewriteOn');
204 | $title = 'Error';
205 | return message($html, $title, 201);
206 | }*/
207 | $html .= '
208 |
209 |
213 |
214 | ';
253 | $title = getconstStr('SetAdminPassword');
254 | return message($html, $title, 201);
255 | }
256 | if ($_GET['install0']) {
257 | $html .= '
258 |
267 | ';
277 | $title = getconstStr('SelectLanguage');
278 | return message($html, $title, 201);
279 | }
280 |
281 | $title = 'Install';
282 | $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind');
283 | return message($html, $title, 201);
284 | }
285 |
286 | function ConfigWriteable()
287 | {
288 | $t = md5( md5(time()).rand(1000,9999) );
289 | $r = setConfig([ 'tmp' => $t ]);
290 | $tmp = getConfig('tmp');
291 | setConfig([ 'tmp' => '' ]);
292 | if ($tmp == $t) return true;
293 | if ($r) return true;
294 | return false;
295 | }
296 |
297 | function api_error($response)
298 | {
299 | return isset($response['message']);
300 | }
301 |
302 | function api_error_msg($response)
303 | {
304 | return $response['code'] . '
305 | ' . $response['message'] . '
306 | ';
307 | }
308 |
309 | function setConfigResponse($response)
310 | {
311 | return json_decode($response, true);
312 | }
313 |
314 | // Tfo
315 | function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
316 | {
317 | global $slash;
318 | // __DIR__ is xxx/platform
319 | $projectPath = splitlast(__DIR__, $slash)[0];
320 |
321 | // 从github下载对应tar.gz,并解压
322 | $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
323 |
324 | $tarfile = $projectPath . $slash .'github.tar.gz';
325 | $githubfile = file_get_contents($url);
326 | if (!$githubfile) return 0;
327 | file_put_contents($tarfile, $githubfile);
328 |
329 | if (splitfirst(PHP_VERSION, '.')[0] > '5') {
330 | $phar = new PharData($tarfile); // need php5.3, 7, 8
331 | $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
332 | } else {
333 | ob_start();
334 | passthru('tar -xzvf ' . $tarfile, $stat);
335 | ob_get_clean();
336 | }
337 | unlink($tarfile);
338 |
339 | $outPath = '';
340 | $outPath = findIndexPath($projectPath);
341 | //error_log1($outPath);
342 | if ($outPath=='') return 0;
343 |
344 | //unlink($outPath.'/config.php');
345 | $response = rename($projectPath . $slash . '.data' . $slash . 'config.php', $outPath . $slash . '.data' . $slash . 'config.php');
346 | if (!$response) {
347 | $tmp1['code'] = "Move Failed";
348 | $tmp1['message'] = "Can not move " . $projectPath . $slash . '.data' . $slash . 'config.php' . " to " . $outPath . $slash . '.data' . $slash . 'config.php';
349 | return json_encode($tmp1);
350 | }
351 | return moveFolder($outPath, $projectPath);
352 | }
353 |
354 | function moveFolder($from, $to)
355 | {
356 | global $slash;
357 | if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
358 | if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
359 | if (!file_exists($to)) mkdir($to, 0777);
360 | $handler=opendir($from);
361 | while($filename=readdir($handler)) {
362 | if($filename != '.' && $filename != '..'){
363 | $fromfile = $from . $slash . $filename;
364 | $tofile = $to . $slash . $filename;
365 | if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
366 | $response = moveFolder($fromfile, $tofile);
367 | if (api_error(setConfigResponse($response))) return $response;
368 | }else{
369 | //if (file_exists($tofile)) unlink($tofile);
370 | $response = rename($fromfile, $tofile);
371 | if (!$response) {
372 | $tmp['code'] = "Move Failed";
373 | $tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
374 | return json_encode($tmp);
375 | }
376 | if (file_exists($fromfile)) unlink($fromfile);
377 | }
378 | }
379 | }
380 | closedir($handler);
381 | rmdir($from);
382 | return json_encode( [ 'response' => 'success' ] );
383 | }
384 |
385 | function WaitFunction() {
386 | return true;
387 | }
388 |
389 | function changeAuthKey() {
390 | return message("Not need.", 'Change platform Auth token or key', 404);
391 | }
392 |
393 | function smallfileupload($drive, $path) {
394 | if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
395 | if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
396 | return $drive->smallfileupload($path, $_FILES['file1']);
397 | }
398 |
--------------------------------------------------------------------------------
/platform/Replit.php:
--------------------------------------------------------------------------------
1 | 0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
20 | else $path = $_SERVER['REQUEST_URI'];
21 | $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
22 | return $path;
23 | }
24 |
25 | function getGET()
26 | {
27 | if (!$_POST) {
28 | if (!!$HTTP_RAW_POST_DATA) {
29 | $tmpdata = $HTTP_RAW_POST_DATA;
30 | } else {
31 | $tmpdata = file_get_contents('php://input');
32 | }
33 | if (!!$tmpdata) {
34 | $postbody = explode("&", $tmpdata);
35 | foreach ($postbody as $postvalues) {
36 | $pos = strpos($postvalues,"=");
37 | $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
38 | }
39 | }
40 | }
41 | if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
42 | $p = strpos($_SERVER['REQUEST_URI'],'?');
43 | if ($p>0) {
44 | $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
45 | $getstrarr = explode("&",$getstr);
46 | foreach ($getstrarr as $getvalues) {
47 | if ($getvalues != '') {
48 | $pos = strpos($getvalues, "=");
49 | //echo $pos;
50 | if ($pos > 0) {
51 | $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
52 | } else {
53 | $getarry[urldecode($getvalues)] = true;
54 | }
55 | }
56 | }
57 | }
58 | if (isset($getarry)) {
59 | return $getarry;
60 | } else {
61 | return [];
62 | }
63 | }
64 |
65 | function ReplitAPI($op, $key, $value = '') {
66 | //error_log1($op . '_' . $key . '_' . $value);
67 | $apiurl = getenv('REPLIT_DB_URL');
68 | //foreach (explode("\n", curl('GET', $apiurl . '?prefix')['body']) as $a) curl('DELETE', $apiurl . '/' . $a);
69 | if ($op === 'r') {
70 | if (!($config = getcache('REPLIT_CONFIG'))) {
71 | $config = json_decode(curl('GET', $apiurl . '/REPLIT_CONFIG')['body'], true);
72 | savecache('REPLIT_CONFIG', $config);
73 | }
74 | return ['stat'=>200, 'body'=>(is_array($config[$key])?json_encode($config[$key]):$config[$key])];
75 | } elseif ($op === 'w') {
76 | return curl('POST', $apiurl, 'REPLIT_CONFIG=' . $value, ["Content-Type"=>"application/x-www-form-urlencoded"]);
77 | } elseif ($op === 'd') {
78 | // not use
79 | return curl('DELETE', $apiurl . '/' . $key);
80 | } else {
81 | return ['stat'=>500, 'body'=>'error option input to function ReplitAPI().'];
82 | }
83 | }
84 |
85 | function getConfig($str, $disktag = '')
86 | {
87 | if (isInnerEnv($str)) {
88 | if ($disktag=='') $disktag = $_SERVER['disktag'];
89 | $env = json_decode(ReplitAPI('r', $disktag)['body'], true);
90 | if (isset($env[$str])) {
91 | if (isBase64Env($str)) return base64y_decode($env[$str]);
92 | else return $env[$str];
93 | }
94 | } else {
95 | if (isBase64Env($str)) return base64y_decode(ReplitAPI('r', $str)['body']);
96 | else return ReplitAPI('r', $str)['body'];
97 | }
98 | return '';
99 | }
100 |
101 | function setConfig($arr, $disktag = '')
102 | {
103 | if (!($envs = getcache('REPLIT_CONFIG'))) {
104 | $envs = json_decode(curl('GET', getenv('REPLIT_DB_URL') . '/REPLIT_CONFIG')['body'], true);
105 | savecache('REPLIT_CONFIG', $envs);
106 | }
107 | if ($disktag=='') $disktag = $_SERVER['disktag'];
108 | $disktags = explode("|", getConfig('disktag'));
109 | $indisk = 0;
110 | $operatedisk = 0;
111 | foreach ($arr as $k => $v) {
112 | if (isCommonEnv($k)) {
113 | if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
114 | else $envs[$k] = $v;
115 | } elseif (isInnerEnv($k)) {
116 | if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
117 | else $envs[$disktag][$k] = $v;
118 | $indisk = 1;
119 | } elseif ($k=='disktag_add') {
120 | array_push($disktags, $v);
121 | $operatedisk = 1;
122 | } elseif ($k=='disktag_del') {
123 | $disktags = array_diff($disktags, [ $v ]);
124 | $envs[$v] = '';
125 | $operatedisk = 1;
126 | } elseif ($k=='disktag_copy') {
127 | $newtag = $v . '_' . date("Ymd_His");
128 | $envs[$newtag] = $envs[$v];
129 | array_push($disktags, $newtag);
130 | $operatedisk = 1;
131 | } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
132 | if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
133 | } else {
134 | $envs[$k] = $v;
135 | }
136 | }
137 | if ($indisk) {
138 | $diskconfig = $envs[$disktag];
139 | $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
140 | ksort($diskconfig);
141 | $envs[$disktag] = $diskconfig;
142 | }
143 | if ($operatedisk) {
144 | if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
145 | $tags = [];
146 | foreach ($disktags as $tag) {
147 | if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
148 | else array_push($tags, $tag);
149 | }
150 | $envs['disktag'] = implode('|', $tags);
151 | $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
152 | unset($envs[$arr['disktag_rename']]);
153 | } else {
154 | $disktags = array_unique($disktags);
155 | foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
156 | if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
157 | else $envs['disktag'] = '';
158 | }
159 | }
160 | $envs = array_filter($envs, 'array_value_isnot_null');
161 | sortConfig($envs);
162 | $response = ReplitAPI('w', 'REPLIT_CONFIG', json_encode($envs));
163 | //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT));
164 | savecache('REPLIT_CONFIG', null, '', 0);
165 | if (api_error($response)) return ['stat'=>$response['stat'], 'body'=>$response['body'] . "
\nError in writting " . $key . "=" . $val];
166 | return $response;
167 | }
168 |
169 | function install()
170 | {
171 | global $constStr;
172 | if ($_GET['install2']) {
173 | if ($_POST['admin']!='') {
174 | $tmp['admin'] = $_POST['admin'];
175 | //$tmp['language'] = $_COOKIE['language'];
176 | $tmp['timezone'] = $_COOKIE['timezone'];
177 | $response = setConfigResponse( setConfig($tmp) );
178 | if (api_error($response)) {
179 | $html = api_error_msg($response);
180 | $title = 'Error';
181 | return message($html, $title, 201);
182 | } else {
183 | return output('Jump
184 |
190 | ', 302);
191 | }
192 | }
193 | }
194 | if ($_GET['install1']) {
195 | /*if (!ConfigWriteable()) {
196 | $html .= getconstStr('MakesuerWriteable');
197 | $title = 'Error';
198 | return message($html, $title, 201);
199 | }
200 | if (!RewriteEngineOn()) {
201 | $html .= getconstStr('MakesuerRewriteOn');
202 | $title = 'Error';
203 | return message($html, $title, 201);
204 | }*/
205 | $html .= '
206 |
210 | ';
226 | $title = getconstStr('SetAdminPassword');
227 | return message($html, $title, 201);
228 | }
229 | if ($_GET['install0']) {
230 | $html .= '
231 |
240 | ';
250 | $title = getconstStr('SelectLanguage');
251 | return message($html, $title, 201);
252 | }
253 |
254 | $title = 'Install';
255 | $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind');
256 | return message($html, $title, 201);
257 | }
258 |
259 | function ConfigWriteable()
260 | {
261 | $t = md5( md5(time()).rand(1000,9999) );
262 | $r = setConfig([ 'tmp' => $t ]);
263 | $tmp = getConfig('tmp');
264 | setConfig([ 'tmp' => '' ]);
265 | if ($tmp == $t) return true;
266 | if ($r) return true;
267 | return false;
268 | }
269 |
270 | function api_error($response)
271 | {
272 | return !($response['stat']==200||$response['stat']==204||$response['stat']==404);
273 | //return isset($response['message']);
274 | }
275 |
276 | function api_error_msg($response)
277 | {
278 | return ''. json_encode($response, JSON_PRETTY_PRINT).'
' . '
279 | ';
280 | }
281 |
282 | function setConfigResponse($response)
283 | {
284 | return $response;
285 | //return json_decode($response, true);
286 | }
287 |
288 | // Tfo
289 | function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
290 | {
291 | // __DIR__ is xxx/platform
292 | $projectPath = splitlast(__DIR__, '/')[0];
293 |
294 | // 从github下载对应tar.gz,并解压
295 | $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
296 | $tarfile = $projectPath . '/github.tar.gz';
297 | $githubfile = file_get_contents($url);
298 | if (!$githubfile) return ['stat'=>500, 'body'=>'download error from github.'];
299 | file_put_contents($tarfile, $githubfile);
300 | if (splitfirst(PHP_VERSION, '.')[0] > '5') {
301 | $phar = new PharData($tarfile); // need php5.3, 7, 8
302 | $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
303 | } else {
304 | ob_start();
305 | passthru('tar -xzvf ' . $tarfile, $stat);
306 | ob_get_clean();
307 | }
308 | unlink($tarfile);
309 |
310 | $outPath = '';
311 | $outPath = findIndexPath($projectPath);
312 | //error_log1($outPath);
313 | if ($outPath=='') return ['stat'=>500, 'body'=>'can\'t find folder after download from github.'];
314 |
315 | return moveFolder($outPath, $projectPath);
316 | }
317 |
318 | function moveFolder($from, $to)
319 | {
320 | if (substr($from, -1)=='/') $from = substr($from, 0, -1);
321 | if (substr($to, -1)=='/') $to = substr($to, 0, -1);
322 | if (!file_exists($to)) mkdir($to, 0777);
323 | $handler=opendir($from);
324 | while($filename=readdir($handler)) {
325 | if($filename != '.' && $filename != '..'){
326 | $fromfile = $from . '/' . $filename;
327 | $tofile = $to . '/' . $filename;
328 | if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
329 | $response = moveFolder($fromfile, $tofile);
330 | if (api_error(setConfigResponse($response))) return $response;
331 | }else{
332 | if (file_exists($tofile)) unlink($tofile);
333 | $response = rename($fromfile, $tofile);
334 | if (!$response) {
335 | $tmp['code'] = "Move Failed";
336 | $tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
337 | return ['stat'=>500, 'body'=>json_encode($tmp)];
338 | }
339 | if (file_exists($fromfile)) unlink($fromfile);
340 | }
341 | }
342 | }
343 | closedir($handler);
344 | rmdir($from);
345 | return ['stat'=>200, 'body'=>'success.'];
346 | }
347 |
348 | function WaitFunction() {
349 | return true;
350 | }
351 |
352 | function changeAuthKey() {
353 | return message("Not need.", 'Change platform Auth token or key', 404);
354 | }
355 |
356 | function smallfileupload($drive, $path) {
357 | if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
358 | if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
359 | return $drive->smallfileupload($path, $_FILES['file1']);
360 | }
361 |
--------------------------------------------------------------------------------
/platform/Replit_old.php:
--------------------------------------------------------------------------------
1 | 0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
20 | else $path = $_SERVER['REQUEST_URI'];
21 | $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
22 | return $path;
23 | }
24 |
25 | function getGET()
26 | {
27 | if (!$_POST) {
28 | if (!!$HTTP_RAW_POST_DATA) {
29 | $tmpdata = $HTTP_RAW_POST_DATA;
30 | } else {
31 | $tmpdata = file_get_contents('php://input');
32 | }
33 | if (!!$tmpdata) {
34 | $postbody = explode("&", $tmpdata);
35 | foreach ($postbody as $postvalues) {
36 | $pos = strpos($postvalues,"=");
37 | $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
38 | }
39 | }
40 | }
41 | if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
42 | $p = strpos($_SERVER['REQUEST_URI'],'?');
43 | if ($p>0) {
44 | $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
45 | $getstrarr = explode("&",$getstr);
46 | foreach ($getstrarr as $getvalues) {
47 | if ($getvalues != '') {
48 | $pos = strpos($getvalues, "=");
49 | //echo $pos;
50 | if ($pos > 0) {
51 | $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
52 | } else {
53 | $getarry[urldecode($getvalues)] = true;
54 | }
55 | }
56 | }
57 | }
58 | if (isset($getarry)) {
59 | return $getarry;
60 | } else {
61 | return [];
62 | }
63 | }
64 |
65 | function ReplitAPI($op, $key, $value = '') {
66 | //error_log1($op . '_' . $key . '_' . $value);
67 | $apiurl = getenv('REPLIT_DB_URL');
68 | if ($op === 'r') {
69 | return curl('GET', $apiurl . '/' . $key);
70 | } elseif ($op === 'w') {
71 | return curl('POST', $apiurl, $key . '=' . $value, ["Content-Type"=>"application/x-www-form-urlencoded"]);
72 | } elseif ($op === 'd') {
73 | return curl('DELETE', $apiurl . '/' . $key);
74 | } else {
75 | return ['stat'=>500, 'body'=>'error option input to function ReplitAPI().'];
76 | }
77 | }
78 |
79 | function getConfig($str, $disktag = '')
80 | {
81 | if (isInnerEnv($str)) {
82 | if ($disktag=='') $disktag = $_SERVER['disktag'];
83 | $env = json_decode(ReplitAPI('r', $disktag)['body'], true);
84 | if (isset($env[$str])) {
85 | if (isBase64Env($str)) return base64y_decode($env[$str]);
86 | else return $env[$str];
87 | }
88 | } else {
89 | if (isBase64Env($str)) return base64y_decode(ReplitAPI('r', $str)['body']);
90 | else return ReplitAPI('r', $str)['body'];
91 | }
92 | return '';
93 | }
94 |
95 | function setConfig($arr, $disktag = '')
96 | {
97 | if ($disktag=='') $disktag = $_SERVER['disktag'];
98 | $disktags = explode("|", getConfig('disktag'));
99 | if ($disktag!='') $diskconfig = json_decode(ReplitAPI('r', $disktag)['body'], true);
100 | $tmp = [];
101 | $indisk = 0;
102 | $operatedisk = 0;
103 | foreach ($arr as $k => $v) {
104 | if (isCommonEnv($k)) {
105 | if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
106 | else $tmp[$k] = $v;
107 | } elseif (isInnerEnv($k)) {
108 | if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
109 | else $diskconfig[$k] = $v;
110 | $indisk = 1;
111 | } elseif ($k=='disktag_add') {
112 | array_push($disktags, $v);
113 | $operatedisk = 1;
114 | } elseif ($k=='disktag_del') {
115 | $disktags = array_diff($disktags, [ $v ]);
116 | $tmp[$v] = '';
117 | $operatedisk = 1;
118 | } elseif ($k=='disktag_copy') {
119 | $newtag = $v . '_' . date("Ymd_His");
120 | $tmp[$newtag] = getConfig($v);
121 | array_push($disktags, $newtag);
122 | $operatedisk = 1;
123 | } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
124 | if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
125 | } else {
126 | $tmp[$k] = json_encode($v);
127 | }
128 | }
129 | if ($indisk) {
130 | $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
131 | ksort($diskconfig);
132 | $tmp[$disktag] = json_encode($diskconfig);
133 | }
134 | if ($operatedisk) {
135 | if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
136 | $tags = [];
137 | foreach ($disktags as $tag) {
138 | if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
139 | else array_push($tags, $tag);
140 | }
141 | $tmp['disktag'] = implode('|', $tags);
142 | $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
143 | $tmp[$arr['disktag_rename']] = null;
144 | } else {
145 | $disktags = array_unique($disktags);
146 | foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
147 | if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
148 | else $tmp['disktag'] = null;
149 | }
150 | }
151 | $response = null;
152 | foreach ($tmp as $key => $val) {
153 | if (!!$val) $response = ReplitAPI('w', $key, $val);
154 | else $response = ReplitAPI('d', $key);
155 | if (api_error($response)) return ['stat'=>$response['stat'], 'body'=>$response['body'] . "
\nError in writting " . $key . "=" . $val];
156 | }
157 | //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
158 | return $response;
159 | }
160 |
161 | function install()
162 | {
163 | global $constStr;
164 | if ($_GET['install2']) {
165 | if ($_POST['admin']!='') {
166 | $tmp['admin'] = $_POST['admin'];
167 | //$tmp['language'] = $_COOKIE['language'];
168 | $tmp['timezone'] = $_COOKIE['timezone'];
169 | $response = setConfigResponse( setConfig($tmp) );
170 | if (api_error($response)) {
171 | $html = api_error_msg($response);
172 | $title = 'Error';
173 | return message($html, $title, 201);
174 | } else {
175 | return output('Jump
176 |
182 | ', 302);
183 | }
184 | }
185 | }
186 | if ($_GET['install1']) {
187 | if (!ConfigWriteable()) {
188 | $html .= getconstStr('MakesuerWriteable');
189 | $title = 'Error';
190 | return message($html, $title, 201);
191 | }
192 | /*if (!RewriteEngineOn()) {
193 | $html .= getconstStr('MakesuerRewriteOn');
194 | $title = 'Error';
195 | return message($html, $title, 201);
196 | }*/
197 | $html .= '
198 |
199 |
203 |
204 | ';
243 | $title = getconstStr('SetAdminPassword');
244 | return message($html, $title, 201);
245 | }
246 | if ($_GET['install0']) {
247 | $html .= '
248 |
257 | ';
267 | $title = getconstStr('SelectLanguage');
268 | return message($html, $title, 201);
269 | }
270 |
271 | $title = 'Install';
272 | $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind');
273 | return message($html, $title, 201);
274 | }
275 |
276 | function ConfigWriteable()
277 | {
278 | $t = md5( md5(time()).rand(1000,9999) );
279 | $r = setConfig([ 'tmp' => $t ]);
280 | $tmp = getConfig('tmp');
281 | setConfig([ 'tmp' => '' ]);
282 | if ($tmp == $t) return true;
283 | if ($r) return true;
284 | return false;
285 | }
286 |
287 | function api_error($response)
288 | {
289 | return !($response['stat']==200||$response['stat']==204||$response['stat']==404);
290 | //return isset($response['message']);
291 | }
292 |
293 | function api_error_msg($response)
294 | {
295 | return ''. json_encode($response, JSON_PRETTY_PRINT).'
' . '
296 | ';
297 | }
298 |
299 | function setConfigResponse($response)
300 | {
301 | return $response;
302 | //return json_decode($response, true);
303 | }
304 |
305 | // Tfo
306 | function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
307 | {
308 | $slash = '/';
309 | if (strpos(__DIR__, ':')) $slash = '\\';
310 | // __DIR__ is xxx/platform
311 | $projectPath = splitlast(__DIR__, $slash)[0];
312 |
313 | // 从github下载对应tar.gz,并解压
314 | $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
315 | $tarfile = $projectPath . $slash .'github.tar.gz';
316 | $githubfile = file_get_contents($url);
317 | if (!$githubfile) return ['stat'=>500, 'body'=>'download error from github.'];
318 | file_put_contents($tarfile, $githubfile);
319 | if (splitfirst(PHP_VERSION, '.')[0] > '5') {
320 | $phar = new PharData($tarfile); // need php5.3, 7, 8
321 | $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
322 | } else {
323 | ob_start();
324 | passthru('tar -xzvf ' . $tarfile, $stat);
325 | ob_get_clean();
326 | }
327 | unlink($tarfile);
328 |
329 | $outPath = '';
330 | $tmp = scandir($projectPath);
331 | $name = $auth . '-' . $project;
332 | foreach ($tmp as $f) {
333 | if ( substr($f, 0, strlen($name)) == $name) {
334 | $outPath = $projectPath . $slash . $f;
335 | break;
336 | }
337 | }
338 | //error_log1($outPath);
339 | if ($outPath=='') return ['stat'=>500, 'body'=>'can\'t find folder after download from github.'];
340 |
341 | return moveFolder($outPath, $projectPath, $slash);
342 | }
343 |
344 | function moveFolder($from, $to, $slash)
345 | {
346 | if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
347 | if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
348 | if (!file_exists($to)) mkdir($to, 0777);
349 | $handler=opendir($from);
350 | while($filename=readdir($handler)) {
351 | if($filename != '.' && $filename != '..'){
352 | $fromfile = $from . $slash . $filename;
353 | $tofile = $to . $slash . $filename;
354 | if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
355 | $response = moveFolder($fromfile, $tofile, $slash);
356 | if (api_error(setConfigResponse($response))) return $response;
357 | }else{
358 | if (file_exists($tofile)) unlink($tofile);
359 | $response = rename($fromfile, $tofile);
360 | if (!$response) {
361 | $tmp['code'] = "Move Failed";
362 | $tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
363 | return ['stat'=>500, 'body'=>json_encode($tmp)];
364 | }
365 | if (file_exists($fromfile)) unlink($fromfile);
366 | }
367 | }
368 | }
369 | closedir($handler);
370 | rmdir($from);
371 | return ['stat'=>200, 'body'=>'success.'];
372 | }
373 |
374 | function WaitFunction() {
375 | return true;
376 | }
377 |
378 | function changeAuthKey() {
379 | return message("Not need.", 'Change platform Auth token or key', 404);
380 | }
381 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # **Tfo**
2 | A website for two-point filestorage online (tfo) (20230917).
3 |
4 | 
5 |
6 | ## Features
7 |
8 | 1. Move the **operation (setting/login/text-editing/download) button to bottom left corner**
9 |
10 | 
11 |
12 | 2. Add random color of the directory div and more-disk div
13 |
14 | 3. Change buttons into outline style
15 |
16 | 4. Resize the Preview div
17 |
18 | ... and more
19 |
20 | > Specifically, you could clone or fork the repo and modify your theme. The theme is based on classic.html for a fresh look, all original features are supported via updates. The theme will realize many functions, you could keep looking forward to next updates. However, the private content related to other platforms, such as comments system, webmaster tools, access statistics, poetry div, which are not included in the theme. If you need, you could add them in the setup page by your own. The PHP historical version of the theme can be found in the Theme folder.
21 |
22 | ## Modified Files
23 |
24 |
124 |
125 | ## To Do
126 |
127 | - [ ] Support markdown file in textbundle folder as a readme
128 | - [ ] Support list iterms as icons
129 |
130 | ... and more.
131 |
132 | ## Deploy and More Information
133 |
134 | See [Original Readme](./readme_original.md) | [原始简体中文 Readme](./readme_original_cn.md)
135 |
136 | If you want to deploy Tfo's repo, you can change the default fields to this repo address directly.
--------------------------------------------------------------------------------
/readme/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BingoKingo/Tfo/15286a463d022b5e46fe0fedfc3a39e1bbac264f/readme/button.png
--------------------------------------------------------------------------------
/readme/tfo.logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BingoKingo/Tfo/15286a463d022b5e46fe0fedfc3a39e1bbac264f/readme/tfo.logo.png
--------------------------------------------------------------------------------
/readme/tfo.logo.transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BingoKingo/Tfo/15286a463d022b5e46fe0fedfc3a39e1bbac264f/readme/tfo.logo.transparent.png
--------------------------------------------------------------------------------
/readme_cn.md:
--------------------------------------------------------------------------------
1 | [Readme EN](readme.md)
2 |
3 | # 注意:
4 |
5 | 请关掉浏览器的翻译。
6 |
7 | Releases只是当存档在用的,并不是最新代码。
8 |
9 | 请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
10 |
11 | ---
12 |
13 | # 部署到 Vercel
14 |
15 | ### 官网
16 |
17 | https://vercel.com/
18 |
19 | ### Demo
20 |
21 | https://onemanager-php.vercel.app/
22 |
23 | ### 注意
24 |
25 | > 1. 每次更改配置后都要等 30-50s 来确保部署成功;
26 | >
27 | > 2. Vercel 每天限制 100 次部署。
28 |
29 | ### 安装(英文)
30 |
31 | https://scfonedrive.github.io/Vercel/Deploy.html
32 |
33 | ---
34 |
35 | # 部署到 Replit
36 |
37 | ### 官网
38 |
39 | https://repl.it/
40 | https://replit.com/
41 |
42 | ### Demo
43 |
44 | https://onemanager.qkqpttgf.repl.co/
45 |
46 | ### 安装
47 | A:
48 | > 1. 点右上的 "+" 或左上的 "+ Create Repl",点击`Import from Github`;
49 | > 2. 在"GitHub URL"中输入`https://github.com/qkqpttgf/OneManager-php`,会自动弹出显示"Language"与"PHP Web Server",点下面的"Import from Github"。
50 | > 3. 结束后,点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
51 |
52 | B:
53 | > 1. 点右上的 "+" 或左上的 "+ Create Repl",template中输入php,点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。
54 | > 2. 结束后,在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。
55 | > 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
56 |
57 | ---
58 |
59 | # ~~部署到 Heroku~~
60 |
61 | ## Dyno套餐不再免费
62 |
63 | ### 官网
64 |
65 | https://heroku.com
66 |
67 | ### Demo
68 |
69 | https://herooneindex.herokuapp.com/
70 |
71 | ### 安装
72 |
73 | > 给这个项目点star,然后fork,在Heroku创建一个app,然后点进Deploy页,在"Deployment method"处点"Connect GitHub",选择你的fork。
74 |
75 | ---
76 |
77 | # 部署到 Glitch
78 |
79 | ### 官网
80 |
81 | https://glitch.com/
82 |
83 | ### Demo
84 |
85 | https://onemanager.glitch.me/
86 |
87 | ### 安装
88 |
89 | 点 [New Project] -> 点 [Import form Github] -> 粘贴 "https://github.com/qkqpttgf/OneManager-php" ,结束后,左上角点 [Show] -> [In a New Window]。
90 |
91 | ---
92 |
93 | # ~~部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)~~
94 |
95 | ## SCF要收套餐费用了
96 |
97 | ### 官网
98 |
99 | https://cloud.tencent.com/product/scf
100 |
101 | ### DEMO
102 |
103 | 暂无
104 |
105 | ### 注意事项
106 |
107 | SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘(可以在安装时选择将配置保存在文件来避开限制)。
108 |
109 | ### 安装
110 |
111 | 1. 进入函数服务,上方选择地区,然后点击新建。
112 |
113 | 2. 输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
114 |
115 | 3. 点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
116 |
117 | 4. 在触发管理中可以看到一个 访问路径,访问它,开始安装。
118 |
119 | (重点:**勾选集成响应**)
120 |
121 | > **添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。**
122 |
123 | ----
124 |
125 |
126 | # 部署到华为云函数工作流 Function Graph (FG)
127 |
128 | ### 官网
129 |
130 | https://console.huaweicloud.com/functiongraph/
131 |
132 | ### DEMO
133 |
134 | 暂无
135 |
136 | ### 注意事项
137 |
138 | FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)(可以在安装时选择将配置保存在文件来避开限制)。
139 |
140 | ### 安装
141 |
142 | 1. 在函数列表,点右边创建函数
143 | 2. 输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
144 | 3. 创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
145 | 4. 访问触发器给的url,开始安装
146 | 5. 在【触发器界面】点【触发器名称】,跳到API网关管理,右边【更多URL】,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的【编辑】,第1页不用改,点【下一步】,**请求Path改成/**,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点【立即完成】,然后去【发布】生效
147 |
148 | ----
149 |
150 | # 部署到阿里云函数计算 Function Compute (FC)
151 |
152 | ### 官网
153 |
154 | https://fc.console.aliyun.com/
155 |
156 | ### DEMO
157 |
158 | 无
159 |
160 | ### 安装
161 |
162 | 1. 新建函数 -- HTTP函数
163 | 2. 运行环境选择php7.2
164 | 3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
165 | 4. 上传代码(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
166 | 5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
167 | 6. 访问你的域名,开始安装
168 |
169 | ---
170 |
171 | # 部署到百度云函数计算 Cloud Function Compute (CFC)
172 |
173 | ### 官网
174 |
175 | https://console.bce.baidu.com/cfc/#/cfc/functions
176 |
177 | ### DEMO
178 |
179 | 暂无
180 |
181 | ### 注意事项
182 |
183 | **自定义域名需要另外使用API网关,并备案。**
184 |
185 | ### 安装
186 |
187 | 1. 在函数列表,点创建函数
188 | 2. 创建方式改为空白函数,点下一步
189 | 3. 输入名称,选择运行时为PHP7.2,点下一步
190 | 4. 触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交
191 | 5. 进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
192 | 6. 点击右边触发器,复制并访问提供的url,开始安装
193 |
194 | ---
195 |
196 | # 部署到VPS (Virtual Private Server) 或 空间
197 |
198 | ### DEMO
199 |
200 | 暂无
201 |
202 | ### 安装
203 |
204 | 1. 启动web服务器,确保你能访问到。
205 |
206 | 2. 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
207 |
208 | 3. 上传好代码。
209 |
210 | 4. 使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
211 |
212 | 5. 在浏览器中访问。
213 |
214 | ----
215 |
216 | # 特性
217 |
218 | 下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
219 |
220 | 上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。
221 |
222 | 设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。
223 |
224 | 网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。
225 |
226 | 可以在文件列表显示head.md跟readme.md文件的内容。
227 |
228 | 游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
229 |
230 | 如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
231 |
232 | 点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
233 |
234 | ----
235 |
236 | # 功能性文件
237 |
238 | ### favicon.ico
239 |
240 | 放在第一个盘的显示目录(不一定是onedrive根目录)。
241 |
242 | ### index.html
243 |
244 | 将index.html以静态网页显示出来。
245 |
246 | ### head.md
247 |
248 | ### readme.md
249 |
250 | 以MD语法显示在顶部或底部。
251 |
252 | ### head.omf
253 |
254 | ### foot.omf
255 |
256 | 以html显示在顶部或底部(可以跑js)。
257 |
258 | ----
259 |
260 | # 捐赠
261 |
262 | https://paypal.me/qkqpttgf
263 |
264 | -----
265 |
266 | # 群聊
267 |
268 | **请看完上面的中英双语再加群,谢谢!**
269 |
270 | ### QQ 群:
271 |
272 | 212088653
273 |
274 | ### Telegram Group
275 |
276 | https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
277 |
--------------------------------------------------------------------------------
/readme_original.md:
--------------------------------------------------------------------------------
1 | [中文readme](readme_cn.md)
2 |
3 | # NOTICE:
4 |
5 | The Releases is used as archive, not newest code.
6 |
7 | Please read the descriptions of settings before raising an issue.
8 |
9 | ---
10 |
11 | # Deploy to Vercel
12 |
13 | ### Official
14 |
15 | https://vercel.com/
16 |
17 | ### Demo
18 |
19 | https://onemanager-php.vercel.app/
20 |
21 | ### Notice
22 |
23 | > 1. you must wait 30-50s to make sure deploy READY after change config;
24 | >
25 | > 2. Vercel limit 100 deploy every day.
26 |
27 | ### How to Install
28 |
29 | > https://scfonedrive.github.io/Vercel/Deploy.html .
30 |
31 | ---
32 |
33 | # Deploy to Replit
34 |
35 | ### Official
36 |
37 | https://repl.it/
38 | https://replit.com/
39 |
40 | ### Demo
41 |
42 | https://onemanager.qkqpttgf.repl.co/
43 |
44 | ### How to Install
45 | A:
46 | > 1. Click the "+" or "Create Repl", click the `Import from Github`;
47 | > 2. Input `https://github.com/qkqpttgf/OneManager-php` in "GitHub URL", then it will auto show "Language" - "PHP Web Server", Click the "Import from Github";
48 | > 3. After done, click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window.
49 |
50 | B:
51 | > 1. Click the "+" or "Create Repl", find template "PHP Web Server" (via input "php"), input a name for your project in "Title" or left it default, Click the "+ Create Repl".
52 | > 2. After done, input `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` to Console or Shell on the right, press "Enter" to run it.
53 | > 3. Click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window.
54 |
55 | ---
56 |
57 | # ~~Deploy to Heroku~~
58 |
59 | ## Dyno will no longer free
60 |
61 | ### Official
62 |
63 | https://heroku.com
64 |
65 | ### Demo
66 |
67 | https://herooneindex.herokuapp.com/
68 |
69 | ### How to Install
70 |
71 | > ~~Click the button [](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
72 | >
73 | > Star this project, then Fork, create an app in Heroku, then turn to the Deploy tab, "Deployment method" via "Connect GitHub", select your github fork.
74 |
75 | ---
76 |
77 | # Deploy to Glitch
78 |
79 | ### Official
80 |
81 | https://glitch.com/
82 |
83 | ### Demo
84 |
85 | https://onemanager.glitch.me/
86 |
87 | ### How to Install
88 |
89 | [New Project] -> [Import form Github] -> paste "https://github.com/qkqpttgf/OneManager-php" , after done, [Show] -> [In a New Window].
90 |
91 | ---
92 |
93 | # ~~Deploy to Tencent Serverless Cloud Function (SCF)~~
94 |
95 | ## SCF no longer free
96 |
97 | ### Official
98 |
99 | https://cloud.tencent.com/product/scf
100 |
101 | ### DEMO
102 |
103 | null
104 |
105 | ### How to Install
106 |
107 | see CN readme.
108 |
109 | ----
110 |
111 |
112 | # Deploy to Huawei cloud Function Graph (FG)
113 |
114 | ### Official
115 |
116 | https://console.huaweicloud.com/functiongraph/
117 |
118 | ### DEMO
119 |
120 | null
121 |
122 | ### How to Install
123 |
124 | see CN readme.
125 |
126 | ----
127 |
128 | # Deploy to Aliyun Function Compute (FC)
129 |
130 | ### Official:
131 |
132 | https://fc.console.aliyun.com/
133 |
134 | ### DEMO
135 |
136 | null
137 |
138 | ### How to Install
139 |
140 | see CN readme.
141 |
142 | ---
143 |
144 | # Deploy to Baidu Cloud Function Compute (CFC)
145 |
146 | ### Official
147 |
148 | https://console.bce.baidu.com/cfc/#/cfc/functions
149 |
150 | ### DEMO
151 |
152 | null
153 |
154 | ### How to Install
155 |
156 | see CN readme.
157 |
158 | ---
159 |
160 | # Deploy to Virtual Private Server (VPS) or php host
161 |
162 | ### DEMO
163 |
164 | null
165 |
166 | ### How to Install
167 |
168 | 1. Start web service on your server (httpd or other), make sure you can visit it.
169 |
170 | 2. Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
171 |
172 | 3. Upload code.
173 |
174 | 4. Change the file .data/config.php can be read&write (666 is suggested).
175 |
176 | 5. View the website in chrome or other.
177 |
178 | ----
179 |
180 | # Features
181 |
182 | When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
183 |
184 | When uploading files, the program produce a direct url, visitor upload files to MS OFFICE via the direct url, the server expend a few bandwidth in produce.
185 |
186 | The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
187 |
188 | LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
189 |
190 | Program will show content of 'readme.md' & 'head.md'.
191 |
192 | guest upload path, is a folder that the guest can upload files, but can not be list (exclude admin).
193 |
194 | If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
195 |
196 | Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
197 |
198 | ----
199 |
200 | # Functional files
201 |
202 | ### favicon.ico
203 |
204 | put it in the showing home folder of FIRST disk (maybe not root of onedrive).
205 |
206 | ### index.html
207 |
208 | show content of index.html as html.
209 |
210 | ### head.md
211 |
212 | ### readme.md
213 |
214 | it will showed at top or bottom as markdown.
215 |
216 | ### head.omf
217 |
218 | ### foot.omf
219 |
220 | it will showed at top or bottom as html (javascript works!).
221 |
222 | ----
223 |
224 | # A cup of coffee
225 |
226 | https://paypal.me/qkqpttgf
227 |
228 | -----
229 |
230 | # Chat
231 |
232 | ### Telegram Group
233 |
234 | https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
235 |
--------------------------------------------------------------------------------
/readme_original_cn.md:
--------------------------------------------------------------------------------
1 | [Readme EN](readme.md)
2 |
3 | # 注意:
4 |
5 | 请关掉浏览器的翻译。
6 |
7 | Releases只是当存档在用的,并不是最新代码。
8 |
9 | 请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
10 |
11 | ---
12 |
13 | # 部署到 Vercel
14 |
15 | ### 官网
16 |
17 | https://vercel.com/
18 |
19 | ### Demo
20 |
21 | https://onemanager-php.vercel.app/
22 |
23 | ### 注意
24 |
25 | > 1. 每次更改配置后都要等 30-50s 来确保部署成功;
26 | >
27 | > 2. Vercel 每天限制 100 次部署。
28 |
29 | ### 安装(英文)
30 |
31 | https://scfonedrive.github.io/Vercel/Deploy.html
32 |
33 | ---
34 |
35 | # 部署到 Replit
36 |
37 | ### 官网
38 |
39 | https://repl.it/
40 | https://replit.com/
41 |
42 | ### Demo
43 |
44 | https://onemanager.qkqpttgf.repl.co/
45 |
46 | ### 安装
47 | A:
48 | > 1. 点右上的 "+" 或左上的 "+ Create Repl",点击`Import from Github`;
49 | > 2. 在"GitHub URL"中输入`https://github.com/qkqpttgf/OneManager-php`,会自动弹出显示"Language"与"PHP Web Server",点下面的"Import from Github"。
50 | > 3. 结束后,点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
51 |
52 | B:
53 | > 1. 点右上的 "+" 或左上的 "+ Create Repl",template中输入php,点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。
54 | > 2. 结束后,在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。
55 | > 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
56 |
57 | ---
58 |
59 | # ~~部署到 Heroku~~
60 |
61 | ## Dyno套餐不再免费
62 |
63 | ### 官网
64 |
65 | https://heroku.com
66 |
67 | ### Demo
68 |
69 | https://herooneindex.herokuapp.com/
70 |
71 | ### 安装
72 |
73 | > 给这个项目点star,然后fork,在Heroku创建一个app,然后点进Deploy页,在"Deployment method"处点"Connect GitHub",选择你的fork。
74 |
75 | ---
76 |
77 | # 部署到 Glitch
78 |
79 | ### 官网
80 |
81 | https://glitch.com/
82 |
83 | ### Demo
84 |
85 | https://onemanager.glitch.me/
86 |
87 | ### 安装
88 |
89 | 点 [New Project] -> 点 [Import form Github] -> 粘贴 "https://github.com/qkqpttgf/OneManager-php" ,结束后,左上角点 [Show] -> [In a New Window]。
90 |
91 | ---
92 |
93 | # ~~部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)~~
94 |
95 | ## SCF要收套餐费用了
96 |
97 | ### 官网
98 |
99 | https://cloud.tencent.com/product/scf
100 |
101 | ### DEMO
102 |
103 | 暂无
104 |
105 | ### 注意事项
106 |
107 | SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘(可以在安装时选择将配置保存在文件来避开限制)。
108 |
109 | ### 安装
110 |
111 | 1. 进入函数服务,上方选择地区,然后点击新建。
112 |
113 | 2. 输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
114 |
115 | 3. 点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
116 |
117 | 4. 在触发管理中可以看到一个 访问路径,访问它,开始安装。
118 |
119 | (重点:**勾选集成响应**)
120 |
121 | > **添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。**
122 |
123 | ----
124 |
125 |
126 | # 部署到华为云函数工作流 Function Graph (FG)
127 |
128 | ### 官网
129 |
130 | https://console.huaweicloud.com/functiongraph/
131 |
132 | ### DEMO
133 |
134 | 暂无
135 |
136 | ### 注意事项
137 |
138 | FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)(可以在安装时选择将配置保存在文件来避开限制)。
139 |
140 | ### 安装
141 |
142 | 1. 在函数列表,点右边创建函数
143 | 2. 输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
144 | 3. 创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
145 | 4. 访问触发器给的url,开始安装
146 | 5. 在【触发器界面】点【触发器名称】,跳到API网关管理,右边【更多URL】,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的【编辑】,第1页不用改,点【下一步】,**请求Path改成/**,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点【立即完成】,然后去【发布】生效
147 |
148 | ----
149 |
150 | # 部署到阿里云函数计算 Function Compute (FC)
151 |
152 | ### 官网
153 |
154 | https://fc.console.aliyun.com/
155 |
156 | ### DEMO
157 |
158 | 无
159 |
160 | ### 安装
161 |
162 | 1. 新建函数 -- HTTP函数
163 | 2. 运行环境选择php7.2
164 | 3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
165 | 4. 上传代码(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
166 | 5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
167 | 6. 访问你的域名,开始安装
168 |
169 | ---
170 |
171 | # 部署到百度云函数计算 Cloud Function Compute (CFC)
172 |
173 | ### 官网
174 |
175 | https://console.bce.baidu.com/cfc/#/cfc/functions
176 |
177 | ### DEMO
178 |
179 | 暂无
180 |
181 | ### 注意事项
182 |
183 | **自定义域名需要另外使用API网关,并备案。**
184 |
185 | ### 安装
186 |
187 | 1. 在函数列表,点创建函数
188 | 2. 创建方式改为空白函数,点下一步
189 | 3. 输入名称,选择运行时为PHP7.2,点下一步
190 | 4. 触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交
191 | 5. 进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
192 | 6. 点击右边触发器,复制并访问提供的url,开始安装
193 |
194 | ---
195 |
196 | # 部署到VPS (Virtual Private Server) 或 空间
197 |
198 | ### DEMO
199 |
200 | 暂无
201 |
202 | ### 安装
203 |
204 | 1. 启动web服务器,确保你能访问到。
205 |
206 | 2. 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
207 |
208 | 3. 上传好代码。
209 |
210 | 4. 使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
211 |
212 | 5. 在浏览器中访问。
213 |
214 | ----
215 |
216 | # 特性
217 |
218 | 下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
219 |
220 | 上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。
221 |
222 | 设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。
223 |
224 | 网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。
225 |
226 | 可以在文件列表显示head.md跟readme.md文件的内容。
227 |
228 | 游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
229 |
230 | 如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
231 |
232 | 点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
233 |
234 | ----
235 |
236 | # 功能性文件
237 |
238 | ### favicon.ico
239 |
240 | 放在第一个盘的显示目录(不一定是onedrive根目录)。
241 |
242 | ### index.html
243 |
244 | 将index.html以静态网页显示出来。
245 |
246 | ### head.md
247 |
248 | ### readme.md
249 |
250 | 以MD语法显示在顶部或底部。
251 |
252 | ### head.omf
253 |
254 | ### foot.omf
255 |
256 | 以html显示在顶部或底部(可以跑js)。
257 |
258 | ----
259 |
260 | # 捐赠
261 |
262 | https://paypal.me/qkqpttgf
263 |
264 | -----
265 |
266 | # 群聊
267 |
268 | **请看完上面的中英双语再加群,谢谢!**
269 |
270 | ### QQ 群:
271 |
272 | 212088653
273 |
274 | ### Telegram Group
275 |
276 | https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
277 |
--------------------------------------------------------------------------------
/theme/403.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 403 Forbidden
7 |
8 |
9 |
--------------------------------------------------------------------------------
/theme/apache.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | //
5 |
6 |
7 | //
8 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/theme/iis.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | - //
4 |
5 |
6 | - //
7 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/theme/nexmoe1.html:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "music":"audiotrack",
4 | "video":"ondemand_video",
5 | "img":"image",
6 | "default":"insert_drive_file"
7 | }
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
55 |
56 |
57 |
58 |
59 |
60 |
80 |
81 |
82 |
83 |
84 |
99 |
100 |
101 |
110 |
111 |
112 |
113 |
114 | -->
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |

130 |
131 |
132 |
133 |
136 |
137 |
138 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
153 |
163 |
164 |
165 |
166 |
167 | file_download
168 |
169 |
170 |
202 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 | format_list_bulleted
283 |
284 |
285 |
286 |
287 |
288 |
376 |
377 |
378 |
--------------------------------------------------------------------------------
/theme/nginx.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | - //
4 |
5 |
6 | - //
7 |
8 |
9 | ../ |
10 |
11 |
12 |
13 |
14 | / | | - |
15 |
16 |
17 | | | |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/update.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ $# -eq 0 ]; then
4 | echo "
5 | "$0" -i|u [-b branch]
6 | i a new install with empty config.
7 | u update use exist config.
8 | b install the branch after parameter b, default master
9 |
10 | example:
11 | "$0" -i
12 | "$0" -u
13 | "$0" -b master
14 | "$0" -u -b master
15 | "$0" -ib test
16 | "
17 | # exit
18 | echo "###############
19 | 0, new install
20 | 1, update"
21 | read -p "Input:" c
22 | [ g"$c" == g"0" ] && install=1
23 | [ g"$c" == g"1" ] && update=1
24 | fi
25 |
26 | i=0
27 | para[$i]=$0
28 | for av in "$@"
29 | do
30 | #echo $av
31 | ((i++))
32 | para[$i]=$av
33 | if [ g"${av:0:1}" == g"-" ]; then
34 | while [ g"$av" != g"" ]
35 | do
36 | ag=${av:0:1}
37 | av=${av:1}
38 | [ g"$ag" == g"b" ] && isbranch=1
39 | [ g"$ag" == g"i" ] && install=1
40 | [ g"$ag" == g"u" ] && update=1
41 | done
42 | else
43 | if [ g"$isbranch" == g"1" ]; then
44 | branch="-b $av"
45 | isbranch=0
46 | fi
47 | fi
48 | done
49 |
50 | if [ g"$install" == g"1" -a g"$update" == g"1" ]; then
51 | echo "Both install & update, exit"
52 | exit
53 | fi
54 | if [ g"$install" != g"1" -a g"$update" != g"1" ]; then
55 | echo "Not install & Not update, exit"
56 | exit
57 | fi
58 |
59 | gitsource='https://github.com/qkqpttgf/OneManager-php'
60 |
61 | OneManagerPath=`cd $(dirname $0);pwd -P`
62 | cd ${OneManagerPath}
63 |
64 | git clone ${branch} ${gitsource}
65 | [ g"$install" == g"1" ] || \mv -b .data/config.php OneManager-php/.data/
66 | \mv -b OneManager-php/* ./
67 | \mv -b OneManager-php/.[^.]* ./
68 | rm -rf *~
69 | #rm -rf .[^.]*~
70 | rm -rf OneManager-php
71 | chmod 666 .data/config.php
72 |
--------------------------------------------------------------------------------
/vendor/autoload.php:
--------------------------------------------------------------------------------
1 |
7 | * Jordi Boggiano
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | namespace Composer\Autoload;
14 |
15 | /**
16 | * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17 | *
18 | * $loader = new \Composer\Autoload\ClassLoader();
19 | *
20 | * // register classes with namespaces
21 | * $loader->add('Symfony\Component', __DIR__.'/component');
22 | * $loader->add('Symfony', __DIR__.'/framework');
23 | *
24 | * // activate the autoloader
25 | * $loader->register();
26 | *
27 | * // to enable searching the include path (eg. for PEAR packages)
28 | * $loader->setUseIncludePath(true);
29 | *
30 | * In this example, if you try to use a class in the Symfony\Component
31 | * namespace or one of its children (Symfony\Component\Console for instance),
32 | * the autoloader will first look for the class under the component/
33 | * directory, and it will then fallback to the framework/ directory if not
34 | * found before giving up.
35 | *
36 | * This class is loosely based on the Symfony UniversalClassLoader.
37 | *
38 | * @author Fabien Potencier
39 | * @author Jordi Boggiano
40 | * @see http://www.php-fig.org/psr/psr-0/
41 | * @see http://www.php-fig.org/psr/psr-4/
42 | */
43 | class ClassLoader
44 | {
45 | // PSR-4
46 | private $prefixLengthsPsr4 = array();
47 | private $prefixDirsPsr4 = array();
48 | private $fallbackDirsPsr4 = array();
49 |
50 | // PSR-0
51 | private $prefixesPsr0 = array();
52 | private $fallbackDirsPsr0 = array();
53 |
54 | private $useIncludePath = false;
55 | private $classMap = array();
56 | private $classMapAuthoritative = false;
57 | private $missingClasses = array();
58 | private $apcuPrefix;
59 |
60 | public function getPrefixes()
61 | {
62 | if (!empty($this->prefixesPsr0)) {
63 | return call_user_func_array('array_merge', $this->prefixesPsr0);
64 | }
65 |
66 | return array();
67 | }
68 |
69 | public function getPrefixesPsr4()
70 | {
71 | return $this->prefixDirsPsr4;
72 | }
73 |
74 | public function getFallbackDirs()
75 | {
76 | return $this->fallbackDirsPsr0;
77 | }
78 |
79 | public function getFallbackDirsPsr4()
80 | {
81 | return $this->fallbackDirsPsr4;
82 | }
83 |
84 | public function getClassMap()
85 | {
86 | return $this->classMap;
87 | }
88 |
89 | /**
90 | * @param array $classMap Class to filename map
91 | */
92 | public function addClassMap(array $classMap)
93 | {
94 | if ($this->classMap) {
95 | $this->classMap = array_merge($this->classMap, $classMap);
96 | } else {
97 | $this->classMap = $classMap;
98 | }
99 | }
100 |
101 | /**
102 | * Registers a set of PSR-0 directories for a given prefix, either
103 | * appending or prepending to the ones previously set for this prefix.
104 | *
105 | * @param string $prefix The prefix
106 | * @param array|string $paths The PSR-0 root directories
107 | * @param bool $prepend Whether to prepend the directories
108 | */
109 | public function add($prefix, $paths, $prepend = false)
110 | {
111 | if (!$prefix) {
112 | if ($prepend) {
113 | $this->fallbackDirsPsr0 = array_merge(
114 | (array) $paths,
115 | $this->fallbackDirsPsr0
116 | );
117 | } else {
118 | $this->fallbackDirsPsr0 = array_merge(
119 | $this->fallbackDirsPsr0,
120 | (array) $paths
121 | );
122 | }
123 |
124 | return;
125 | }
126 |
127 | $first = $prefix[0];
128 | if (!isset($this->prefixesPsr0[$first][$prefix])) {
129 | $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130 |
131 | return;
132 | }
133 | if ($prepend) {
134 | $this->prefixesPsr0[$first][$prefix] = array_merge(
135 | (array) $paths,
136 | $this->prefixesPsr0[$first][$prefix]
137 | );
138 | } else {
139 | $this->prefixesPsr0[$first][$prefix] = array_merge(
140 | $this->prefixesPsr0[$first][$prefix],
141 | (array) $paths
142 | );
143 | }
144 | }
145 |
146 | /**
147 | * Registers a set of PSR-4 directories for a given namespace, either
148 | * appending or prepending to the ones previously set for this namespace.
149 | *
150 | * @param string $prefix The prefix/namespace, with trailing '\\'
151 | * @param array|string $paths The PSR-4 base directories
152 | * @param bool $prepend Whether to prepend the directories
153 | *
154 | * @throws \InvalidArgumentException
155 | */
156 | public function addPsr4($prefix, $paths, $prepend = false)
157 | {
158 | if (!$prefix) {
159 | // Register directories for the root namespace.
160 | if ($prepend) {
161 | $this->fallbackDirsPsr4 = array_merge(
162 | (array) $paths,
163 | $this->fallbackDirsPsr4
164 | );
165 | } else {
166 | $this->fallbackDirsPsr4 = array_merge(
167 | $this->fallbackDirsPsr4,
168 | (array) $paths
169 | );
170 | }
171 | } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172 | // Register directories for a new namespace.
173 | $length = strlen($prefix);
174 | if ('\\' !== $prefix[$length - 1]) {
175 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176 | }
177 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
179 | } elseif ($prepend) {
180 | // Prepend directories for an already registered namespace.
181 | $this->prefixDirsPsr4[$prefix] = array_merge(
182 | (array) $paths,
183 | $this->prefixDirsPsr4[$prefix]
184 | );
185 | } else {
186 | // Append directories for an already registered namespace.
187 | $this->prefixDirsPsr4[$prefix] = array_merge(
188 | $this->prefixDirsPsr4[$prefix],
189 | (array) $paths
190 | );
191 | }
192 | }
193 |
194 | /**
195 | * Registers a set of PSR-0 directories for a given prefix,
196 | * replacing any others previously set for this prefix.
197 | *
198 | * @param string $prefix The prefix
199 | * @param array|string $paths The PSR-0 base directories
200 | */
201 | public function set($prefix, $paths)
202 | {
203 | if (!$prefix) {
204 | $this->fallbackDirsPsr0 = (array) $paths;
205 | } else {
206 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207 | }
208 | }
209 |
210 | /**
211 | * Registers a set of PSR-4 directories for a given namespace,
212 | * replacing any others previously set for this namespace.
213 | *
214 | * @param string $prefix The prefix/namespace, with trailing '\\'
215 | * @param array|string $paths The PSR-4 base directories
216 | *
217 | * @throws \InvalidArgumentException
218 | */
219 | public function setPsr4($prefix, $paths)
220 | {
221 | if (!$prefix) {
222 | $this->fallbackDirsPsr4 = (array) $paths;
223 | } else {
224 | $length = strlen($prefix);
225 | if ('\\' !== $prefix[$length - 1]) {
226 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227 | }
228 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
230 | }
231 | }
232 |
233 | /**
234 | * Turns on searching the include path for class files.
235 | *
236 | * @param bool $useIncludePath
237 | */
238 | public function setUseIncludePath($useIncludePath)
239 | {
240 | $this->useIncludePath = $useIncludePath;
241 | }
242 |
243 | /**
244 | * Can be used to check if the autoloader uses the include path to check
245 | * for classes.
246 | *
247 | * @return bool
248 | */
249 | public function getUseIncludePath()
250 | {
251 | return $this->useIncludePath;
252 | }
253 |
254 | /**
255 | * Turns off searching the prefix and fallback directories for classes
256 | * that have not been registered with the class map.
257 | *
258 | * @param bool $classMapAuthoritative
259 | */
260 | public function setClassMapAuthoritative($classMapAuthoritative)
261 | {
262 | $this->classMapAuthoritative = $classMapAuthoritative;
263 | }
264 |
265 | /**
266 | * Should class lookup fail if not found in the current class map?
267 | *
268 | * @return bool
269 | */
270 | public function isClassMapAuthoritative()
271 | {
272 | return $this->classMapAuthoritative;
273 | }
274 |
275 | /**
276 | * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277 | *
278 | * @param string|null $apcuPrefix
279 | */
280 | public function setApcuPrefix($apcuPrefix)
281 | {
282 | $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283 | }
284 |
285 | /**
286 | * The APCu prefix in use, or null if APCu caching is not enabled.
287 | *
288 | * @return string|null
289 | */
290 | public function getApcuPrefix()
291 | {
292 | return $this->apcuPrefix;
293 | }
294 |
295 | /**
296 | * Registers this instance as an autoloader.
297 | *
298 | * @param bool $prepend Whether to prepend the autoloader or not
299 | */
300 | public function register($prepend = false)
301 | {
302 | spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303 | }
304 |
305 | /**
306 | * Unregisters this instance as an autoloader.
307 | */
308 | public function unregister()
309 | {
310 | spl_autoload_unregister(array($this, 'loadClass'));
311 | }
312 |
313 | /**
314 | * Loads the given class or interface.
315 | *
316 | * @param string $class The name of the class
317 | * @return bool|null True if loaded, null otherwise
318 | */
319 | public function loadClass($class)
320 | {
321 | if ($file = $this->findFile($class)) {
322 | includeFile($file);
323 |
324 | return true;
325 | }
326 | }
327 |
328 | /**
329 | * Finds the path to the file where the class is defined.
330 | *
331 | * @param string $class The name of the class
332 | *
333 | * @return string|false The path if found, false otherwise
334 | */
335 | public function findFile($class)
336 | {
337 | // class map lookup
338 | if (isset($this->classMap[$class])) {
339 | return $this->classMap[$class];
340 | }
341 | if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342 | return false;
343 | }
344 | if (null !== $this->apcuPrefix) {
345 | $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346 | if ($hit) {
347 | return $file;
348 | }
349 | }
350 |
351 | $file = $this->findFileWithExtension($class, '.php');
352 |
353 | // Search for Hack files if we are running on HHVM
354 | if (false === $file && defined('HHVM_VERSION')) {
355 | $file = $this->findFileWithExtension($class, '.hh');
356 | }
357 |
358 | if (null !== $this->apcuPrefix) {
359 | apcu_add($this->apcuPrefix.$class, $file);
360 | }
361 |
362 | if (false === $file) {
363 | // Remember that this class does not exist.
364 | $this->missingClasses[$class] = true;
365 | }
366 |
367 | return $file;
368 | }
369 |
370 | private function findFileWithExtension($class, $ext)
371 | {
372 | // PSR-4 lookup
373 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374 |
375 | $first = $class[0];
376 | if (isset($this->prefixLengthsPsr4[$first])) {
377 | $subPath = $class;
378 | while (false !== $lastPos = strrpos($subPath, '\\')) {
379 | $subPath = substr($subPath, 0, $lastPos);
380 | $search = $subPath . '\\';
381 | if (isset($this->prefixDirsPsr4[$search])) {
382 | $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383 | foreach ($this->prefixDirsPsr4[$search] as $dir) {
384 | if (file_exists($file = $dir . $pathEnd)) {
385 | return $file;
386 | }
387 | }
388 | }
389 | }
390 | }
391 |
392 | // PSR-4 fallback dirs
393 | foreach ($this->fallbackDirsPsr4 as $dir) {
394 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395 | return $file;
396 | }
397 | }
398 |
399 | // PSR-0 lookup
400 | if (false !== $pos = strrpos($class, '\\')) {
401 | // namespaced class name
402 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404 | } else {
405 | // PEAR-like class name
406 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407 | }
408 |
409 | if (isset($this->prefixesPsr0[$first])) {
410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411 | if (0 === strpos($class, $prefix)) {
412 | foreach ($dirs as $dir) {
413 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414 | return $file;
415 | }
416 | }
417 | }
418 | }
419 | }
420 |
421 | // PSR-0 fallback dirs
422 | foreach ($this->fallbackDirsPsr0 as $dir) {
423 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424 | return $file;
425 | }
426 | }
427 |
428 | // PSR-0 include paths.
429 | if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430 | return $file;
431 | }
432 |
433 | return false;
434 | }
435 | }
436 |
437 | /**
438 | * Scope isolated include.
439 | *
440 | * Prevents access to $this/self from included files.
441 | */
442 | function includeFile($file)
443 | {
444 | include $file;
445 | }
446 |
--------------------------------------------------------------------------------
/vendor/composer/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) Nils Adermann, Jordi Boggiano
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is furnished
9 | to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_classmap.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
10 | 'App\\' => array($baseDir . '/app'),
11 | );
12 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27 | if ($useStaticLoader) {
28 | require_once __DIR__ . '/autoload_static.php';
29 |
30 | call_user_func(\Composer\Autoload\ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::getInitializer($loader));
31 | } else {
32 | $map = require __DIR__ . '/autoload_namespaces.php';
33 | foreach ($map as $namespace => $path) {
34 | $loader->set($namespace, $path);
35 | }
36 |
37 | $map = require __DIR__ . '/autoload_psr4.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->setPsr4($namespace, $path);
40 | }
41 |
42 | $classMap = require __DIR__ . '/autoload_classmap.php';
43 | if ($classMap) {
44 | $loader->addClassMap($classMap);
45 | }
46 | }
47 |
48 | $loader->register(true);
49 |
50 | return $loader;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 |
11 | array (
12 | 'Doctrine\\Common\\Cache\\' => 22,
13 | ),
14 | 'A' =>
15 | array (
16 | 'App\\' => 4,
17 | ),
18 | );
19 |
20 | public static $prefixDirsPsr4 = array (
21 | 'Doctrine\\Common\\Cache\\' =>
22 | array (
23 | 0 => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache',
24 | ),
25 | 'App\\' =>
26 | array (
27 | 0 => __DIR__ . '/../..' . '/app',
28 | ),
29 | );
30 |
31 | public static function getInitializer(ClassLoader $loader)
32 | {
33 | return \Closure::bind(function () use ($loader) {
34 | $loader->prefixLengthsPsr4 = ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::$prefixLengthsPsr4;
35 | $loader->prefixDirsPsr4 = ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::$prefixDirsPsr4;
36 |
37 | }, null, ClassLoader::class);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "doctrine/cache",
4 | "version": "v1.6.2",
5 | "version_normalized": "1.6.2.0",
6 | "source": {
7 | "type": "git",
8 | "url": "https://github.com/doctrine/cache.git",
9 | "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
10 | },
11 | "dist": {
12 | "type": "zip",
13 | "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
14 | "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
15 | "shasum": "",
16 | "mirrors": [
17 | {
18 | "url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
19 | "preferred": true
20 | }
21 | ]
22 | },
23 | "require": {
24 | "php": "~5.5|~7.0"
25 | },
26 | "conflict": {
27 | "doctrine/common": ">2.2,<2.4"
28 | },
29 | "require-dev": {
30 | "phpunit/phpunit": "~4.8|~5.0",
31 | "predis/predis": "~1.0",
32 | "satooshi/php-coveralls": "~0.6"
33 | },
34 | "time": "2017-07-22T12:49:21+00:00",
35 | "type": "library",
36 | "extra": {
37 | "branch-alias": {
38 | "dev-master": "1.6.x-dev"
39 | }
40 | },
41 | "installation-source": "dist",
42 | "autoload": {
43 | "psr-4": {
44 | "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
45 | }
46 | },
47 | "notification-url": "https://packagist.org/downloads/",
48 | "license": [
49 | "MIT"
50 | ],
51 | "authors": [
52 | {
53 | "name": "Roman Borschel",
54 | "email": "roman@code-factory.org"
55 | },
56 | {
57 | "name": "Benjamin Eberlei",
58 | "email": "kontakt@beberlei.de"
59 | },
60 | {
61 | "name": "Guilherme Blanco",
62 | "email": "guilhermeblanco@gmail.com"
63 | },
64 | {
65 | "name": "Jonathan Wage",
66 | "email": "jonwage@gmail.com"
67 | },
68 | {
69 | "name": "Johannes Schmitt",
70 | "email": "schmittjoh@gmail.com"
71 | }
72 | ],
73 | "description": "Caching library offering an object-oriented API for many cache backends",
74 | "homepage": "http://www.doctrine-project.org",
75 | "keywords": [
76 | "cache",
77 | "caching"
78 | ]
79 | }
80 | ]
81 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Interface for cache drivers.
24 | *
25 | * @link www.doctrine-project.org
26 | * @since 2.0
27 | * @author Benjamin Eberlei
28 | * @author Guilherme Blanco
29 | * @author Jonathan Wage
30 | * @author Roman Borschel
31 | * @author Fabio B. Silva
32 | * @author Kévin Dunglas
33 | */
34 | interface Cache
35 | {
36 | const STATS_HITS = 'hits';
37 | const STATS_MISSES = 'misses';
38 | const STATS_UPTIME = 'uptime';
39 | const STATS_MEMORY_USAGE = 'memory_usage';
40 | const STATS_MEMORY_AVAILABLE = 'memory_available';
41 | /**
42 | * Only for backward compatibility (may be removed in next major release)
43 | *
44 | * @deprecated
45 | */
46 | const STATS_MEMORY_AVAILIABLE = 'memory_available';
47 |
48 | /**
49 | * Fetches an entry from the cache.
50 | *
51 | * @param string $id The id of the cache entry to fetch.
52 | *
53 | * @return mixed The cached data or FALSE, if no cache entry exists for the given id.
54 | */
55 | public function fetch($id);
56 |
57 | /**
58 | * Tests if an entry exists in the cache.
59 | *
60 | * @param string $id The cache id of the entry to check for.
61 | *
62 | * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise.
63 | */
64 | public function contains($id);
65 |
66 | /**
67 | * Puts data into the cache.
68 | *
69 | * If a cache entry with the given id already exists, its data will be replaced.
70 | *
71 | * @param string $id The cache id.
72 | * @param mixed $data The cache entry/data.
73 | * @param int $lifeTime The lifetime in number of seconds for this cache entry.
74 | * If zero (the default), the entry never expires (although it may be deleted from the cache
75 | * to make place for other entries).
76 | *
77 | * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
78 | */
79 | public function save($id, $data, $lifeTime = 0);
80 |
81 | /**
82 | * Deletes a cache entry.
83 | *
84 | * @param string $id The cache id.
85 | *
86 | * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise.
87 | * Deleting a non-existing entry is considered successful.
88 | */
89 | public function delete($id);
90 |
91 | /**
92 | * Retrieves cached information from the data store.
93 | *
94 | * The server's statistics array has the following values:
95 | *
96 | * - hits
97 | * Number of keys that have been requested and found present.
98 | *
99 | * - misses
100 | * Number of items that have been requested and not found.
101 | *
102 | * - uptime
103 | * Time that the server is running.
104 | *
105 | * - memory_usage
106 | * Memory used by this server to store items.
107 | *
108 | * - memory_available
109 | * Memory allowed to use for storage.
110 | *
111 | * @since 2.2
112 | *
113 | * @return array|null An associative array with server's statistics if available, NULL otherwise.
114 | */
115 | public function getStats();
116 | }
117 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Base class for cache provider implementations.
24 | *
25 | * @since 2.2
26 | * @author Benjamin Eberlei
27 | * @author Guilherme Blanco
28 | * @author Jonathan Wage
29 | * @author Roman Borschel
30 | * @author Fabio B. Silva
31 | */
32 | abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiGetCache, MultiPutCache
33 | {
34 | const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]';
35 |
36 | /**
37 | * The namespace to prefix all cache ids with.
38 | *
39 | * @var string
40 | */
41 | private $namespace = '';
42 |
43 | /**
44 | * The namespace version.
45 | *
46 | * @var integer|null
47 | */
48 | private $namespaceVersion;
49 |
50 | /**
51 | * Sets the namespace to prefix all cache ids with.
52 | *
53 | * @param string $namespace
54 | *
55 | * @return void
56 | */
57 | public function setNamespace($namespace)
58 | {
59 | $this->namespace = (string) $namespace;
60 | $this->namespaceVersion = null;
61 | }
62 |
63 | /**
64 | * Retrieves the namespace that prefixes all cache ids.
65 | *
66 | * @return string
67 | */
68 | public function getNamespace()
69 | {
70 | return $this->namespace;
71 | }
72 |
73 | /**
74 | * {@inheritdoc}
75 | */
76 | public function fetch($id)
77 | {
78 | return $this->doFetch($this->getNamespacedId($id));
79 | }
80 |
81 | /**
82 | * {@inheritdoc}
83 | */
84 | public function fetchMultiple(array $keys)
85 | {
86 | if (empty($keys)) {
87 | return array();
88 | }
89 |
90 | // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys
91 | $namespacedKeys = array_combine($keys, array_map(array($this, 'getNamespacedId'), $keys));
92 | $items = $this->doFetchMultiple($namespacedKeys);
93 | $foundItems = array();
94 |
95 | // no internal array function supports this sort of mapping: needs to be iterative
96 | // this filters and combines keys in one pass
97 | foreach ($namespacedKeys as $requestedKey => $namespacedKey) {
98 | if (isset($items[$namespacedKey]) || array_key_exists($namespacedKey, $items)) {
99 | $foundItems[$requestedKey] = $items[$namespacedKey];
100 | }
101 | }
102 |
103 | return $foundItems;
104 | }
105 |
106 | /**
107 | * {@inheritdoc}
108 | */
109 | public function saveMultiple(array $keysAndValues, $lifetime = 0)
110 | {
111 | $namespacedKeysAndValues = array();
112 | foreach ($keysAndValues as $key => $value) {
113 | $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value;
114 | }
115 |
116 | return $this->doSaveMultiple($namespacedKeysAndValues, $lifetime);
117 | }
118 |
119 | /**
120 | * {@inheritdoc}
121 | */
122 | public function contains($id)
123 | {
124 | return $this->doContains($this->getNamespacedId($id));
125 | }
126 |
127 | /**
128 | * {@inheritdoc}
129 | */
130 | public function save($id, $data, $lifeTime = 0)
131 | {
132 | return $this->doSave($this->getNamespacedId($id), $data, $lifeTime);
133 | }
134 |
135 | /**
136 | * {@inheritdoc}
137 | */
138 | public function delete($id)
139 | {
140 | return $this->doDelete($this->getNamespacedId($id));
141 | }
142 |
143 | /**
144 | * {@inheritdoc}
145 | */
146 | public function getStats()
147 | {
148 | return $this->doGetStats();
149 | }
150 |
151 | /**
152 | * {@inheritDoc}
153 | */
154 | public function flushAll()
155 | {
156 | return $this->doFlush();
157 | }
158 |
159 | /**
160 | * {@inheritDoc}
161 | */
162 | public function deleteAll()
163 | {
164 | $namespaceCacheKey = $this->getNamespaceCacheKey();
165 | $namespaceVersion = $this->getNamespaceVersion() + 1;
166 |
167 | if ($this->doSave($namespaceCacheKey, $namespaceVersion)) {
168 | $this->namespaceVersion = $namespaceVersion;
169 |
170 | return true;
171 | }
172 |
173 | return false;
174 | }
175 |
176 | /**
177 | * Prefixes the passed id with the configured namespace value.
178 | *
179 | * @param string $id The id to namespace.
180 | *
181 | * @return string The namespaced id.
182 | */
183 | private function getNamespacedId($id)
184 | {
185 | $namespaceVersion = $this->getNamespaceVersion();
186 |
187 | return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion);
188 | }
189 |
190 | /**
191 | * Returns the namespace cache key.
192 | *
193 | * @return string
194 | */
195 | private function getNamespaceCacheKey()
196 | {
197 | return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace);
198 | }
199 |
200 | /**
201 | * Returns the namespace version.
202 | *
203 | * @return integer
204 | */
205 | private function getNamespaceVersion()
206 | {
207 | if (null !== $this->namespaceVersion) {
208 | return $this->namespaceVersion;
209 | }
210 |
211 | $namespaceCacheKey = $this->getNamespaceCacheKey();
212 | $this->namespaceVersion = $this->doFetch($namespaceCacheKey) ?: 1;
213 |
214 | return $this->namespaceVersion;
215 | }
216 |
217 | /**
218 | * Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
219 | *
220 | * @param array $keys Array of keys to retrieve from cache
221 | * @return array Array of values retrieved for the given keys.
222 | */
223 | protected function doFetchMultiple(array $keys)
224 | {
225 | $returnValues = array();
226 |
227 | foreach ($keys as $key) {
228 | if (false !== ($item = $this->doFetch($key)) || $this->doContains($key)) {
229 | $returnValues[$key] = $item;
230 | }
231 | }
232 |
233 | return $returnValues;
234 | }
235 |
236 | /**
237 | * Fetches an entry from the cache.
238 | *
239 | * @param string $id The id of the cache entry to fetch.
240 | *
241 | * @return mixed|false The cached data or FALSE, if no cache entry exists for the given id.
242 | */
243 | abstract protected function doFetch($id);
244 |
245 | /**
246 | * Tests if an entry exists in the cache.
247 | *
248 | * @param string $id The cache id of the entry to check for.
249 | *
250 | * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise.
251 | */
252 | abstract protected function doContains($id);
253 |
254 | /**
255 | * Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.
256 | *
257 | * @param array $keysAndValues Array of keys and values to save in cache
258 | * @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these
259 | * cache entries (0 => infinite lifeTime).
260 | *
261 | * @return bool TRUE if the operation was successful, FALSE if it wasn't.
262 | */
263 | protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
264 | {
265 | $success = true;
266 |
267 | foreach ($keysAndValues as $key => $value) {
268 | if (!$this->doSave($key, $value, $lifetime)) {
269 | $success = false;
270 | }
271 | }
272 |
273 | return $success;
274 | }
275 |
276 | /**
277 | * Puts data into the cache.
278 | *
279 | * @param string $id The cache id.
280 | * @param string $data The cache entry/data.
281 | * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this
282 | * cache entry (0 => infinite lifeTime).
283 | *
284 | * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
285 | */
286 | abstract protected function doSave($id, $data, $lifeTime = 0);
287 |
288 | /**
289 | * Deletes a cache entry.
290 | *
291 | * @param string $id The cache id.
292 | *
293 | * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise.
294 | */
295 | abstract protected function doDelete($id);
296 |
297 | /**
298 | * Flushes all cache entries.
299 | *
300 | * @return bool TRUE if the cache entries were successfully flushed, FALSE otherwise.
301 | */
302 | abstract protected function doFlush();
303 |
304 | /**
305 | * Retrieves cached information from the data store.
306 | *
307 | * @since 2.2
308 | *
309 | * @return array|null An associative array with server's statistics if available, NULL otherwise.
310 | */
311 | abstract protected function doGetStats();
312 | }
313 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Interface for cache that can be flushed.
24 | *
25 | * Intended to be used for partial clearing of a cache namespace. For a more
26 | * global "flushing", see {@see FlushableCache}.
27 | *
28 | * @link www.doctrine-project.org
29 | * @since 1.4
30 | * @author Adirelle
31 | */
32 | interface ClearableCache
33 | {
34 | /**
35 | * Deletes all cache entries in the current cache namespace.
36 | *
37 | * @return bool TRUE if the cache entries were successfully deleted, FALSE otherwise.
38 | */
39 | public function deleteAll();
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Base file cache driver.
24 | *
25 | * @since 2.3
26 | * @author Fabio B. Silva
27 | * @author Tobias Schultze
28 | */
29 | abstract class FileCache extends CacheProvider
30 | {
31 | /**
32 | * The cache directory.
33 | *
34 | * @var string
35 | */
36 | protected $directory;
37 |
38 | /**
39 | * The cache file extension.
40 | *
41 | * @var string
42 | */
43 | private $extension;
44 |
45 | /**
46 | * @var int
47 | */
48 | private $umask;
49 |
50 | /**
51 | * @var int
52 | */
53 | private $directoryStringLength;
54 |
55 | /**
56 | * @var int
57 | */
58 | private $extensionStringLength;
59 |
60 | /**
61 | * @var bool
62 | */
63 | private $isRunningOnWindows;
64 |
65 | /**
66 | * Constructor.
67 | *
68 | * @param string $directory The cache directory.
69 | * @param string $extension The cache file extension.
70 | *
71 | * @throws \InvalidArgumentException
72 | */
73 | public function __construct($directory, $extension = '', $umask = 0002)
74 | {
75 | // YES, this needs to be *before* createPathIfNeeded()
76 | if ( ! is_int($umask)) {
77 | throw new \InvalidArgumentException(sprintf(
78 | 'The umask parameter is required to be integer, was: %s',
79 | gettype($umask)
80 | ));
81 | }
82 | $this->umask = $umask;
83 |
84 | if ( ! $this->createPathIfNeeded($directory)) {
85 | throw new \InvalidArgumentException(sprintf(
86 | 'The directory "%s" does not exist and could not be created.',
87 | $directory
88 | ));
89 | }
90 |
91 | if ( ! is_writable($directory)) {
92 | throw new \InvalidArgumentException(sprintf(
93 | 'The directory "%s" is not writable.',
94 | $directory
95 | ));
96 | }
97 |
98 | // YES, this needs to be *after* createPathIfNeeded()
99 | $this->directory = realpath($directory);
100 | $this->extension = (string) $extension;
101 |
102 | $this->directoryStringLength = strlen($this->directory);
103 | $this->extensionStringLength = strlen($this->extension);
104 | $this->isRunningOnWindows = defined('PHP_WINDOWS_VERSION_BUILD');
105 | }
106 |
107 | /**
108 | * Gets the cache directory.
109 | *
110 | * @return string
111 | */
112 | public function getDirectory()
113 | {
114 | return $this->directory;
115 | }
116 |
117 | /**
118 | * Gets the cache file extension.
119 | *
120 | * @return string
121 | */
122 | public function getExtension()
123 | {
124 | return $this->extension;
125 | }
126 |
127 | /**
128 | * @param string $id
129 | *
130 | * @return string
131 | */
132 | protected function getFilename($id)
133 | {
134 | $hash = hash('sha256', $id);
135 |
136 | // This ensures that the filename is unique and that there are no invalid chars in it.
137 | if (
138 | '' === $id
139 | || ((strlen($id) * 2 + $this->extensionStringLength) > 255)
140 | || ($this->isRunningOnWindows && ($this->directoryStringLength + 4 + strlen($id) * 2 + $this->extensionStringLength) > 258)
141 | ) {
142 | // Most filesystems have a limit of 255 chars for each path component. On Windows the the whole path is limited
143 | // to 260 chars (including terminating null char). Using long UNC ("\\?\" prefix) does not work with the PHP API.
144 | // And there is a bug in PHP (https://bugs.php.net/bug.php?id=70943) with path lengths of 259.
145 | // So if the id in hex representation would surpass the limit, we use the hash instead. The prefix prevents
146 | // collisions between the hash and bin2hex.
147 | $filename = '_' . $hash;
148 | } else {
149 | $filename = bin2hex($id);
150 | }
151 |
152 | return $this->directory
153 | . DIRECTORY_SEPARATOR
154 | . substr($hash, 0, 2)
155 | . DIRECTORY_SEPARATOR
156 | . $filename
157 | . $this->extension;
158 | }
159 |
160 | /**
161 | * {@inheritdoc}
162 | */
163 | protected function doDelete($id)
164 | {
165 | $filename = $this->getFilename($id);
166 |
167 | return @unlink($filename) || ! file_exists($filename);
168 | }
169 |
170 | /**
171 | * {@inheritdoc}
172 | */
173 | protected function doFlush()
174 | {
175 | foreach ($this->getIterator() as $name => $file) {
176 | if ($file->isDir()) {
177 | // Remove the intermediate directories which have been created to balance the tree. It only takes effect
178 | // if the directory is empty. If several caches share the same directory but with different file extensions,
179 | // the other ones are not removed.
180 | @rmdir($name);
181 | } elseif ($this->isFilenameEndingWithExtension($name)) {
182 | // If an extension is set, only remove files which end with the given extension.
183 | // If no extension is set, we have no other choice than removing everything.
184 | @unlink($name);
185 | }
186 | }
187 |
188 | return true;
189 | }
190 |
191 | /**
192 | * {@inheritdoc}
193 | */
194 | protected function doGetStats()
195 | {
196 | $usage = 0;
197 | foreach ($this->getIterator() as $name => $file) {
198 | if (! $file->isDir() && $this->isFilenameEndingWithExtension($name)) {
199 | $usage += $file->getSize();
200 | }
201 | }
202 |
203 | $free = disk_free_space($this->directory);
204 |
205 | return array(
206 | Cache::STATS_HITS => null,
207 | Cache::STATS_MISSES => null,
208 | Cache::STATS_UPTIME => null,
209 | Cache::STATS_MEMORY_USAGE => $usage,
210 | Cache::STATS_MEMORY_AVAILABLE => $free,
211 | );
212 | }
213 |
214 | /**
215 | * Create path if needed.
216 | *
217 | * @param string $path
218 | * @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
219 | */
220 | private function createPathIfNeeded($path)
221 | {
222 | if ( ! is_dir($path)) {
223 | if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) {
224 | return false;
225 | }
226 | }
227 |
228 | return true;
229 | }
230 |
231 | /**
232 | * Writes a string content to file in an atomic way.
233 | *
234 | * @param string $filename Path to the file where to write the data.
235 | * @param string $content The content to write
236 | *
237 | * @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
238 | */
239 | protected function writeFile($filename, $content)
240 | {
241 | $filepath = pathinfo($filename, PATHINFO_DIRNAME);
242 |
243 | if ( ! $this->createPathIfNeeded($filepath)) {
244 | return false;
245 | }
246 |
247 | if ( ! is_writable($filepath)) {
248 | return false;
249 | }
250 |
251 | $tmpFile = tempnam($filepath, 'swap');
252 | @chmod($tmpFile, 0666 & (~$this->umask));
253 |
254 | if (file_put_contents($tmpFile, $content) !== false) {
255 | if (@rename($tmpFile, $filename)) {
256 | return true;
257 | }
258 |
259 | @unlink($tmpFile);
260 | }
261 |
262 | return false;
263 | }
264 |
265 | /**
266 | * @return \Iterator
267 | */
268 | private function getIterator()
269 | {
270 | return new \RecursiveIteratorIterator(
271 | new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS),
272 | \RecursiveIteratorIterator::CHILD_FIRST
273 | );
274 | }
275 |
276 | /**
277 | * @param string $name The filename
278 | *
279 | * @return bool
280 | */
281 | private function isFilenameEndingWithExtension($name)
282 | {
283 | return '' === $this->extension
284 | || strrpos($name, $this->extension) === (strlen($name) - $this->extensionStringLength);
285 | }
286 | }
287 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Filesystem cache driver.
24 | *
25 | * @since 2.3
26 | * @author Fabio B. Silva
27 | */
28 | class FilesystemCache extends FileCache
29 | {
30 | const EXTENSION = '.doctrinecache.data';
31 |
32 | /**
33 | * {@inheritdoc}
34 | */
35 | public function __construct($directory, $extension = self::EXTENSION, $umask = 0002)
36 | {
37 | parent::__construct($directory, $extension, $umask);
38 | }
39 |
40 | /**
41 | * {@inheritdoc}
42 | */
43 | protected function doFetch($id)
44 | {
45 | $data = '';
46 | $lifetime = -1;
47 | $filename = $this->getFilename($id);
48 |
49 | if ( ! is_file($filename)) {
50 | return false;
51 | }
52 |
53 | $resource = fopen($filename, "r");
54 |
55 | if (false !== ($line = fgets($resource))) {
56 | $lifetime = (int) $line;
57 | }
58 |
59 | if ($lifetime !== 0 && $lifetime < time()) {
60 | fclose($resource);
61 |
62 | return false;
63 | }
64 |
65 | while (false !== ($line = fgets($resource))) {
66 | $data .= $line;
67 | }
68 |
69 | fclose($resource);
70 |
71 | return unserialize($data);
72 | }
73 |
74 | /**
75 | * {@inheritdoc}
76 | */
77 | protected function doContains($id)
78 | {
79 | $lifetime = -1;
80 | $filename = $this->getFilename($id);
81 |
82 | if ( ! is_file($filename)) {
83 | return false;
84 | }
85 |
86 | $resource = fopen($filename, "r");
87 |
88 | if (false !== ($line = fgets($resource))) {
89 | $lifetime = (int) $line;
90 | }
91 |
92 | fclose($resource);
93 |
94 | return $lifetime === 0 || $lifetime > time();
95 | }
96 |
97 | /**
98 | * {@inheritdoc}
99 | */
100 | protected function doSave($id, $data, $lifeTime = 0)
101 | {
102 | if ($lifeTime > 0) {
103 | $lifeTime = time() + $lifeTime;
104 | }
105 |
106 | $data = serialize($data);
107 | $filename = $this->getFilename($id);
108 |
109 | return $this->writeFile($filename, $lifeTime . PHP_EOL . $data);
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Interface for cache that can be flushed.
24 | *
25 | * @link www.doctrine-project.org
26 | * @since 1.4
27 | * @author Adirelle
28 | */
29 | interface FlushableCache
30 | {
31 | /**
32 | * Flushes all cache entries, globally.
33 | *
34 | * @return bool TRUE if the cache entries were successfully flushed, FALSE otherwise.
35 | */
36 | public function flushAll();
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Interface for cache drivers that allows to get many items at once.
24 | *
25 | * @link www.doctrine-project.org
26 | * @since 1.4
27 | * @author Asmir Mustafic
28 | */
29 | interface MultiGetCache
30 | {
31 | /**
32 | * Returns an associative array of values for keys is found in cache.
33 | *
34 | * @param string[] $keys Array of keys to retrieve from cache
35 | * @return mixed[] Array of retrieved values, indexed by the specified keys.
36 | * Values that couldn't be retrieved are not contained in this array.
37 | */
38 | function fetchMultiple(array $keys);
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | namespace Doctrine\Common\Cache;
21 |
22 | /**
23 | * Interface for cache drivers that allows to put many items at once.
24 | *
25 | * @link www.doctrine-project.org
26 | * @since 1.6
27 | * @author Daniel Gorgan
28 | */
29 | interface MultiPutCache
30 | {
31 | /**
32 | * Returns a boolean value indicating if the operation succeeded.
33 | *
34 | * @param array $keysAndValues Array of keys and values to save in cache
35 | * @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these
36 | * cache entries (0 => infinite lifeTime).
37 | *
38 | * @return bool TRUE if the operation was successful, FALSE if it wasn't.
39 | */
40 | function saveMultiple(array $keysAndValues, $lifetime = 0);
41 | }
42 |
--------------------------------------------------------------------------------
/version:
--------------------------------------------------------------------------------
1 | 20220127-1234.43
2 | change login page, default not '?admin' but '?login=admin' now! and if set adminloginpage, it will be '?login=[value]'. rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config. Allow Preview when enable downloadencrypt. some change in adding Onedrive disk. show upload progress in table background. fix some bugs.
3 | 更改登录地址,默认不再是'?admin'而是'?login=admin',如果设置了adminloginpage,那登录地址会是'?login=值'。移除 JumpFirstDisk,在root操作时返回403,更改盘排序,重做盘符排列,添加全局md配置。在开启downloadencrypt后可以网页预览了。添加onedrive盘时稍做修改。上传时以背景做进度条。修复其它bug。
4 |
5 | 20211220-1100.42
6 | Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs.
7 | 新增Replit平台。新增国内git源,以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。
8 | 20211201-1602.41
9 | add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually).
10 | 新增隐藏功能,在平台操作代码的token或API key失效时,可以在 '?setup=auth' 修改它,不用去环境变量修改了(特别地,Vercel保存在代码中时都改不到)。
11 | 20211129
12 | check if there is another deployment building when start deploy.
13 | Vercel部署时检测是否有另一个部署。
14 | 20211104
15 | check if exist php-curl or not in php host and VPS.
16 | 在VPS中检测是否有php-curl。
17 | 20211021
18 | specialchars, fix: list folder, encrypt folder, preview files, rename, show in title, error on back link after login at specialchars folder, etc.
19 | 针对特殊字符,解决目录的列表,目录的加密,文件的预览,目录与文件重命名,在网页标题的显示,在特殊字符处登录后跳转出错等问题。
20 | 20211006
21 | oprate files by fileID, write a localStorage when login to anti CSRF.
22 | 管理时对文件id操作,管理登录时写入一个localStorage预防CSRF。
23 | 20210908
24 | add fileConduitSize&fileConduitCacheTime, little files can stream from program, better to show html/js as local file.
25 | 增加fileConduitSize,fileConduitCacheTime,小文件可以从服务器中转,以对html/js本地化更好的支持。
26 | 20210903
27 | add a latent function, you can run some command by '?setup=cmd', be care, please dont try "top", and set times by "ping -c 4".
28 | 新增隐藏功能,你可以通过'?setup=cmd'来跑一些命令,注意不要试图跑top,另外ping请-c设置次数。
29 | 20210820-1810.40
30 | because Vercel must redeploy after change Environment Variables, and it must <4k, so decide that, save config in code file. in Vercel, after update, please install again. if you want continue use Environment, please add a ( name: "ONEMANAGER_CONFIG_SAVE", value: "env" ) in Environment Variables in Project Settings before update.
31 | 因为Vercel修改环境变量也必须重新部署才生效,而且环境变量只能小于4k,所以决定将配置保存在代码文件中。升级更新后,用Vercel的请重新安装。如果还想继续使用环境变量,请在更新前,在Project Settings的Environment Variables中,新增一个( name: "ONEMANAGER_CONFIG_SAVE", value: "env" )的环境变量。
32 | 20210817-2030.39
33 | fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
34 | 修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
35 | 20210804-1535.38
36 | try fix "&"/"&" in filename. try show an img too height. change upload chunk size when upload speed>10M/s. fix forceHttps when custom domain in Glitch. fix ionicons svg lost.try use file id when rename. background (or other) based on width/height not only width. fix some bugs. Pre-Add platform Vercel, just wait bugs fixed.
37 | 尝试修复文件名含 "&"/"&"。尝试在一屏内显示过长的图片。上传时分割的块大小随着上传速度改变。修复Glitch中使用自定义域名时forceHttps问题。修复ionicons图标失踪。尝试在重命名时使用file id来操作。背景(或其它)基于长宽来看是竖屏还是横屏,不再只看宽度。修复其它bug。预加入Vercel平台,等修复bugs。
38 | 20210512-1648.37
39 | add setting "forceHttps", can force 302 jump to https. fix preview office files. fix manage in safari.fix disktag can be "home". fix some bugs.
40 | 新增一个设置,可以强制跳转https。修复office文档预览。修复safari上点不了管理。盘的标签可以是home了,随便命名了。修复一些其它问题。
41 | 20210331-1530.36
42 | admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs.
43 | 暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。
44 | 20210313-1352.35
45 | use driveId, after update, Aliyundrive and Googledrive please click the Change link after Driver type. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file.
46 | 换用driveId,更新后Aliyundrive与Googledrive请点一下那个切换链接。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。
47 | 20210311-2004.34
48 | try fix: can not login, sha1.js not loaded(changed a cdn), show error log.
49 | 尝试修复登录不了的情况:可能sha1.js没有载入(换了源),在登录页显示出错信息。
50 | 20210309-1718.33
51 | Googledrive can operate now, but the uploading can not done on explorer without token. Onedrive try deal with activeLimit. Can change admin password now. Admin password will sha1 when submitting. Fix some bugs.
52 | Googledrive可以管理操作了,但因为没法在浏览器端不带token上传,所以上传操作作罢。Onedrive尝试处理activeLimit。可以修改admin密码了。登录等提交admin密码时,会sha1加密再提交。修复一些bug。
53 | 20210301-1745.32
54 | Onedrive client secret extend. export&import config. adding Googledrive. add reffer: only listing domains can refer. add diskDescription: tips of disk. Heroku change function_name to HerokuappId. try fix domainforproxy. fix create in Aliyundrive. fix other bugs.
55 | Onedrive 的client延期。可以导入导出配置了。初步添加Googledrive。添加reffer:只有指定域名能引用。添加diskDescription:可以对盘备注了。Heroku中将function_name改为使用HerokuappId。尝试修复domainforproxy在个人帐号时的问题。修复阿里云盘不能新建与加密。修复其它bug。
56 | 20210118-1600.31
57 | can change Ondrive to Sharepoint, can copy a disk. fix a bug that 500 error in setup.
58 | Onedrive跟Sharepoint可以切换了,可以复制一个盘。修复bug。
59 | 20210115-1111.30
60 | v3, after update, please AddDisk again, please set passfile again. themes of php deleted, or you can use branch v2_last.
61 | v3,一键升级后请重新添加盘,passfile失效,重新设置。php主题删掉了,要么就用v2_last分支。
62 | 20201229.29
63 | Modify tags, change sequence of disk.
64 | 可以修改标签,移动标签顺序。
65 | 20201215-1400.28
66 | fix: hackers can upload files to ANY folder (or create a new folder) in your Onedrive. add language zh-tw. now, on heroku, xhr can post. fix: 2 or more space in file name cause bugs.
67 | 修复:构造代码后可以上传文件到你Onedrive的任意目录(甚至创建新目录)。新增zh-tw语言。xhr的post在heroku会接收了,改回post。修复:文件名有多个空格相连时造成bug。
68 | 20201106-1730.27
69 | Add theme. A code used in CloudFlare Workers. Admin not need password in folder. Add caddy2 rewrite rule. Add new platform Glitch. web hosting and VPS user should backup your config.php, after update, copy it to .data foloder.
70 | 添加主题。添加一段用于CF workers的代码。加密目录管理员不需要密码了。添加caddy2伪静态。新增Glitch平台。虚拟主机与VPS用户请备份config.php,升级后,手动将它覆盖到.data目录。
71 | 20200828-1420.26
72 | nginx rewrite rule exclude .well-known folder, as auto SSL. add web.config to rewrite in IIS. now in windwos can do with \ in path. in aliyun FC & huawei FG API, use my code. CN 21Vianet client_id&secret expire. update description now only show new.
73 | nginx的伪静态中排除.well-known目录,方便自动SSL。添加IIS的伪静态。与linux不同,处理windows下目录用\分隔。FC、FG中使用自己代码对接平台。世纪互联旧API即将过期失效,升级后世纪互联的盘需要删除重新添加。更新说明只显示部分。
74 | 20200817-1740.25
75 | when multy disks, now will default show disks as folders in root, if set autoJumpFirstDisk 1, it will auto jump to first disk.
76 | 多盘时,在网站根目录,默认会将各盘当成文件夹显示,可以去设置中设置autoJumpFirstDisk为1,这样可以跟以前一样自动跳到第一个盘。
77 | 20200816-1145.24
78 | add platform: Baidu CFC. add setting: mobile background.
79 | 新增百度CFC平台。可以分别设置PC与手机的背景。
80 | 20200808-1130.23
81 | FG: select save in env or file.
82 | 在FG中安装时,选择配置保存在环境变量还是文件中。
83 | 20200806-1130.23
84 | SCF: select save in env or file.
85 | 在SCF中安装时,选择配置保存在环境变量还是文件中。
86 | 20200804-1453.22
87 | fix: once error will stop the after files in uploading multy files. SCF can get region now, change install. SCF config save in code file now not in env, if use SCF, you must reinstall after update.
88 | 修复,当上传多个文件时,一个文件出错将导致后续文件不再上传。SCF可以获取到region了,安装过程修改。在SCF中,现在将配置保存到代码文件中,不受环境变量4K大小限制,升级后,用SCF的要重装。
89 | 20200723-1430.21
90 | fix content-type in "?json". can not custom microsoft API id & secret by a link now, so show the return uri.
91 | 当使用"?json"时,现在content-type是json了。现在微软不能一键创建API应用了,提供回调URI。
92 | 20200713-1800.20
93 | add platform: Huawei cloud Function Graph. now you can use "?json" to get a json of folder or file. fix some bug.
94 | 新增白嫖平台:华为云函数工作流FG。可以用"?json"来获得目录或文件的json。修复bug。
95 | 20200607-1856.19
96 | add platform: Aliyun Function Compute. add setting: replace sharepoint.com to a proxy server name. add setting: disableShowThumb,customTheme. add function: php hosting website can update by a click
97 | 现在可以安装到阿里函数计算FC了。php空间可以一键更新了。可以设置某个盘替换sharpoint.com域名为你的反代域名。新增disableShowThumb,customTheme。
98 | 20200503-1848.18
99 | Rebuild theme. Add custom Css & custom Script, add FunctionalityFile: head.omf & foot.omf.
100 | 重建主题文件结构。增加自定义css与自定义script。增加2个功能文件:head.omf、foot.omf。
101 | 20200402-1830.17
102 | Oneclick update can select which branch to update. Now use the accept language instead of the language config.
103 | 一键更新可以选择哪个分支了。现在开始使用浏览器语言,抛弃language设置。
104 | 20200326-0001.16
105 | You can add sharepoint site drive as a disk, you must reinstall after update.
106 | 可以将sharepoint网站添加成一个盘,由于结构改变,升级后只能重装。
107 | 20200321-1830.15
108 | 本次更新后,'index.html'功能在其它主题会导致bug。
109 | 文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
110 | after this update, then 'index.html' function will bug in other theme.
111 | cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。
112 | 20200311-2150.14
113 | Add a switch, can download a known file or not, while the folder is encrypted.
114 | Hide time and size in mobile.
115 | Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after the folder.
116 | 增加一个开关,在目录加密后能否下载其中的某个文件。
117 | 在手机上浏览时,隐藏修改时间跟大小。
118 | 加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
119 | 20200229-1300.13
120 | In SCF, some config can input Special symbols now, like ?&= 。
121 | 在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
122 | 20200225-1310.12
123 | Can update by one click any time. fix bugs: special tag, reupload.
124 | 可以不管版本直接一键更新(覆盖)了。修复可以使用特殊onedrive标签的bug,修复断网续传的问题。
125 | 20200222-2130.11
126 | you can set background now. fix bug: 2nd disk upload.
127 | 可以设置背景图片了。第2个盘上传后链接不对。
128 | 20200222-1700.09
129 | Can copy file and folder now.
130 | 可以复制文件跟目录了。
131 | 20200220-1220.08
132 | Multy Mode! You can add more Onedrive in one project (bind Onedrive in setup). And now, heroku apps can update in setup!
133 | 多盘来了,在设置中添加Onedrive,另,heroku 上也能一键更新了!
134 | 20200215-1850.07
135 | fix: head.md not show if no readme.md.
136 | 修复当没有readme的时候就不显示head的问题。
137 | 20200215-1700.06
138 | classic theme can read the head.md file now.
139 | classic主题可以处理head.md文件了。
140 | 20200202-2010.05
141 | refresh token expires in 90 day, save a new token per month. classic theme add some icon for admin.
142 | refresh token 90天过期,所以每月保存一个新的token。classic主题加了点管理图标。
143 | 20200129-2050.04
144 | if there is 'index.html', then do not show file but show the index.html, except admin.
145 | 如果有index.html,就不显示文件列表了,直接显示index.html内容,除非是管理员。
146 | 20200120.02
147 | fix domain_path do not work. domain_path正常工作了。
148 | 20200118.01
149 | Can be deploy to heroku/SCF/normal space. SCF、heroku、普通VPS,三种环境都可以用了。
150 | Change imgup_path to guestup_path, plz make sure it after update. 将imgup_path改成guestup_path更符合用途,更新后请注意更改。
151 |
--------------------------------------------------------------------------------
/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/writeable.sh:
--------------------------------------------------------------------------------
1 | OneManagerPath=`cd $(dirname $0);pwd -P`
2 | cd ${OneManagerPath}
3 | chmod 666 .data/config.php
4 |
--------------------------------------------------------------------------------