diff --git a/.htaccess b/.htaccess
deleted file mode 100644
index c548b41..0000000
--- a/.htaccess
+++ /dev/null
@@ -1,15 +0,0 @@
-# apache
-# LoadModule rewrite_module modules/mod_rewrite.so
-# AllowOverride All
-RewriteEngine On
-RewriteRule ^(.*) index.php?/$1 [L]
-
-#-----------------------------------
-# nginx
-# rewrite ^(.*) /index.php?/$1 last;
-#
-# caddy
-# rewrite {
-# to index.php?/$1
-# }
-#-----------------------------------
diff --git a/app.json b/app.json
deleted file mode 100644
index b3f61c0..0000000
--- a/app.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "Tfo",
- "description": "Deploy Tfo to heroku",
- "website": "https://github.com/BingoKingo/Tfo",
- "repository": "https://github.com/BingoKingo/Tfo",
- "success_url": "/"
-}
diff --git a/common.php b/common.php
deleted file mode 100644
index be54b63..0000000
--- a/common.php
+++ /dev/null
@@ -1,2709 +0,0 @@
-'Pacific/Kwajalein',
- '-11'=>'Pacific/Samoa',
- '-10'=>'Pacific/Honolulu',
- '-9'=>'America/Anchorage',
- '-8'=>'America/Los_Angeles',
- '-7'=>'America/Denver',
- '-6'=>'America/Mexico_City',
- '-5'=>'America/New_York',
- '-4'=>'America/Caracas',
- '-3.5'=>'America/St_Johns',
- '-3'=>'America/Argentina/Buenos_Aires',
- '-2'=>'America/Noronha',
- '-1'=>'Atlantic/Azores',
- '0'=>'UTC',
- '1'=>'Europe/Paris',
- '2'=>'Europe/Helsinki',
- '3'=>'Europe/Moscow',
- '3.5'=>'Asia/Tehran',
- '4'=>'Asia/Baku',
- '4.5'=>'Asia/Kabul',
- '5'=>'Asia/Karachi',
- '5.5'=>'Asia/Calcutta', //Asia/Colombo
- '6'=>'Asia/Dhaka',
- '6.5'=>'Asia/Rangoon',
- '7'=>'Asia/Bangkok',
- '8'=>'Asia/Shanghai',
- '9'=>'Asia/Tokyo',
- '9.5'=>'Australia/Darwin',
- '10'=>'Pacific/Guam',
- '11'=>'Asia/Magadan',
- '12'=>'Asia/Kamchatka'
-);
-
-function main($path)
-{
- global $exts;
- global $constStr;
-
- $_SERVER['php_starttime'] = microtime(true);
- $path = path_format($path);
- if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) {
- $constStr['language'] = $_SERVER['firstacceptlanguage'];
- } else {
- $prelang = splitfirst($_SERVER['firstacceptlanguage'], '-')[0];
- foreach ( array_keys($constStr['languages']) as $lang) {
- if ($prelang == splitfirst($lang, '-')[0]) {
- $constStr['language'] = $lang;
- break;
- }
- }
- }
- if (isset($_COOKIE['language'])&&$_COOKIE['language']!='') $constStr['language'] = $_COOKIE['language'];
- //if (!$constStr['language']) $constStr['language'] = getConfig('language');
- /*echo 'firstacceptlanguage:'.$_SERVER['firstacceptlanguage'].'
- '.'lan:'.$constStr['language'];*/
- if ($constStr['language']=='') $constStr['language'] = 'en-us';
- $_SERVER['language'] = $constStr['language'];
- $_SERVER['timezone'] = getConfig('timezone');
- if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
- if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
- $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
-
- if (getConfig('admin')=='') return install();
- if (getConfig('adminloginpage')=='') {
- $adminloginpage = 'admin';
- } else {
- $adminloginpage = getConfig('adminloginpage');
- }
- if (isset($_GET[$adminloginpage])) {
- if (isset($_GET['preview'])) {
- $url = $_SERVER['PHP_SELF'] . '?preview';
- } else {
- $url = path_format($_SERVER['PHP_SELF'] . '/');
- }
- if (getConfig('admin')!='') {
- if ($_POST['password1']==getConfig('admin')) {
- return adminform('admin',md5($_POST['password1']),$url);
- } else return adminform();
- } else {
- return output('', 302, [ 'Location' => $url ]);
- }
- }
- if (getConfig('admin')!='')
- if ( isset($_COOKIE['admin'])&&$_COOKIE['admin']==md5(getConfig('admin')) ) {
- $_SERVER['admin']=1;
- $_SERVER['needUpdate'] = needUpdate();
- } else {
- $_SERVER['admin']=0;
- }
- if (isset($_GET['setup']))
- if ($_SERVER['admin']) {
- // setup Environments. 设置,对环境变量操作
- return EnvOpt($_SERVER['needUpdate']);
- } else {
- $url = path_format($_SERVER['PHP_SELF'] . '/');
- return output('', 302, [ 'Location' => $url ]);
- }
-
- $_SERVER['base_disk_path'] = $_SERVER['base_path'];
- $disktags = explode("|",getConfig('disktag'));
-// echo 'count$disk:'.count($disktags);
- if (count($disktags)>1) {
- if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
- $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
- //$pos = strpos($path, '/');
- //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
- if (!in_array($_SERVER['disktag'], $disktags)) {
- $tmp = path_format($_SERVER['base_path'].'/'.$disktags[0].'/'.$path);
- return output('Please visit '.$tmp.'.', 302, [ 'Location' => $tmp ]);
- //return message('Please visit from Home Page.', 'Error', 404);
- }
- $path = substr($path, strlen('/'.$_SERVER['disktag']));
- if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path']. '/' . $_SERVER['disktag'] . '/');
- } else $_SERVER['disktag'] = $disktags[0];
-// echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.'
-//';
- $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']);
- if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/';
- $_SERVER['is_guestup_path'] = is_guestup_path($path);
- $_SERVER['ajax']=0;
- if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1;
-
- config_oauth();
- if ($_SERVER['admin']) if (isset($_GET['AddDisk'])||isset($_GET['authorization_code'])) return get_refresh_token();
- $refresh_token = getConfig('refresh_token');
- //if (!$refresh_token) return get_refresh_token();
- if (!$refresh_token) {
- return render_list();
- } else {
- if (!($_SERVER['access_token'] = getcache('access_token'))) {
- get_access_token($refresh_token);
- }
-
- if ($_SERVER['ajax']) {
- if ($_GET['action']=='del_upload_cache') {
- // del '.tmp' without login. 无需登录即可删除.tmp后缀文件
- error_log('del.tmp:GET,'.json_encode($_GET,JSON_PRETTY_PRINT));
- $tmp = splitlast($_GET['filename'], '/');
- if ($tmp[1]!='') {
- $filename = $tmp[0] . '/.' . $_GET['filelastModified'] . '_' . $_GET['filesize'] . '_' . $tmp[1] . '.tmp';
- } else {
- $filename = '.' . $_GET['filelastModified'] . '_' . $_GET['filesize'] . '_' . $_GET['filename'] . '.tmp';
- }
- $filename = path_format( path_format($_SERVER['list_path'] . path_format($path)) . '/' . spurlencode($filename, '/') );
- $tmp = MSAPI('DELETE', $filename, '', $_SERVER['access_token']);
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- savecache('path_' . $path1, json_decode('{}',true), 1);
- return output($tmp['body'],$tmp['stat']);
- }
- if ($_GET['action']=='uploaded_rename') {
- // rename .scfupload file without login.
- // 无需登录即可重命名.scfupload后缀文件,filemd5为用户提交,可被构造,问题不大,以后处理
- $oldname = spurlencode($_GET['filename']);
- $pos = strrpos($oldname, '.');
- if ($pos>0) $ext = strtolower(substr($oldname, $pos));
- //$oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname . '.scfupload' );
- $oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname);
- $data = '{"name":"' . $_GET['filemd5'] . $ext . '"}';
- //echo $oldname .'
'. $data;
- $tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']);
- if ($tmp['stat']==409) {
- MSAPI('DELETE',$oldname,'',$_SERVER['access_token']);
- $tmpbody = json_decode($tmp['body'], true);
- $tmpbody['name'] = $_GET['filemd5'] . $ext;
- $tmp['body'] = json_encode($tmpbody);
- }
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- savecache('path_' . $path1, json_decode('{}',true), 1);
- return output($tmp['body'],$tmp['stat']);
- }
- if ($_GET['action']=='upbigfile') return bigfileupload($path);
- }
- if ($_SERVER['admin']) {
- $tmp = adminoperate($path);
- if ($tmp['statusCode'] > 0) {
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- savecache('path_' . $path1, json_decode('{}',true), 1);
- return $tmp;
- }
- } else {
- if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401);
- }
- $_SERVER['ishidden'] = passhidden($path);
- if (isset($_GET['thumbnails'])) {
- if ($_SERVER['ishidden']<4) {
- if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) {
- return get_thumbnails_url($path, $_GET['location']);
- } else return output(json_encode($exts['img']),400);
- } else return output('',401);
- }
-
- $files = list_files($path);
- //echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT);
- if ($_GET['json']) {
- // return a json
- return files_json($files);
- }
- if (isset($_GET['random'])&&$_GET['random']!=='') {
- if ($_SERVER['ishidden']<4) {
- $tmp = [];
- foreach (array_keys($files['children']) as $filename) {
- if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename][$_SERVER['DownurlStrName']];
- }
- $tmp = array_values($tmp);
- if (count($tmp)>0) {
- $url = $tmp[rand(0,count($tmp)-1)];
- if (isset($_GET['url'])) return output($url, 200);
- $domainforproxy = '';
- $domainforproxy = getConfig('domainforproxy');
- if ($domainforproxy!='') {
- $url = proxy_replace_domain($url, $domainforproxy);
- }
- return output('', 302, [ 'Location' => $url ]);
- } else return output('',404);
- } else return output('',401);
- }
- if (isset($files['file']) && !isset($_GET['preview'])) {
- // is file && not preview mode
- if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) {
- $url = $files[$_SERVER['DownurlStrName']];
- $domainforproxy = '';
- $domainforproxy = getConfig('domainforproxy');
- if ($domainforproxy!='') {
- $url = proxy_replace_domain($url, $domainforproxy);
- }
- if ( strtolower(splitlast($files['name'],'.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
- else return output('', 302, [ 'Location' => $url ]);
- }
- }
- if ( isset($files['folder']) || isset($files['file']) ) {
- return render_list($path, $files);
- } else {
- if (!isset($files['error'])) {
- $files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
- $files['error']['code'] = 'unknownError';
- $files['error']['stat'] = 500;
- }
- return message(''.getconstStr('Back').getconstStr('Home').'
' . $files['error']['message'] . '
'.getconstStr('Back').'', $files['error']['code'], $files['error']['stat']);
- }
- }
-}
-
-function proxy_replace_domain($url, $domainforproxy)
-{
- $tmp = splitfirst($url, '//');
- $http = $tmp[0];
- $tmp = splitfirst($tmp[1], '/');
- $domain = $tmp[0];
- $uri = $tmp[1];
- if (substr($domainforproxy, 0, 7)=='http://' || substr($domainforproxy, 0, 8)=='https://') $aim = $domainforproxy;
- else $aim = $http . '//' . $domainforproxy;
- if (substr($aim, -1)=='/') $aim = substr($aim, 0, -1);
- return $aim . '/' . $uri . '&Origindomain=' . $domain;
- //$url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp;
-}
-
-function files_json($files)
-{
- //$tmp = '';
- if (isset($files['file'])) {
- $tmp['file']['type'] = 0;
- $tmp['file']['id'] = $files['id'];
- $tmp['file']['name'] = $files['name'];
- $tmp['file']['time'] = $files['lastModifiedDateTime'];
- $tmp['file']['size'] = $files['size'];
- $tmp['file']['mime'] = $files['file']['mimeType'];
- $tmp['file']['url'] = $files[$_SERVER['DownurlStrName']];
- $tmp['url'] = $files[$_SERVER['DownurlStrName']];
- } elseif (isset($files['folder'])) {
- $tmp['list'] = [];
- foreach ($files['children'] as $file) {
- $tmp1 = null;
- $tmp1 = [];
- if (isset($file['file'])) {
- $tmp1['type'] = 0;
- $tmp1['url'] = $file[$_SERVER['DownurlStrName']];
- } elseif (isset($file['folder'])) {
- $tmp1['type'] = 1;
- }
- $tmp1['id'] = $file['id'];
- $tmp1['name'] = $file['name'];
- $tmp1['time'] = $file['lastModifiedDateTime'];
- $tmp1['size'] = $file['size'];
- $tmp1['mime'] = $file['file']['mimeType'];
- array_push($tmp['list'], $tmp1);
- }
- } else return output('', 404);
- return output(json_encode($tmp));
-}
-
-function get_access_token($refresh_token)
-{
- if (getConfig('Drive_ver')=='shareurl') {
- $shareurl = getConfig('shareurl');
- $tmp1 = splitlast($shareurl, '/')[0];
- $account = splitlast($tmp1, '/')[1];
- $tmp1 = splitlast($shareurl, ':')[0];
- $domain = splitlast($tmp1, '/')[0];
- if (!isset($_SERVER['sharecookie'])||$_SERVER['sharecookie']=='') $_SERVER['sharecookie'] = curl_request($shareurl,false, [],1)['returnhead']['Set-Cookie'];
- $response = curl_request(
- $domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE",
- '{"parameters":{"__metadata":{"type":"SP.RenderListDataParameters"},"RenderOptions":136967,"AllowMultipleValueFilterForTaxonomyFields":true,"AddRequiredFields":true}}',
- [ 'Accept' => 'application/json;odata=verbose', 'Content-Type' => 'application/json;odata=verbose', 'origin' => $domain, 'Cookie' => $_SERVER['sharecookie'] ]
- );
- if ($response['stat']==200) $ret = json_decode($response['body'], true);
- $_SERVER['access_token'] = splitlast($ret['ListSchema']['.driveAccessToken'],'=')[1];
- $_SERVER['api_url'] = $ret['ListSchema']['.driveUrl'].'/root';
- if (!$_SERVER['access_token']) {
- error_log($domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE");
- error_log('failed to get share access_token. response' . json_encode($ret));
- throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
- }
- $tmp = $ret;
- $tmp['access_token'] = '******';
- error_log('['.$_SERVER['disktag'].'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
- savecache('access_token', $_SERVER['access_token']);
- $tmp1 = [];
- $tmp1['shareapiurl'] = $_SERVER['api_url'];
- if (getConfig('shareapiurl')=='') setConfig($tmp1);
- } else {
- $p=0;
- while ($response['stat']==0&&$p<3) {
- $response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token );
- $p++;
- }
- if ($response['stat']==200) $ret = json_decode($response['body'], true);
- if (!isset($ret['access_token'])) {
- error_log($_SERVER['oauth_url'] . 'token'.'?client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . substr($refresh_token, 0, 20) . '******' . substr($refresh_token, -20));
- error_log('failed to get ['.$_SERVER['disktag'].'] access_token. response' . json_encode($ret));
- throw new Exception($response['stat'].', failed to get ['.$_SERVER['disktag'].'] access_token.'.$response['body']);
- }
- $tmp = $ret;
- $tmp['access_token'] = '******';
- $tmp['refresh_token'] = '******';
- error_log('['.$_SERVER['disktag'].'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
- $_SERVER['access_token'] = $ret['access_token'];
- savecache('access_token', $_SERVER['access_token'], $ret['expires_in'] - 300);
- if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ]);
- }
-}
-
-function list_files($path)
-{
- $path = path_format($path);
- if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) {
- $files = json_decode('{"folder":{}}', true);
- } elseif (!getConfig('downloadencrypt')) {
- if ($_SERVER['ishidden']==4) $files = json_decode('{"folder":{}}', true);
- else $files = fetch_files($path);
- } else {
- $files = fetch_files($path);
- }
- return $files;
-}
-
-function isHideFile($name)
-{
- $FunctionalityFile = [
- 'head.md',
- 'readme.md',
- 'head.omf',
- 'foot.omf',
- 'favicon.ico',
- 'index.html',
- ];
-
- if ($name == getConfig('passfile')) return true;
- if (substr($name,0,1) == '.') return true;
- if (getConfig('hideFunctionalityFile')) if (in_array(strtolower($name), $FunctionalityFile)) return true;
- return false;
-}
-
-function getcache($str)
-{
- $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']);
- return $cache->fetch($str);
-}
-
-function savecache($key, $value, $exp = 1800)
-{
- $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']);
- $cache->save($key, $value, $exp);
-}
-
-function getconstStr($str)
-{
- global $constStr;
- if ($constStr[$str][$constStr['language']]!='') return $constStr[$str][$constStr['language']];
- return $constStr[$str]['en-us'];
-}
-
-function config_oauth()
-{
- $_SERVER['sitename'] = getConfig('sitename');
- if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
- $_SERVER['redirect_uri'] = 'https://scfonedrive.github.io';
- if (getConfig('Drive_ver')=='shareurl') {
- $_SERVER['api_url'] = getConfig('shareapiurl');
- $_SERVER['sharecookie'] = getConfig('sharecookie');
- $_SERVER['DownurlStrName'] = '@content.downloadUrl';
- return 0;
- }
- if (getConfig('Drive_ver')=='MS') {
- // MS
- // https://portal.azure.com
- //$_SERVER['client_id'] = '4da3e7f2-bf6d-467c-aaf0-578078f0bf7c';
- //$_SERVER['client_secret'] = '7/+ykq2xkfx:.DWjacuIRojIaaWL0QI6';
- $_SERVER['client_id'] = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
- $_SERVER['client_secret'] = ':EK[e0/4vQ@mQgma8LmnWb6j4_C1CSIW';
- $_SERVER['oauth_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
- $_SERVER['api_url'] = 'https://graph.microsoft.com/v1.0/me/drive/root';
- $_SERVER['scope'] = 'https://graph.microsoft.com/Files.ReadWrite.All offline_access';
- if (getConfig('usesharepoint')=='on') $_SERVER['api_url'] = 'https://graph.microsoft.com/v1.0/sites/' . getConfig('siteid') . '/drive/root';
- }
- if (getConfig('Drive_ver')=='CN') {
- // CN
- // https://portal.azure.cn
- $_SERVER['client_id'] = '04c3ca0b-8d07-4773-85ad-98b037d25631';
- $_SERVER['client_secret'] = 'h8@B7kFVOmj0+8HKBWeNTgl@pU/z4yLB';
- $_SERVER['oauth_url'] = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
- $_SERVER['api_url'] = 'https://microsoftgraph.chinacloudapi.cn/v1.0/me/drive/root';
- $_SERVER['scope'] = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All offline_access';
- if (getConfig('usesharepoint')=='on') $_SERVER['api_url'] = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/' . getConfig('siteid') . '/drive/root';
- }
-
- if (getConfig('Drive_custom')=='on') {
- // Customer
- $_SERVER['client_id'] = getConfig('client_id');
- $_SERVER['client_secret'] = getConfig('client_secret');
- }
- $_SERVER['client_secret'] = urlencode($_SERVER['client_secret']);
- $_SERVER['scope'] = urlencode($_SERVER['scope']);
- $_SERVER['DownurlStrName'] = '@microsoft.graph.downloadUrl';
-}
-
-function get_siteid($access_token)
-{
- $sharepointSiteAddress = getConfig('sharepointSiteAddress');
- while (substr($sharepointSiteAddress, -1)=='/') $sharepointSiteAddress = substr($sharepointSiteAddress, 0, -1);
- $tmp = splitlast($sharepointSiteAddress, '/');
- $sharepointname = $tmp[1];
- $tmp = splitlast($tmp[0], '/');
- $sharepointname = $tmp[1] . '/' . $sharepointname;
- if (getConfig('Drive_ver')=='MS') $url = 'https://graph.microsoft.com/v1.0/sites/root:/'.$sharepointname;
- if (getConfig('Drive_ver')=='CN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/'.$sharepointname;
-
- $i=0;
- $response = [];
- while ($url!=''&&$response['stat']!=200&&$i<4) {
- $response = curl_request($url, false, ['Authorization' => 'Bearer ' . $access_token]);
- $i++;
- }
- if ($response['stat']!=200) {
- error_log('failed to get siteid. response' . json_encode($response));
- throw new Exception($response['stat'].', failed to get siteid.'.$response['body']);
- }
- return json_decode($response['body'],true)['id'];
-}
-
-function getListpath($domain)
-{
- $domain_path1 = getConfig('domain_path');
- $public_path = getConfig('public_path');
- $tmp_path='';
- if ($domain_path1!='') {
- $tmp = explode("|",$domain_path1);
- foreach ($tmp as $multidomain_paths){
- $pos = strpos($multidomain_paths,":");
- if ($pos>0) {
- $domain1 = substr($multidomain_paths,0,$pos);
- $tmp_path = path_format(substr($multidomain_paths,$pos+1));
- $domain_path[$domain1] = $tmp_path;
- if ($public_path=='') $public_path = $tmp_path;
- //if (substr($multidomain_paths,0,$pos)==$host_name) $private_path=$tmp_path;
- }
- }
- }
- if (isset($domain_path[$domain])) return spurlencode($domain_path[$domain],'/');
- return spurlencode($public_path,'/');
-}
-
-function path_format($path)
-{
- $path = '/' . $path;
- while (strpos($path, '//') !== FALSE) {
- $path = str_replace('//', '/', $path);
- }
- return $path;
-}
-
-function spurlencode($str,$split='')
-{
- $str = str_replace(' ', '%20',$str);
- $tmp='';
- if ($split!='') {
- $tmparr=explode($split,$str);
- for($x=0;$x $headerVal) {
- $sendHeaders[] = $headerName . ': ' . $headerVal;
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- if ($data !== false) {
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- }
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, $returnheader);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
- //$response['body'] = curl_exec($ch);
- if ($returnheader) {
- list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch));
- foreach (explode("\r\n", $returnhead) as $head) {
- $tmp = explode(': ', $head);
- $heads[$tmp[0]] = $tmp[1];
- }
- $response['returnhead'] = $heads;
- } else {
- $response['body'] = curl_exec($ch);
- }
- $response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
- curl_close($ch);
- return $response;
-}
-
-function clearbehindvalue($path,$page1,$maxpage,$pageinfocache)
-{
- for ($page=$page1+1;$page<$maxpage;$page++) {
- $pageinfocache['nextlink_' . $path . '_page_' . $page] = '';
- }
- $pageinfocache = array_filter($pageinfocache, 'array_value_isnot_null');
- return $pageinfocache;
-}
-
-function comppass($pass)
-{
- if ($_POST['password1'] !== '') if (md5($_POST['password1']) === $pass ) {
- date_default_timezone_set('UTC');
- $_SERVER['Set-Cookie'] = 'password='.$pass.'; expires='.date(DATE_COOKIE,strtotime('+1hour'));
- date_default_timezone_set(get_timezone($_SERVER['timezone']));
- return 2;
- }
- if ($_COOKIE['password'] !== '') if ($_COOKIE['password'] === $pass ) return 3;
- return 4;
-}
-
-function encode_str_replace($str)
-{
- $str = str_replace('&','&',$str);
- $str = str_replace('+','%2B',$str);
- $str = str_replace('#','%23',$str);
- return $str;
-}
-
-function gethiddenpass($path,$passfile)
-{
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- $password=getcache('path_' . $path1 . '/?password');
- if ($password=='') {
- $ispassfile = fetch_files(path_format($path . '/' . urlencode($passfile)));
- //echo $path . '' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '
';
- if (isset($ispassfile['file'])) {
- $arr = curl_request($ispassfile[$_SERVER['DownurlStrName']]);
- if ($arr['stat']==200) {
- $passwordf=explode("\n",$arr['body']);
- $password=$passwordf[0];
- if ($password!='') $password=md5($password);
- savecache('path_' . $path1 . '/?password', $password);
- return $password;
- } else {
- //return md5('DefaultP@sswordWhenNetworkError');
- return md5( md5(time()).rand(1000,9999) );
- }
- } else {
- savecache('path_' . $path1 . '/?password', 'null');
- if ($path !== '' ) {
- $path = substr($path,0,strrpos($path,'/'));
- return gethiddenpass($path,$passfile);
- } else {
- return '';
- }
- }
- } elseif ($password==='null') {
- if ($path !== '' ) {
- $path = substr($path,0,strrpos($path,'/'));
- return gethiddenpass($path,$passfile);
- } else {
- return '';
- }
- } else return $password;
- // return md5('DefaultP@sswordWhenNetworkError');
-}
-
-function get_timezone($timezone = '8')
-{
- global $timezones;
- if ($timezone=='') $timezone = '8';
- return $timezones[$timezone];
-}
-
-function message($message, $title = 'Message', $statusCode = 200)
-{
- return output('
-
-
-
-
-
- ' . $title . '
-
-
-' . $message . '
-
-
-
-
-', $statusCode);
-}
-
-function needUpdate()
-{
- $current_ver = file_get_contents(__DIR__ . '/version');
- $current_ver = substr($current_ver, strpos($current_ver, '.')+1);
- $current_ver = explode(urldecode('%0A'),$current_ver)[0];
- $current_ver = explode(urldecode('%0D'),$current_ver)[0];
- //$github_version = file_get_contents('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version');
- $tmp = curl_request('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version');
- if ($tmp['stat']==0) return 0;
- $github_version = $tmp['body'];
- $github_ver = substr($github_version, strpos($github_version, '.')+1);
- $github_ver = explode(urldecode('%0A'),$github_ver)[0];
- $github_ver = explode(urldecode('%0D'),$github_ver)[0];
- if ($current_ver != $github_ver) {
- $_SERVER['github_version'] = $github_version;
- return 1;
- }
- return 0;
-}
-
-function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
-{
- return [
- 'isBase64Encoded' => $isBase64Encoded,
- 'statusCode' => $statusCode,
- 'headers' => $headers,
- 'body' => $body
- ];
-}
-
-function passhidden($path)
-{
- $path = str_replace('+','%2B',$path);
- $path = str_replace('&','&', path_format(urldecode($path)));
- if (getConfig('passfile') != '') {
- $path = spurlencode($path,'/');
- if (substr($path,-1)=='/') $path=substr($path,0,-1);
- $hiddenpass=gethiddenpass($path,getConfig('passfile'));
- if ($hiddenpass != '') {
- return comppass($hiddenpass);
- } else {
- return 1;
- }
- } else {
- return 0;
- }
- return 4;
-}
-
-function size_format($byte)
-{
- $i = 0;
- while (abs($byte) >= 1024) {
- $byte = $byte / 1024;
- $i++;
- if ($i == 3) break;
- }
- $units = array('B', 'KB', 'MB', 'GB', 'TB');
- $ret = round($byte, 2);
- return ($ret . ' ' . $units[$i]);
-}
-
-function time_format($ISO)
-{
- $ISO = str_replace('T', ' ', $ISO);
- $ISO = str_replace('Z', ' ', $ISO);
- //return $ISO;
- return date('Y-m-d H:i:s',strtotime($ISO . " UTC"));
-}
-
-function get_thumbnails_url($path = '/', $location = 0)
-{
- $path1 = path_format($path);
- $path = path_format($_SERVER['list_path'] . path_format($path));
- if ($path!='/'&&substr($path,-1)=='/') $path=substr($path,0,-1);
- $thumb_url = getcache('thumb_'.$path);
- if ($thumb_url=='') {
- $url = $_SERVER['api_url'];
- if ($path !== '/') {
- $url .= ':' . $path;
- if (substr($url,-1)=='/') $url=substr($url,0,-1);
- }
- $url .= ':/thumbnails/0/medium';
- $files = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
- if (isset($files['url'])) {
- savecache('thumb_'.$path, $files['url']);
- $thumb_url = $files['url'];
- }
- }
- if ($thumb_url!='') {
- if ($location) {
- $url = $thumb_url;
- $domainforproxy = '';
- $domainforproxy = getConfig('domainforproxy');
- if ($domainforproxy!='') {
- $url = proxy_replace_domain($url, $domainforproxy);
- }
- return output('', 302, [ 'Location' => $url ]);
- } else return output($thumb_url);
- }
- return output('', 404);
-}
-
-function bigfileupload($path)
-{
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if (substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- if ($_GET['upbigfilename']!=''&&$_GET['filesize']>0) {
- $tmp = splitlast($_GET['upbigfilename'], '/');
- if ($tmp[1]!='') {
- $fileinfo['name'] = $tmp[1];
- $fileinfo['path'] = $tmp[0];
- } else {
- $fileinfo['name'] = $_GET['upbigfilename'];
- }
- $fileinfo['size'] = $_GET['filesize'];
- $fileinfo['lastModified'] = $_GET['lastModified'];
- $filename = spurlencode($_GET['upbigfilename'],'/');
- $cachefilename = spurlencode( $fileinfo['path'] . '/.' . $fileinfo['lastModified'] . '_' . $fileinfo['size'] . '_' . $fileinfo['name'] . '.tmp', '/');
- $getoldupinfo=fetch_files(path_format($path . '/' . $cachefilename));
- //echo json_encode($getoldupinfo, JSON_PRETTY_PRINT);
- if (isset($getoldupinfo['file'])&&$getoldupinfo['size']<5120) {
- $getoldupinfo_j = curl_request($getoldupinfo[$_SERVER['DownurlStrName']]);
- $getoldupinfo = json_decode($getoldupinfo_j['body'], true);
- if ( json_decode( curl_request($getoldupinfo['uploadUrl'])['body'], true)['@odata.context']!='' ) return output($getoldupinfo_j['body'], $getoldupinfo_j['stat']);
- }
- //if (!$_SERVER['admin']) $filename = spurlencode( $fileinfo['name'] ) . '.scfupload';
- $response=MSAPI('createUploadSession',path_format($path1 . '/' . $filename),'{"item": { "@microsoft.graph.conflictBehavior": "fail" }}',$_SERVER['access_token']);
- $responsearry = json_decode($response['body'],true);
- if (isset($responsearry['error'])) return output($response['body'], $response['stat']);
- $fileinfo['uploadUrl'] = $responsearry['uploadUrl'];
- MSAPI('PUT', path_format($path1 . '/' . $cachefilename), json_encode($fileinfo, JSON_PRETTY_PRINT), $_SERVER['access_token'])['body'];
- return output($response['body'], $response['stat']);
- }
- return output('error', 400);
-}
-
-function adminform($name = '', $pass = '', $path = '')
-{
- $statusCode = 401;
- $html = ''.getconstStr('AdminLogin').'';
- if ($name!=''&&$pass!='') {
- $html .= ''.getconstStr('LoginSuccess').'';
- $statusCode = 302;
- date_default_timezone_set('UTC');
- $header = [
- 'Set-Cookie' => $name.'='.$pass.'; path=/; expires='.date(DATE_COOKIE,strtotime('+1hour')),
- 'Location' => $path,
- 'Content-Type' => 'text/html'
- ];
- return output($html,$statusCode,$header);
- }
- $html .= '
-
-
-
'.getconstStr('InputPassword').'
-
-
-
-';
- $html .= '';
- return output($html,$statusCode);
-}
-
-function adminoperate($path)
-{
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if (substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- $tmparr['statusCode'] = 0;
- if (isset($_GET['rename_newname'])&&$_GET['rename_newname']!=$_GET['rename_oldname'] && $_GET['rename_newname']!='') {
- // rename 重命名
- $oldname = spurlencode($_GET['rename_oldname']);
- $oldname = path_format($path1 . '/' . $oldname);
- $data = '{"name":"' . $_GET['rename_newname'] . '"}';
- //echo $oldname;
- $result = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']);
- //savecache('path_' . $path1, json_decode('{}',true), 1);
- return output($result['body'], $result['stat']);
- }
- if (isset($_GET['delete_name'])) {
- // delete 删除
- $filename = spurlencode($_GET['delete_name']);
- $filename = path_format($path1 . '/' . $filename);
- //echo $filename;
- $result = MSAPI('DELETE', $filename, '', $_SERVER['access_token']);
- //savecache('path_' . $path1, json_decode('{}',true), 1);
- return output($result['body'], $result['stat']);
- }
- if (isset($_GET['operate_action'])&&$_GET['operate_action']==getconstStr('Encrypt')) {
- // encrypt 加密
- if (getConfig('passfile')=='') return message(getconstStr('SetpassfileBfEncrypt'),'',403);
- if ($_GET['encrypt_folder']=='/') $_GET['encrypt_folder']=='';
- $foldername = spurlencode($_GET['encrypt_folder']);
- $filename = path_format($path1 . '/' . $foldername . '/' . getConfig('passfile'));
- //echo $foldername;
- $result = MSAPI('PUT', $filename, $_GET['encrypt_newpass'], $_SERVER['access_token']);
- $path1 = path_format($path1 . '/' . $foldername );
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- savecache('path_' . $path1 . '/?password', '', 1);
- return output($result['body'], $result['stat']);
- }
- if (isset($_GET['move_folder'])) {
- // move 移动
- $moveable = 1;
- if ($path == '/' && $_GET['move_folder'] == '/../') $moveable=0;
- if ($_GET['move_folder'] == $_GET['move_name']) $moveable=0;
- if ($moveable) {
- $filename = spurlencode($_GET['move_name']);
- $filename = path_format($path1 . '/' . $filename);
- $foldername = path_format('/'.urldecode($path1).'/'.$_GET['move_folder']);
- $data = '{"parentReference":{"path": "/drive/root:'.$foldername.'"}}';
- $result = MSAPI('PATCH', $filename, $data, $_SERVER['access_token']);
- //savecache('path_' . $path1, json_decode('{}',true), 1);
- if ($_GET['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
- else $path2 = path_format( $path1 . '/' . $_GET['move_folder'] . '/' );
- if ($path2!='/'&&substr($path2,-1)=='/') $path2=substr($path2,0,-1);
- savecache('path_' . $path2, json_decode('{}',true), 1);
- return output($result['body'], $result['stat']);
- } else {
- return output('{"error":"'.getconstStr('CannotMove').'"}', 403);
- }
- }
- if (isset($_GET['copy_name'])) {
- // copy 复制
- $filename = spurlencode($_GET['copy_name']);
- $filename = path_format($path1 . '/' . $filename);
- $namearr = splitlast($_GET['copy_name'], '.');
- if ($namearr[0]!='') {
- $newname = $namearr[0] . ' (' . getconstStr('Copy') . ')';
- if ($namearr[1]!='') $newname .= '.' . $namearr[1];
- } else {
- $newname = '.' . $namearr[1] . ' (' . getconstStr('Copy') . ')';
- }
- //$newname = spurlencode($newname);
- //$foldername = path_format('/'.urldecode($path1).'/./');
- //$data = '{"parentReference":{"path": "/drive/root:'.$foldername.'"}}';
- $data = '{ "name": "' . $newname . '" }';
- $result = MSAPI('copy', $filename, $data, $_SERVER['access_token']);
- $num = 0;
- while ($result['stat']==409 && json_decode($result['body'], true)['error']['code']=='nameAlreadyExists') {
- $num++;
- if ($namearr[0]!='') {
- $newname = $namearr[0] . ' (' . getconstStr('Copy') . ' ' . $num . ')';
- if ($namearr[1]!='') $newname .= '.' . $namearr[1];
- } else {
- $newname = '.' . $namearr[1] . ' ('.getconstStr('Copy'). ' ' . $num .')';
- }
- //$newname = spurlencode($newname);
- $data = '{ "name": "' . $newname . '" }';
- $result = MSAPI('copy', $filename, $data, $_SERVER['access_token']);
- }
- //echo $result['stat'].$result['body'];
- //savecache('path_' . $path1, json_decode('{}',true), 1);
- //if ($_GET['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
- //else $path2 = path_format( $path1 . '/' . $_GET['move_folder'] . '/' );
- //savecache('path_' . $path2, json_decode('{}',true), 1);
- return output($result['body'], $result['stat']);
- }
- if (isset($_POST['editfile'])) {
- // edit 编辑
- $data = $_POST['editfile'];
- /*TXT一般不会超过4M,不用二段上传
- $filename = $path1 . ':/createUploadSession';
- $response=MSAPI('POST',$filename,'{"item": { "@microsoft.graph.conflictBehavior": "replace" }}',$_SERVER['access_token']);
- $uploadurl=json_decode($response,true)['uploadUrl'];
- echo MSAPI('PUT',$uploadurl,$data,$_SERVER['access_token']);*/
- $result = MSAPI('PUT', $path1, $data, $_SERVER['access_token'])['body'];
- //echo $result;
- $resultarry = json_decode($result,true);
- if (isset($resultarry['error'])) return message($resultarry['error']['message']. '
'.getconstStr('Back').'','Error',403);
- }
- if (isset($_GET['create_name'])) {
- // create 新建
- if ($_GET['create_type']=='file') {
- $filename = spurlencode($_GET['create_name']);
- $filename = path_format($path1 . '/' . $filename);
- $result = MSAPI('PUT', $filename, $_GET['create_text'], $_SERVER['access_token']);
- }
- if ($_GET['create_type']=='folder') {
- $data = '{ "name": "' . $_GET['create_name'] . '", "folder": { }, "@microsoft.graph.conflictBehavior": "rename" }';
- $result = MSAPI('children', $path1, $data, $_SERVER['access_token']);
- }
- //savecache('path_' . $path1, json_decode('{}',true), 1);
- return output($result['body'], $result['stat']);
- }
- if (isset($_GET['RefreshCache'])) {
- $path1 = path_format($_SERVER['list_path'] . path_format($path));
- if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
- savecache('path_' . $path1 . '/?password', '', 1);
- savecache('customTheme', '', 1);
- return message('', getconstStr('RefreshCache'), 302);
- }
- return $tmparr;
-}
-
-function splitfirst($str, $split)
-{
- $len = strlen($split);
- $pos = strpos($str, $split);
- if ($pos===false) {
- $tmp[0] = $str;
- $tmp[1] = '';
- } elseif ($pos>0) {
- $tmp[0] = substr($str, 0, $pos);
- $tmp[1] = substr($str, $pos+$len);
- } else {
- $tmp[0] = '';
- $tmp[1] = substr($str, $len);
- }
- return $tmp;
-}
-
-function splitlast($str, $split)
-{
- $len = strlen($split);
- $pos = strrpos($str, $split);
- if ($pos===false) {
- $tmp[0] = $str;
- $tmp[1] = '';
- } elseif ($pos>0) {
- $tmp[0] = substr($str, 0, $pos);
- $tmp[1] = substr($str, $pos+$len);
- } else {
- $tmp[0] = '';
- $tmp[1] = substr($str, $len);
- }
- return $tmp;
-}
-
-function MSAPI($method, $path, $data = '', $access_token)
-{
- if (substr($path,0,7) == 'http://' or substr($path,0,8) == 'https://') {
- $url=$path;
- $lenth=strlen($data);
- $headers['Content-Length'] = $lenth;
- $lenth--;
- $headers['Content-Range'] = 'bytes 0-' . $lenth . '/' . $headers['Content-Length'];
- } else {
- $url = $_SERVER['api_url'];
- if ($path=='' or $path=='/') {
- $url .= '/';
- } else {
- $url .= ':' . $path;
- if (substr($url,-1)=='/') $url=substr($url,0,-1);
- }
- if ($method=='PUT') {
- if ($path=='' or $path=='/') {
- $url .= 'content';
- } else {
- $url .= ':/content';
- }
- $headers['Content-Type'] = 'text/plain';
- } elseif ($method=='PATCH') {
- $headers['Content-Type'] = 'application/json';
- } elseif ($method=='POST') {
- $headers['Content-Type'] = 'application/json';
- } elseif ($method=='DELETE') {
- $headers['Content-Type'] = 'application/json';
- } else {
- if ($path=='' or $path=='/') {
- $url .= $method;
- } else {
- $url .= ':/' . $method;
- }
- $method='POST';
- $headers['Content-Type'] = 'application/json';
- }
- }
- $headers['Authorization'] = 'Bearer ' . $access_token;
- if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
- //if (!isset($headers['Referer'])) $headers['Referer'] = $url;*
- $sendHeaders = array();
- foreach ($headers as $headerName => $headerVal) {
- $sendHeaders[] = $headerName . ': ' . $headerVal;
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
- curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
- $response['body'] = curl_exec($ch);
- $response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
- //$response['Location'] = curl_getinfo($ch);
- curl_close($ch);
- error_log($response['stat'].'
-'.$response['body'].'
-');
- return $response;
-}
-
-function fetch_files($path = '/')
-{
- global $exts;
- $path1 = path_format($path);
- $path = path_format($_SERVER['list_path'] . path_format($path));
- if ($path!='/'&&substr($path,-1)=='/') $path=substr($path,0,-1);
- if (!($files = getcache('path_' . $path))) {
- // https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
- // https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
- // https://developer.microsoft.com/zh-cn/graph/graph-explorer
- $pos = splitlast($path, '/');
- $parentpath = $pos[0];
- if ($parentpath=='') $parentpath = '/';
- $filename = $pos[1];
- if ($parentfiles = getcache('path_' . $parentpath)) {
- if (isset($parentfiles['children'][$filename][$_SERVER['DownurlStrName']])) {
- if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
- if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
- $content1 = curl_request($parentfiles['children'][$filename][$_SERVER['DownurlStrName']]);
- $parentfiles['children'][$filename]['content'] = $content1;
- savecache('path_' . $parentpath, $parentfiles);
- }
- }
- return $parentfiles['children'][$filename];
- }
- }
-
- $url = $_SERVER['api_url'];
- if ($path !== '/') {
- $url .= ':' . $path;
- if (substr($url,-1)=='/') $url=substr($url,0,-1);
- }
- $url .= '?expand=children(select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'].')';
- $retry = 0;
- $arr = [];
- while ($retry<3&&!$arr['stat']) {
- $arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']],1);
- $retry++;
- }
- if ($arr['stat']<500) {
- $files = json_decode($arr['body'], true);
- //echo $path . '
' . json_encode($arr, JSON_PRETTY_PRINT) . '
';
- if (isset($files['folder'])) {
- if ($files['folder']['childCount']>200) {
- // files num > 200 , then get nextlink
- $page = $_POST['pagenum']==''?1:$_POST['pagenum'];
- if ($page>1) $files=fetch_files_children($files, $path1, $page);
- $files['children'] = children_name($files['children']);
- /*$url = $_SERVER['api_url'];
- if ($path !== '/') {
- $url .= ':' . $path;
- if (substr($url,-1)=='/') $url=substr($url,0,-1);
- $url .= ':/children?$top=9999&$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'];
- } else {
- $url .= '/children?$top=9999&$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'];
- }
- $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
- $files['children'] = $children['value'];*/
- } else {
- // files num < 200 , then cache
- //if (isset($files['children'])) {
- $files['children'] = children_name($files['children']);
- //}
- savecache('path_' . $path, $files);
- }
- }
- if (isset($files['file'])) {
- if (in_array(splitlast($files['name'],'.')[1], $exts['txt'])) {
- if (!(isset($files['content'])&&$files['content']['stat']==200)) {
- $content1 = curl_request($files[$_SERVER['DownurlStrName']]);
- $files['content'] = $content1;
- savecache('path_' . $path, $files);
- }
- }
- }
- if (isset($files['error'])) {
- $files['error']['stat'] = $arr['stat'];
- }
- } else {
- //error_log($arr['body']);
- $files = json_decode($arr['body'], true);
- if (isset($files['error'])) {
- $files['error']['stat'] = $arr['stat'];
- } else {
- $files['error']['stat'] = 503;
- $files['error']['code'] = 'unknownError';
- $files['error']['message'] = 'unknownError';
- }
- //$files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true);
- //error_log(json_encode($files, JSON_PRETTY_PRINT));
- }
- }
-
- return $files;
-}
-
-function children_name($children)
-{
- $tmp = [];
- foreach ($children as $file) {
- $tmp[strtolower($file['name'])] = $file;
- }
- return $tmp;
-}
-
-function fetch_files_children($files, $path, $page)
-{
- $path1 = path_format($path);
- $path = path_format($_SERVER['list_path'] . path_format($path));
- if ($path!='/'&&substr($path,-1)=='/') $path=substr($path,0,-1);
- $cachefilename = '.SCFcache_'.$_SERVER['function_name'];
- $maxpage = ceil($files['folder']['childCount']/200);
- if (!($files['children'] = getcache('files_' . $path . '_page_' . $page))) {
- // down cache file get jump info. 下载cache文件获取跳页链接
- $cachefile = fetch_files(path_format($path1 . '/' .$cachefilename));
- if ($cachefile['size']>0) {
- $pageinfo = curl_request($cachefile[$_SERVER['DownurlStrName']])['body'];
- $pageinfo = json_decode($pageinfo,true);
- for ($page4=1;$page4<$maxpage;$page4++) {
- savecache('nextlink_' . $path . '_page_' . $page4, $pageinfo['nextlink_' . $path . '_page_' . $page4]);
- $pageinfocache['nextlink_' . $path . '_page_' . $page4] = $pageinfo['nextlink_' . $path . '_page_' . $page4];
- }
- }
- $pageinfochange=0;
- for ($page1=$page;$page1>=1;$page1--) {
- $page3=$page1-1;
- $url = getcache('nextlink_' . $path . '_page_' . $page3);
- if ($url == '') {
- if ($page1==1) {
- $url = $_SERVER['api_url'];
- if ($path !== '/') {
- $url .= ':' . $path;
- if (substr($url,-1)=='/') $url=substr($url,0,-1);
- $url .= ':/children?$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'];
- } else {
- $url .= '/children?$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'];
- }
- $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
- // echo $url . '
' . json_encode($children, JSON_PRETTY_PRINT) . '
';
- savecache('files_' . $path . '_page_' . $page1, $children['value']);
- $nextlink=getcache('nextlink_' . $path . '_page_' . $page1);
- if ($nextlink!=$children['@odata.nextLink']) {
- savecache('nextlink_' . $path . '_page_' . $page1, $children['@odata.nextLink']);
- $pageinfocache['nextlink_' . $path . '_page_' . $page1] = $children['@odata.nextLink'];
- $pageinfocache = clearbehindvalue($path,$page1,$maxpage,$pageinfocache);
- $pageinfochange = 1;
- }
- $url = $children['@odata.nextLink'];
- for ($page2=$page1+1;$page2<=$page;$page2++) {
- sleep(1);
- $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
- savecache('files_' . $path . '_page_' . $page2, $children['value']);
- $nextlink=getcache('nextlink_' . $path . '_page_' . $page2);
- if ($nextlink!=$children['@odata.nextLink']) {
- savecache('nextlink_' . $path . '_page_' . $page2, $children['@odata.nextLink']);
- $pageinfocache['nextlink_' . $path . '_page_' . $page2] = $children['@odata.nextLink'];
- $pageinfocache = clearbehindvalue($path,$page2,$maxpage,$pageinfocache);
- $pageinfochange = 1;
- }
- $url = $children['@odata.nextLink'];
- }
- //echo $url . '
' . json_encode($children, JSON_PRETTY_PRINT) . '
';
- $files['children'] = $children['value'];
- $files['folder']['page']=$page;
- $pageinfocache['filenum'] = $files['folder']['childCount'];
- $pageinfocache['dirsize'] = $files['size'];
- $pageinfocache['cachesize'] = $cachefile['size'];
- $pageinfocache['size'] = $files['size']-$cachefile['size'];
- if ($pageinfochange == 1) MSAPI('PUT', path_format($path.'/'.$cachefilename), json_encode($pageinfocache, JSON_PRETTY_PRINT), $_SERVER['access_token'])['body'];
- return $files;
- }
- } else {
- for ($page2=$page3+1;$page2<=$page;$page2++) {
- sleep(1);
- $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
- savecache('files_' . $path . '_page_' . $page2, $children['value'], 3300);
- $nextlink=getcache('nextlink_' . $path . '_page_' . $page2);
- if ($nextlink!=$children['@odata.nextLink']) {
- savecache('nextlink_' . $path . '_page_' . $page2, $children['@odata.nextLink'], 3300);
- $pageinfocache['nextlink_' . $path . '_page_' . $page2] = $children['@odata.nextLink'];
- $pageinfocache = clearbehindvalue($path,$page2,$maxpage,$pageinfocache);
- $pageinfochange = 1;
- }
- $url = $children['@odata.nextLink'];
- }
- //echo $url . '
' . json_encode($children, JSON_PRETTY_PRINT) . '
';
- $files['children'] = $children['value'];
- $files['folder']['page']=$page;
- $pageinfocache['filenum'] = $files['folder']['childCount'];
- $pageinfocache['dirsize'] = $files['size'];
- $pageinfocache['cachesize'] = $cachefile['size'];
- $pageinfocache['size'] = $files['size']-$cachefile['size'];
- if ($pageinfochange == 1) MSAPI('PUT', path_format($path.'/'.$cachefilename), json_encode($pageinfocache, JSON_PRETTY_PRINT), $_SERVER['access_token'])['body'];
- return $files;
- }
- }
- } else {
- $files['folder']['page']=$page;
- for ($page4=1;$page4<=$maxpage;$page4++) {
- if (!($url = getcache('nextlink_' . $path . '_page_' . $page4))) {
- if ($files['folder'][$path.'_'.$page4]!='') savecache('nextlink_' . $path . '_page_' . $page4, $files['folder'][$path.'_'.$page4]);
- } else {
- $files['folder'][$path.'_'.$page4] = $url;
- }
- }
- }
- return $files;
-}
-
-function get_refresh_token()
-{
- global $constStr;
- global $CommonEnv;
- $envs = '';
- foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', ';
- $url = path_format($_SERVER['PHP_SELF'] . '/');
- if (isset($_GET['authorization_code']) && isset($_GET['code'])) {
- $_SERVER['disktag'] = $_COOKIE['disktag'];
- config_oauth();
- $tmp = curl_request($_SERVER['oauth_url'] . 'token', 'client_id=' . $_SERVER['client_id'] .'&client_secret=' . $_SERVER['client_secret'] . '&grant_type=authorization_code&requested_token_use=on_behalf_of&redirect_uri=' . $_SERVER['redirect_uri'] .'&code=' . $_GET['code']);
- if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true);
- if (isset($ret['refresh_token'])) {
- $refresh_token = $ret['refresh_token'];
- $str = '
- refresh_token :
';
- $str .= '
-
- '.getconstStr('SavingToken').'
- ';
- $tmptoken['refresh_token'] = $refresh_token;
- $tmptoken['token_expires'] = time()+7*24*60*60;
- if (getConfig('usesharepoint')=='on') $tmptoken['siteid'] = get_siteid($ret['access_token']);
- setConfig($tmptoken, $_COOKIE['disktag']);
- savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60);
- //WaitSCFStat();
- $str .= '
- ';
- return message($str, getconstStr('WaitJumpIndex'));
- }
- return message('' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '
', $tmp['stat']);
- //return message('' . json_encode($ret, JSON_PRETTY_PRINT) . '
', 500);
- }
- if (isset($_GET['install1'])) {
- $_SERVER['disktag'] = $_COOKIE['disktag'];
- config_oauth();
- if (getConfig('Drive_ver')=='MS' || getConfig('Drive_ver')=='CN') {
- return message('
- '.getconstStr('JumptoOffice').'
-
- ', getconstStr('Wait').' 1s', 201);
- } else {
- return message('Something error, retry after a few seconds.', 'retry', 201);
- }
- }
- if (isset($_GET['install0'])) {
- if ($_POST['disktag_add']!='') {
- if (in_array($_COOKIE['disktag'], $CommonEnv)) {
- return message('Do not input ' . $envs . '
', 'Error', 201);
- }
- $_SERVER['disktag'] = $_COOKIE['disktag'];
- $tmp['disktag_add'] = $_POST['disktag_add'];
- $tmp['diskname'] = $_POST['diskname'];
- $tmp['Drive_ver'] = $_POST['Drive_ver'];
- if ($_POST['Drive_ver']=='shareurl') {
- $tmp['shareurl'] = $_POST['shareurl'];
- $tmp['refresh_token'] = 1;
- } else {
- if ($_POST['Drive_custom']=='on') {
- $tmp['Drive_custom'] = $_POST['Drive_custom'];
- $tmp['client_id'] = $_POST['client_id'];
- $tmp['client_secret'] = $_POST['client_secret'];
- } else {
- $tmp['Drive_custom'] = '';
- $tmp['client_id'] = '';
- $tmp['client_secret'] = '';
- }
- if ($_POST['usesharepoint']=='on') {
- $tmp['usesharepoint'] = $_POST['usesharepoint'];
- $tmp['sharepointSiteAddress'] = $_POST['sharepointSiteAddress'];
- } else {
- $tmp['usesharepoint'] = '';
- $tmp['sharepointSiteAddress'] = '';
- }
- }
- $response = setConfigResponse( setConfig($tmp, $_COOKIE['disktag']) );
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- } else {
- $title = getconstStr('MayinEnv');
- $html = getconstStr('Wait') . ' 3s';
- if ($_POST['Drive_ver']=='shareurl') $html = getconstStr('Wait') . ' 3s';
- }
- return message($html, $title, 201);
- }
- }
-
- if ($constStr['language']!='zh-cn') {
- $linklang='en-us';
- } else $linklang='zh-cn';
- $ru = "https://developer.microsoft.com/".$linklang."/graph/quick-start?appID=_appId_&appName=_appName_&redirectUrl=".$_SERVER['redirect_uri']."&platform=option-php";
- $deepLink = "/quickstart/graphIO?publicClientSupport=false&appName=OneManager&redirectUrl=".$_SERVER['redirect_uri']."&allowImplicitFlow=false&ru=".urlencode($ru);
- $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink);
- $html = '
-
- ';
- $title = 'Bind Disk';
- return message($html, $title, 201);
-}
-
-function EnvOpt($needUpdate = 0)
-{
- global $constStr;
- global $ShowedCommonEnv;
- global $ShowedInnerEnv;
- global $timezones;
- asort($ShowedCommonEnv);
- asort($ShowedInnerEnv);
- $html = 'OneManager '.getconstStr('Setup').'';
- if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) {
- $response = OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch']);
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- } else {
- //WaitSCFStat();
- $html .= getconstStr('UpdateSuccess') . '
-';
- $title = getconstStr('Setup');
- }
- return message($html, $title);
- }
- if (isset($_POST['submit1'])) {
- $_SERVER['disk_oprating'] = '';
- foreach ($_POST as $k => $v) {
- if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') {
- $tmp[$k] = $v;
- }
- if ($k == 'disk') $_SERVER['disk_oprating'] = $v;
- }
- /*if ($tmp['domain_path']!='') {
- $tmp1 = explode("|",$tmp['domain_path']);
- $tmparr = [];
- foreach ($tmp1 as $multidomain_paths){
- $pos = strpos($multidomain_paths,":");
- if ($pos>0) $tmparr[substr($multidomain_paths, 0, $pos)] = path_format(substr($multidomain_paths, $pos+1));
- }
- $tmp['domain_path'] = $tmparr;
- }*/
- $response = setConfigResponse( setConfig($tmp, $_SERVER['disk_oprating']) );
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- } else {
- //WaitSCFStat();
- $html .= getconstStr('Success') . '!
-';
- $title = getconstStr('Setup');
- }
- return message($html, $title);
- }
- if (isset($_GET['preview'])) {
- $preurl = $_SERVER['PHP_SELF'] . '?preview';
- } else {
- $preurl = path_format($_SERVER['PHP_SELF'] . '/');
- }
- $html .= '
-'.getconstStr('Back').' '.getconstStr('Back').getconstStr('Home').'
-Github
';
-
- $html .= '
-
';
- foreach (explode("|",getConfig('disktag')) as $disktag) {
- if ($disktag!='') {
- $html .= '
-
- ';
- if (getConfig('refresh_token', $disktag)!='') {
- $html .= '
- ';
- } else {
- $html .= '
-
- Please add this disk again. |
-
';
- }
- $html .= '
-
';
- }
- }
- $html .= '
-'.getconstStr('AddDisk').'
';
-
- $canOneKeyUpate = 0;
- if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
- $canOneKeyUpate = 1;
- } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
- $canOneKeyUpate = 1;
- } elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
- $canOneKeyUpate = 1;
- } elseif ($_SERVER['_APP_SHARE_DIR']==='/var/share/CFF/processrouter') {
- $canOneKeyUpate = 1;
- } else {
- $tmp = time();
- if ( mkdir(''.$tmp, 0777) ) {
- rmdir(''.$tmp);
- $canOneKeyUpate = 1;
- }
- }
- if (!$canOneKeyUpate) {
- $html .= '
-'.getconstStr('CannotOneKeyUpate').'
';
- } else {
- $html .= '
-
-
-';
- }
- if ($needUpdate) {
- $html .= '
- ' . str_replace("\r", '
',$_SERVER['github_version']) . '
-
';
- }/* else {
- $html .= getconstStr('NotNeedUpdate');
- }*/
- return message($html, getconstStr('Setup'));
-}
-
-function render_list($path = '', $files = '')
-{
- global $exts;
- global $constStr;
-
- if (isset($files['children']['index.html']) && !$_SERVER['admin']) {
- $htmlcontent = fetch_files(spurlencode(path_format(urldecode($path) . '/index.html'),'/'))['content'];
- return output($htmlcontent['body'], $htmlcontent['stat']);
- }
- $path = str_replace('%20','%2520',$path);
- $path = str_replace('+','%2B',$path);
- $path = str_replace('&','&',path_format(urldecode($path))) ;
- $path = str_replace('%20',' ',$path);
- $path = str_replace('#','%23',$path);
- $p_path='';
- if ($path !== '/') {
- if (isset($files['file'])) {
- $pretitle = str_replace('&','&', $files['name']);
- $n_path = $pretitle;
- $tmp = splitlast(splitlast($path,'/')[0],'/');
- if ($tmp[1]=='') {
- $p_path = $tmp[0];
- } else {
- $p_path = $tmp[1];
- }
- } else {
- if (substr($path, 0, 1)=='/') $pretitle = substr($path, 1);
- if (substr($path, -1)=='/') $pretitle = substr($pretitle, 0, -1);
- $tmp=splitlast($pretitle,'/');
- if ($tmp[1]=='') {
- $n_path = $tmp[0];
- } else {
- $n_path = $tmp[1];
- $tmp = splitlast($tmp[0],'/');
- if ($tmp[1]=='') {
- $p_path = $tmp[0];
- } else {
- $p_path = $tmp[1];
- }
- }
- }
- } else {
- $pretitle = getconstStr('Home');
- $n_path=$pretitle;
- }
- $n_path=str_replace('&','&',$n_path);
- $p_path=str_replace('&','&',$p_path);
- $pretitle = str_replace('%23','#',$pretitle);
- $statusCode=200;
- date_default_timezone_set(get_timezone($_SERVER['timezone']));
- $authinfo = '';
- //$authinfo = $path . '
' . json_encode($files, JSON_PRETTY_PRINT) . '
';
-
- if (isset($_COOKIE['theme'])&&$_COOKIE['theme']!='') $theme = $_COOKIE['theme'];
- if ( !file_exists(__DIR__.'/theme/'.$theme) ) $theme = '';
- if ( $theme=='' ) {
- $tmp = getConfig('customTheme');
- if ( $tmp!='' ) $theme = $tmp;
- }
- if ( $theme=='' ) {
- $theme = getConfig('theme');
- if ( $theme=='' || !file_exists(__DIR__.'/theme/'.$theme) ) $theme = 'classic.html';
- }
- if (substr($theme,-4)=='.php') {
- @ob_start();
- include 'theme/'.$theme;
- $html = ob_get_clean();
- } else {
- if (file_exists(__DIR__.'/theme/'.$theme)) {
- $file_path = __DIR__.'/theme/'.$theme;
- $html = file_get_contents($file_path);
- } else {
- if (!($html = getcache('customTheme'))) {
- $file_path = $theme;
- $tmp = curl_request($file_path, false, [], 1);
- if ($tmp['stat']==302) {
- error_log(json_encode($tmp));
- $tmp = curl_request($tmp["returnhead"]["Location"]);
- }
- if (!!$tmp['body']) $html = $tmp['body'];
- savecache('customTheme', $html, 9999);
- }
-
- }
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $IconValues = json_decode($tmp[0], true);
- $html .= $tmp[1];
-
- if (!$files) {
- //$html = ''.json_encode($files, JSON_PRETTY_PRINT).'
' . $html;
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
- if ($_SERVER['admin']) {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- while (strpos($html, '')) $html = str_replace('', getconstStr('Operate'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Create'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Encrypt'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('RefreshCache'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Setup'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Logout'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Rename'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Submit'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Delete'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Copy'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Move'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Folder'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('File'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Name'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Content'), $html);
-
- } else {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- if (getConfig('adminloginpage')=='') {
- while (strpos($html, '')) $html = str_replace('', '', $html);
- while (strpos($html, '')) $html = str_replace('', '', $html);
- } else {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
- while (strpos($html, '')) $html = str_replace('', '', $html);
- while (strpos($html, '')) $html = str_replace('', '', $html);
- }
-
- if ($_SERVER['ishidden']==4) {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- /*$tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }*/
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- } else {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- }
- while (strpos($html, '')) $html = str_replace('', getconstStr('Download'), $html);
-
- if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- } else {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- }
- if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&isset($files['folder'])&&$_SERVER['ishidden']<4 )) {
- while (strpos($html, '')) {
- while (strpos($html, '')) $html = str_replace('', '', $html);
- while (strpos($html, '')) $html = str_replace('', '', $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Calculate'), $html);
- }
- } else {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
-
- if (isset($files['file'])) {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
-
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- $html = str_replace('', str_replace('%2523', '%23', str_replace('%26amp%3B','&',spurlencode(path_format($_SERVER['base_disk_path'] . '/' . $path), '/'))), $html);
- $html = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
-
- $ext = strtolower(substr($path, strrpos($path, '.') + 1));
- if (in_array($ext, $exts['img'])) $ext = 'img';
- elseif (in_array($ext, $exts['video'])) $ext = 'video';
- elseif (in_array($ext, $exts['music'])) $ext = 'music';
- //elseif (in_array($ext, $exts['pdf'])) $ext = 'pdf';
- elseif ($ext=='pdf') $ext = 'pdf';
- elseif (in_array($ext, $exts['office'])) $ext = 'office';
- elseif (in_array($ext, $exts['txt'])) $ext = 'txt';
- else $ext = 'Other';
- $previewext = ['img', 'video', 'music', 'pdf', 'office', 'txt', 'Other'];
- $previewext = array_diff($previewext, [ $ext ]);
- foreach ($previewext as $ext1) {
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- //while (strpos($html, '')) $html = str_replace('', $files[$_SERVER['DownurlStrName']], $html);
- while (strpos($html, '')) $html = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
- while (strpos($html, '')) $html = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
- while (strpos($html, '')) $html = str_replace('', $files['name'], $html);
- $html = str_replace('', urlencode($files[$_SERVER['DownurlStrName']]), $html);
- $html = str_replace('', getconstStr('ClicktoEdit'), $html);
- $html = str_replace('', getconstStr('CancelEdit'), $html);
- $html = str_replace('', getconstStr('Save'), $html);
- while (strpos($html, '')) $html = str_replace('', htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']), $html);
- $html = str_replace('', getconstStr('FileNotSupport'), $html);
-
-
- //$html = str_replace('', getconstStr('File'), $html);
- } elseif (isset($files['children'])) {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- $html = str_replace('', getconstStr('File'), $html);
- $html = str_replace('', getconstStr('ShowThumbnails'), $html);
- $html = str_replace('', getconstStr('CopyAllDownloadUrl'), $html);
- $html = str_replace('', getconstStr('EditTime'), $html);
- $html = str_replace('', getconstStr('Size'), $html);
-
- $filenum = 0;
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $FolderList = $tmp[0];
- foreach ($files['children'] as $file) {
- if (isset($file['folder'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++;
- $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList);
- $FolderListStr = str_replace('', str_replace('&','&', $file['name']), $FolderListStr);
- $FolderListStr = str_replace('', time_format($file['lastModifiedDateTime']), $FolderListStr);
- $FolderListStr = str_replace('', size_format($file['size']), $FolderListStr);
- while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr);
- $html .= $FolderListStr;
- }
- }
- }
- $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $FolderList = $tmp[0];
- foreach ($files['children'] as $file) {
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++;
- $ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1));
- $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList);
- $FolderListStr = str_replace('', $ext, $FolderListStr);
- if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('', 'audio', $FolderListStr);
- elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('', 'iframe', $FolderListStr);
- else $FolderListStr = str_replace('', '', $FolderListStr);
- $FolderListStr = str_replace('', str_replace('&','&', $file['name']), $FolderListStr);
- //$FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . str_replace('&','&', $file['name'])), $FolderListStr);
- $FolderListStr = str_replace('', time_format($file['lastModifiedDateTime']), $FolderListStr);
- $FolderListStr = str_replace('', size_format($file['size']), $FolderListStr);
- if (!!$IconValues) {
- foreach ($IconValues as $key1 => $value1) {
- if (isset($exts[$key1])&&in_array($ext, $exts[$key1])) {
- $FolderListStr = str_replace('', $value1, $FolderListStr);
- }
- if ($ext==$key1) {
- $FolderListStr = str_replace('', $value1, $FolderListStr);
- }
- //error_log('file:'.$file['name'].':'.$key1);
- if (!strpos($FolderListStr, '')) break;
- }
- if (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr);
- }
- while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr);
- $html .= $FolderListStr;
- }
- }
- }
- $html .= $tmp[1];
- while (strpos($html, '')) $html = str_replace('', $filenum, $html);
-
- if ($files['folder']['childCount']>200) {
- while (strpos($html, '')) $html = str_replace('', '', $html);
- while (strpos($html, '')) $html = str_replace('', '', $html);
-
- $pagenum = $files['folder']['page'];
- if ($pagenum=='') $pagenum = 1;
- $maxpage = ceil($files['folder']['childCount']/200);
-
- if ($pagenum!=1) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- $html = str_replace('', getconstStr('PrePage'), $html);
- $html = str_replace('', $pagenum-1, $html);
- } else {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- //$html .= json_encode($files['folder']);
- if ($pagenum!=$maxpage) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- $html = str_replace('', getconstStr('NextPage'), $html);
- $html = str_replace('', $pagenum+1, $html);
- } else {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $MorePageListNow = str_replace('', $pagenum, $tmp[0]);
- $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $MorePageList = $tmp[0];
- for ($page=1;$page<=$maxpage;$page++) {
- if ($page == $pagenum) {
- $MorePageListStr = $MorePageListNow;
- } else {
- $MorePageListStr = str_replace('', $page, $MorePageList);
- $MorePageListStr = str_replace('', $page, $MorePageListStr);
- }
- $html .= $MorePageListStr;
- }
- $html .= $tmp[1];
-
- while (strpos($html, '')) $html = str_replace('', $maxpage, $html);
-
- } else {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
-
- }
-
- $html = str_replace('', $constStr['language'], $html);
-
- $title = $pretitle;
- if ($_SERVER['base_disk_path']!=$_SERVER['base_path']) {
- if (getConfig('diskname')!='') $diskname = getConfig('diskname');
- else $diskname = $_SERVER['disktag'];
- $title .= ' - ' . $diskname;
- }
- $title .= ' - ' . $_SERVER['sitename'];
- $html = str_replace('', $title, $html);
-
- $keywords = $n_path;
- if ($p_path!='') $keywords .= ', ' . $p_path;
- if ($_SERVER['sitename']!='OneManager') $keywords .= ', ' . $_SERVER['sitename'] . ', OneManager';
- else $keywords .= ', OneManager';
- $html = str_replace('', $keywords, $html);
-
- if ($_GET['preview']) {
- $description = $n_path.', '.getconstStr('Preview');//'Preview of '.
- } elseif (isset($files['folder'])) {
- $description = $n_path.', '.getconstStr('List');//'List of '.$n_path.'. ';
- }
- //$description .= 'In '.$_SERVER['sitename'];
- $html = str_replace('', $description, $html);
-
- while (strpos($html, '')) $html = str_replace('', (substr($_SERVER['base_disk_path'],-1)=='/'?substr($_SERVER['base_disk_path'],0,-1):$_SERVER['base_disk_path']), $html);
- while (strpos($html, '')) $html = str_replace('', $_SERVER['base_path'], $html);
- while (strpos($html, '')) $html = str_replace('', str_replace('%23', '#', str_replace('&','&', path_format($path.'/'))), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Home'), $html);
-
- $html = str_replace('', getConfig('customCss'), $html);
- $html = str_replace('', getConfig('customScript'), $html);
-
- while (strpos($html, '')) $html = str_replace('', getconstStr('Login'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Close'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('InputPassword'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('InputPasswordUWant'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Submit'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Success'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('GetUploadLink'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UpFileTooLarge'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadStart'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadStartAt'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('LastUpload'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('ThisTime'), $html);
-
- while (strpos($html, '')) $html = str_replace('', getconstStr('Upload'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('AverageSpeed'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('CurrentSpeed'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('Expect'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadErrorUpAgain'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('EndAt'), $html);
-
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadComplete'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('CopyUrl'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFail23'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('GetFileNameFail'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFile'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFolder'), $html);
- while (strpos($html, '')) $html = str_replace('', getconstStr('FileSelected'), $html);
- while (strpos($html, '')) $html = str_replace('', (isset($_GET['preview'])?'?preview&':'?'), $html);
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (getConfig('background')) {
- $background = str_replace('', getConfig('background'), $tmp[0]);
- }
- $html .= $background . $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $PathArrayStr = $tmp[0];
- $tmp_path = str_replace('%23', '#', str_replace('&','&', $path));
- $tmp_url = $_SERVER['base_disk_path'];
- while ($tmp_path!='') {
- $tmp1 = splitfirst($tmp_path, '/');
- $folder1 = $tmp1[0];
- if ($folder1!='') {
- $tmp_url .= $folder1 . '/';
- $PathArrayStr1 = str_replace('', ($folder1==$files['name']?'':$tmp_url), $PathArrayStr);
- $PathArrayStr1 = str_replace('', $folder1, $PathArrayStr1);
- $html .= $PathArrayStr1;
- }
- $tmp_path = $tmp1[1];
- }
- $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $SelectLanguage = $tmp[0];
- foreach ($constStr['languages'] as $key1 => $value1) {
- $SelectLanguageStr = str_replace('', $key1, $SelectLanguage);
- $SelectLanguageStr = str_replace('', $value1, $SelectLanguageStr);
- $SelectLanguageStr = str_replace('', ($key1==$constStr['language']?'selected="selected"':''), $SelectLanguageStr);
- $html .= $SelectLanguageStr;
- }
- $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $NeedUpdateStr = $tmp[0];
- if (isset($_SERVER['needUpdate'])&&$_SERVER['needUpdate']) $NeedUpdateStr = str_replace('', getconstStr('NeedUpdate'), $NeedUpdateStr);
- else $NeedUpdateStr ='';
- $html .= $NeedUpdateStr . $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if ($path !== '/') {
- $current_url = $_SERVER['PHP_SELF'];
- while (substr($current_url, -1) === '/') {
- $current_url = substr($current_url, 0, -1);
- }
- if (strpos($current_url, '/') !== FALSE) {
- $parent_url = substr($current_url, 0, strrpos($current_url, '/'));
- } else {
- $parent_url = $current_url;
- }
- $BackArrow = str_replace('', $parent_url.'/', $tmp[0]);
- }
- $html .= $BackArrow . $tmp[1];
-
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- //if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) {
- if (!getConfig('disableShowThumb')) {
- $html .= str_replace('', getconstStr('OriginalPic'), $tmp[0]) . $tmp[1];
- } else $html .= $tmp[1];
- }
- $imgextstr = '';
- foreach ($exts['img'] as $imgext) $imgextstr .= '\''.$imgext.'\', ';
- $html = str_replace('', $imgextstr, $html);
-
-
- $html = str_replace('', $_SERVER['sitename'], $html);
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $disktags = explode("|",getConfig('disktag'));
- if (count($disktags)>1) {
- $tmp1 = $tmp[1];
- $tmp = splitfirst($tmp[0], '');
- $MultiDiskArea = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $MultiDisks = $tmp[0];
- foreach ($disktags as $disk) {
- $diskname = getConfig('diskname', $disk);
- if ($diskname=='') $diskname = $disk;
- $MultiDisksStr = str_replace('', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
- $MultiDisksStr = str_replace('', ($_SERVER['disktag']==$disk?' now':''), $MultiDisksStr);
- $MultiDisksStr = str_replace('', $diskname, $MultiDisksStr);
- $MultiDiskArea .= $MultiDisksStr;
- }
- $MultiDiskArea .= $tmp[1];
- $tmp[1] = $tmp1;
- }
- $html .= $MultiDiskArea . $tmp[1];
- $diskname = getConfig('diskname');
- if ($diskname=='') $diskname = $_SERVER['disktag'];
- //if (strlen($diskname)>15) $diskname = substr($diskname, 0, 12).'...';
- while (strpos($html, '')) $html = str_replace('', $diskname, $html);
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (isset($files['children']['head.omf'])) {
- $headomf = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/head.omf'),'/'))['content']['body'], $tmp[0]);
- }
- $html .= $headomf . $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (isset($files['children']['head.md'])) {
- $headmd = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/head.md'),'/'))['content']['body'], $tmp[0]);
- $html .= $headmd . $tmp[1];
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- } else {
- $html .= $tmp[1];
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
-
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html_aft = $tmp[1];
- if ($files) {
- $listarea = $tmp[0];
- }
- $html .= $listarea . $html_aft;
- }
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (isset($files['children']['readme.md'])) {
- $Readmemd = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/readme.md'),'/'))['content']['body'], $tmp[0]);
- $html .= $Readmemd . $tmp[1];
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
- } else {
- $html .= $tmp[1];
- $tmp[1] = 'a';
- while ($tmp[1]!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- }
-
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (isset($files['children']['foot.omf'])) {
- $Footomf = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/foot.omf'),'/'))['content']['body'], $tmp[0]);
- }
- $html .= $Footomf . $tmp[1];
-
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (isset($files['children']['head.md'])||isset($files['children']['readme.md'])) {
- $html .= $tmp[0] . $tmp[1];
- } else $html .= $tmp[1];
-
- if (getConfig('passfile')!='') {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= str_replace('', getconstStr('Encrypt'), $tmp[0]) . $tmp[1];
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- } else {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= str_replace('', getconstStr('SetpassfileBfEncrypt'), $tmp[0]) . $tmp[1];
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if ($path != '/') {
- $html .= str_replace('', getconstStr('ParentDir'), $tmp[0]) . $tmp[1];
- } else $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $MoveDirs = $tmp[0];
- if (isset($files['children'])) {
- foreach ($files['children'] as $file) {
- if (isset($file['folder'])) {
- $MoveDirsStr = str_replace('', str_replace('&','&', $file['name']), $MoveDirs);
- $MoveDirsStr = str_replace('', str_replace('&','&', $file['name']), $MoveDirsStr);
- $html .= $MoveDirsStr;
- }
- }
- }
- $html .= $tmp[1];
-
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- if (!isset($_COOKIE['timezone'])) $html .= str_replace('', $_SERVER['timezone'], $tmp[0]);
- $html .= $tmp[1];
- while (strpos($html, '')) $html = str_replace('', $_SERVER['timezone'], $html);
-
- while (strpos($html, '{{.RawData}}')) {
- $str = '[';
- $i = 0;
- foreach ($files['children'] as $file) if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $tmp = [];
- $tmp['name'] = $file['name'];
- $tmp['size'] = size_format($file['size']);
- $tmp['date'] = time_format($file['lastModifiedDateTime']);
- $tmp['@time'] = $file['date'];
- $tmp['@type'] = isset($file['folder'])?'folder':'file';
- $str .= json_encode($tmp).',';
- }
- if ($str == '[') {
- $str = '';
- } else $str = substr($str, 0, -1).']';
- $html = str_replace('{{.RawData}}', base64_encode($str), $html);
- }
-
- // 最后清除换行
- while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html);
- //while (strpos($html, "\r\r")) $html = str_replace("\r\r", "\r", $html);
- while (strpos($html, "\n\n")) $html = str_replace("\n\n", "\n", $html);
- //while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html);
-
- $exetime = round(microtime(true)-$_SERVER['php_starttime'],3);
- $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runningtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html);
- }
-
- if ($_SERVER['admin']||!getConfig('disableChangeTheme')) {
- $theme_arr = scandir(__DIR__.'/theme');
- $html .= '
-
-
-
-';
- }
-
- $html = $authinfo . $html;
- if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
- return output($html,$statusCode);
-}
diff --git a/config.php b/config.php
deleted file mode 100644
index 4fe2ccb..0000000
--- a/config.php
+++ /dev/null
@@ -1,4 +0,0 @@
- [
- 'en-us' => 'English',
- 'zh-cn' => '简体中文',
- 'ja' => '日本語',
- 'ko-kr' => '한국어',
- 'fa' => 'فارسی',
- ],
- 'Week' => [
- 'en-us' => [
- 0 => 'Sunday',
- 1 => 'Monday',
- 2 => 'Tuesday',
- 3 => 'Wednesday',
- 4 => 'Thursday',
- 5 => 'Friday',
- 6 => 'Saturday',
- ],
- 'zh-cn' => [
- 0 => '星期日',
- 1 => '星期一',
- 2 => '星期二',
- 3 => '星期三',
- 4 => '星期四',
- 5 => '星期五',
- 6 => '星期六',
- ],
- 'ja' => [
- 0 => '日曜日',
- 1 => '月曜日',
- 2 => '火曜日',
- 3 => '水曜日',
- 4 => '木曜日',
- 5 => '金曜日',
- 6 => '土曜日',
- ],
- 'ko-kr' => [
- 0 => '일요일',
- 1 => '월요일',
- 2 => '화요일',
- 3 => '수요일',
- 4 => '목요일',
- 5 => '금요일',
- 6 => '토요일',
- ],
- 'fa' => [
- 0 => 'یکشنبه',
- 1 => 'دوشنبه',
- 2 => 'سه شنبه',
- 3 => 'چهارشنبه',
- 4 => 'پنج شنبه',
- 5 => 'جمعه',
- 6 => 'شنبه',
- ],
- ],
- 'EnvironmentsDescription' => [
- 'en-us' => [
- 'admin' => 'The admin password, Login button will not show when empty',
- 'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?admin\', it is \'?{this value}\'.',
- 'customScript' => '
- ', 'Program updating', 201);
- }
- return output('Jump
-
- ', 302);
- }
- if ($_GET['install1']) {
- //if ($_POST['admin']!='') {
- $tmp['timezone'] = $_COOKIE['timezone'];
- $AccessKeyID = getConfig('AccessKeyID');
- if ($AccessKeyID=='') {
- $AccessKeyID = $_POST['AccessKeyID'];
- $tmp['AccessKeyID'] = $AccessKeyID;
- }
- $AccessKeySecret = getConfig('AccessKeySecret');
- if ($AccessKeySecret=='') {
- $AccessKeySecret = $_POST['AccessKeySecret'];
- $tmp['AccessKeySecret'] = $AccessKeySecret;
- }
- $response = json_decode(SetbaseConfig($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], $AccessKeyID, $AccessKeySecret), true);
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- return message($html, $title, 201);
- } else {
- $html .= '
-
- ';
- $title = getconstStr('SetAdminPassword');
- return message($html, $title, 201);
- }
- //}
- }
- if ($_GET['install0']) {
- $html .= '
-
- ';
- $title = getconstStr('SelectLanguage');
- return message($html, $title, 201);
- }
- $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
- $title = 'Error';
- return message($html, $title, 201);
-}
-
-function getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
-{
- $fcClient = new Client([
- "endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
- "accessKeyID" => $AccessKeyID,
- "accessKeySecret" => $AccessKeySecret
- ]);
- return $fcClient->getFunction($service_name, $function_name);
-}
-
-function updateEnvironment($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
-{
- //print_r($Envs);
- $fcClient = new Client([
- "endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
- "accessKeyID" => $AccessKeyID,
- "accessKeySecret" => $AccessKeySecret
- ]);
- $tmp = $fcClient->getFunction($service_name, $function_name)['data'];
- //$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
- foreach ($tmp['environmentVariables'] as $key => $value ) {
- $tmp_env[$key] = $value;
- }
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- ksort($tmp_env);
-
- $tmpdata['functionName'] = $tmp['functionName'];
- $tmpdata['description'] = $tmp['description'];
- $tmpdata['memorySize'] = $tmp['memorySize'];
- $tmpdata['timeout'] = $tmp['timeout'];
- $tmpdata['runtime'] = $tmp['runtime'];
- $tmpdata['handler'] = $tmp['handler'];
- $tmpdata['environmentVariables'] = $tmp_env;
- $tmpdata['code']['zipFile'] = base64_encode( file_get_contents($fcClient->getFunctionCode($service_name, $function_name)['data']['url']) );
- return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
-}
-
-function SetbaseConfig($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
-{
- //echo json_encode($Envs,JSON_PRETTY_PRINT);
- $fcClient = new Client([
- "endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
- "accessKeyID" => $AccessKeyID,
- "accessKeySecret" => $AccessKeySecret
- ]);
- $tmp = $fcClient->getFunction($service_name, $function_name)['data'];
- // $tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
- foreach ($tmp['environmentVariables'] as $key => $value ) {
- $tmp_env[$key] = $value;
- }
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- ksort($tmp_env);
-
- $tmpdata['functionName'] = $function_name;
- $tmpdata['description'] = 'Onedrive index and manager in Ali FC.';
- $tmpdata['memorySize'] = 128;
- $tmpdata['timeout'] = 30;
- $tmpdata['runtime'] = 'php7.2';
- $tmpdata['handler'] = 'index.handler';
- $tmpdata['environmentVariables'] = $tmp_env;
- $tmpdata['code']['zipFile'] = base64_encode( file_get_contents($fcClient->getFunctionCode($service_name, $function_name)['data']['url']) );
- return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
-}
-
-function updateProgram($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret, $source)
-{
- //WaitSCFStat();
- $fcClient = new Client([
- "endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
- "accessKeyID" => $AccessKeyID,
- "accessKeySecret" => $AccessKeySecret
- ]);
- $tmp = $fcClient->getFunction($service_name, $function_name)['data'];
- //$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
-
- $tmpdata['functionName'] = $tmp['functionName'];
- $tmpdata['description'] = $tmp['description'];
- $tmpdata['memorySize'] = $tmp['memorySize'];
- $tmpdata['timeout'] = $tmp['timeout'];
- $tmpdata['runtime'] = $tmp['runtime'];
- $tmpdata['handler'] = $tmp['handler'];
- $tmpdata['environmentVariables'] = $tmp['environmentVariables'];
- $tmpdata['code']['zipFile'] = base64_encode( file_get_contents($source) );
-
- return $fcClient->updateFunction($service_name, $function_name, $tmpdata);
-}
-
-function api_error($response)
-{
- return !isset($response['data']);
-}
-
-function api_error_msg($response)
-{
- return $response;
- return $response['Error']['Code'] . '
-' . $response['Error']['Message'] . '
-function_name:' . $_SERVER['function_name'] . '
-Region:' . $_SERVER['Region'] . '
-namespace:' . $_SERVER['namespace'] . '
-';
-}
-
-function setConfigResponse($response)
-{
- return $response;
-}
-
-function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
-{
- $source = '/tmp/code.zip';
- $outPath = '/tmp/';
-
- // 从github下载对应tar.gz,并解压
- $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
- $tarfile = '/tmp/github.tar.gz';
- file_put_contents($tarfile, file_get_contents($url));
- $phar = new PharData($tarfile);
- $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
-
- // 获取解压出的目录名
-/*
- @ob_start();
- passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
- $html.='状态:' . $stat . '
- 结果:
- ';
- $archivefolder = ob_get_clean();
- if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
- $outPath .= $archivefolder;
- $html.=htmlspecialchars($archivefolder);
- //return $html;
-*/
- $tmp = scandir($outPath);
- $name = $auth.'-'.$project;
- foreach ($tmp as $f) {
- if ( substr($f, 0, strlen($name)) == $name) {
- $outPath .= $f;
- break;
- }
- }
-
- // 将目录中文件打包成zip
- $zip=new ZipArchive();
- if($zip->open($source, ZipArchive::CREATE)){
- addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
- $zip->close(); //关闭处理的zip文件
- }
-
- return updateProgram($_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], getConfig('AccessKeyID'), getConfig('AccessKeySecret'), $source);
-}
-
-function addFileToZip($zip, $rootpath, $path = '')
-{
- if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
- if (substr($path,0,1)=='/') $path = substr($path, 1);
- $handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
- while($filename=readdir($handler)){
- if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
- $nowname = path_format($rootpath.'/'.$path."/".$filename);
- if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
- addFileToZip($zip, $rootpath, $path."/".$filename);
- }else{ //将文件加入zip对象
- $zip->addFile($nowname);
- $newname = $path."/".$filename;
- if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
- $zip->renameName($nowname, $newname);
- }
- }
- }
- @closedir($path);
-}
diff --git a/platform/HuaweiFG.php b/platform/HuaweiFG.php
deleted file mode 100644
index ea14f7c..0000000
--- a/platform/HuaweiFG.php
+++ /dev/null
@@ -1,743 +0,0 @@
-geteventID();
- $tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
- $tmp['AccessKey'] = $context->getAccessKey();
- $tmp['SecretKey'] = $context->getSecretKey();
- $tmp['UserData']['HW_urn'] = $context->getUserData('HW_urn');
- $tmp['FunctionName'] = $context->getFunctionName();
- $tmp['RunningTimeInSeconds'] = $context->getRunningTimeInSeconds();
- $tmp['Version'] = $context->getVersion();
- $tmp['MemorySize'] = $context->getMemorySize();
- $tmp['CPUNumber'] = $context->getCPUNumber();
- $tmp['ProjectID'] = $context->getProjectID();
- $tmp['Package'] = $context->Package();
- $tmp['Token'] = $context->getToken();
- $tmp['Logger'] = $context->getLogger();
-
- if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
- echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
-
-' . urldecode(json_encode($tmp, JSON_PRETTY_PRINT)) . '
-
-';
-}
-
-function GetGlobalVariable($event)
-{
- $_GET = $event['queryStringParameters'];
- $postbody = explode("&",$event['body']);
- foreach ($postbody as $postvalues) {
- $pos = strpos($postvalues,"=");
- $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
- }
- $cookiebody = explode("; ",$event['headers']['cookie']);
- foreach ($cookiebody as $cookievalues) {
- $pos = strpos($cookievalues,"=");
- $_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
- }
- $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
- $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
- $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
-}
-
-function GetPathSetting($event, $context)
-{
- $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]);
- $_SERVER['function_name'] = $context->getFunctionName();
- $_SERVER['ProjectID'] = $context->getProjectID();
- $host_name = $event['headers']['host'];
- $_SERVER['HTTP_HOST'] = $host_name;
- $path = path_format($event['pathParameters'][''].'/');
- $_SERVER['base_path'] = path_format($event['path'].'/');
- if ( $_SERVER['base_path'] == $path ) {
- $_SERVER['base_path'] = '/';
- } else {
- $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path));
- if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
- }
- if (substr($path,-1)=='/') $path=substr($path,0,-1);
- $_SERVER['is_guestup_path'] = is_guestup_path($path);
- $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
- $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
- $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
- return $path;
-}
-
-function getConfig($str, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- global $contextUserData;
- if (in_array($str, $InnerEnv)) {
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $env = json_decode($contextUserData->getUserData($disktag), true);
- if (isset($env[$str])) {
- if (in_array($str, $Base64Env)) return equal_replace($env[$str],1);
- else return $env[$str];
- }
- } else {
- if (in_array($str, $Base64Env)) return equal_replace($contextUserData->getUserData($str),1);
- else return $contextUserData->getUserData($str);
- }
- return '';
-}
-
-function setConfig($arr, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- global $contextUserData;
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $disktags = explode("|",getConfig('disktag'));
- $diskconfig = json_decode($contextUserData->getUserData($disktag), true);
- $tmp = [];
- $indisk = 0;
- $oparetdisk = 0;
- foreach ($arr as $k => $v) {
- if (in_array($k, $InnerEnv)) {
- if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v);
- else $diskconfig[$k] = $v;
- $indisk = 1;
- } elseif ($k=='disktag_add') {
- array_push($disktags, $v);
- $oparetdisk = 1;
- } elseif ($k=='disktag_del') {
- $disktags = array_diff($disktags, [ $v ]);
- $tmp[$v] = '';
- $oparetdisk = 1;
- } else {
- if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v);
- else $tmp[$k] = $v;
- }
- }
- if ($indisk) {
- $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
- ksort($diskconfig);
- $tmp[$disktag] = json_encode($diskconfig);
- }
- if ($oparetdisk) {
- $disktags = array_unique($disktags);
- foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
- if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
- else $tmp['disktag'] = '';
- }
-// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
-//';
- $response = updateEnvironment($tmp, getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'));
- // WaitSCFStat();
- return $response;
-}
-
-function WaitSCFStat()
-{
- $trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
-'.++$trynum;
-}
-
-function install()
-{
- global $constStr;
- if ($_GET['install2']) {
- $tmp['admin'] = $_POST['admin'];
- setConfig($tmp);
- if (needUpdate()) {
- OnekeyUpate();
- return message('update to github version, reinstall.
-
- ', 'Program updating', 201);
- }
- return output('Jump
-
- ', 302);
- }
- if ($_GET['install1']) {
- //if ($_POST['admin']!='') {
- $tmp['timezone'] = $_COOKIE['timezone'];
- $tmp['HW_urn'] = getConfig('HW_urn');
- if ($tmp['HW_urn']=='') {
- $tmp['HW_urn'] = $_POST['HW_urn'];
- }
- $tmp['HW_key'] = getConfig('HW_key');
- if ($tmp['HW_key']=='') {
- $tmp['HW_key'] = $_POST['HW_key'];
- }
- $tmp['HW_secret'] = getConfig('HW_secret');
- if ($tmp['HW_secret']=='') {
- $tmp['HW_secret'] = $_POST['HW_secret'];
- }
- //$response = json_decode(SetbaseConfig($tmp, $HW_urn, $HW_name, $HW_pwd), true)['Response'];
- $response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- return message($html, $title, 201);
- } else {
- $html .= '
-
- ';
- $title = getconstStr('SetAdminPassword');
- return message($html, $title, 201);
- }
- //}
- }
- if ($_GET['install0']) {
- $html .= '
-
- ';
- $title = getconstStr('SelectLanguage');
- return message($html, $title, 201);
- }
- $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
- $title = 'Error';
- return message($html, $title, 201);
-}
-
-function getfunctioninfo($HW_urn, $HW_key, $HW_secret)
-{
- $URN = explode(':', $HW_urn);
- $Region = $URN[2];
- $project_id = $URN[3];
- $url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
- $signer = new Signer();
- $signer->Key = $HW_key;
- $signer->Secret = $HW_secret;
- $req = new Request('GET', $url);
- $req->headers = array(
- 'content-type' => 'application/json;charset=utf8',
- );
- $req->body = '';
- $curl = $signer->Sign($req);
- $response = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- curl_close($curl);
- return $response;
-}
-
-
-function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
-{
- //echo json_encode($Envs,JSON_PRETTY_PRINT);
- global $contextUserData;
- $tmp_env = json_decode(json_decode(getfunctioninfo($HW_urn, $HW_key, $HW_secret),true)['user_data'],true);
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- ksort($tmp_env);
-
- $URN = explode(':', $HW_urn);
- $Region = $URN[2];
- $project_id = $URN[3];
- $url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
- $signer = new Signer();
- $signer->Key = $HW_key;
- $signer->Secret = $HW_secret;
- $req = new Request('PUT', $url);
- $req->headers = array(
- 'content-type' => 'application/json;charset=utf8',
- );
- $tmpdata['handler'] = 'index.handler';
- $tmpdata['memory_size'] = $contextUserData->getMemorySize()+1-1;
- $tmpdata['runtime'] = 'PHP7.3';
- $tmpdata['timeout'] = $contextUserData->getRunningTimeInSeconds()+1-1;
- $tmpdata['user_data'] = json_encode($tmp_env);
- $req->body = json_encode($tmpdata);
- $curl = $signer->Sign($req);
- $response = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- curl_close($curl);
- return $response;
-}
-
-function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
-{
- //echo json_encode($Envs,JSON_PRETTY_PRINT);
- $tmp_env = json_decode(json_decode(getfunctioninfo($HW_urn, $HW_key, $HW_secret),true)['user_data'],true);
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- ksort($tmp_env);
-
- // https://functiongraph.cn-north-4.myhuaweicloud.com/v2/{project_id}/fgs/functions/{function_urn}/config
- $URN = explode(':', $HW_urn);
- $Region = $URN[2];
- $project_id = $URN[3];
- $url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/config';
- $signer = new Signer();
- $signer->Key = $HW_key;
- $signer->Secret = $HW_secret;
- $req = new Request('PUT', $url);
- $req->headers = array(
- 'content-type' => 'application/json;charset=utf8',
- );
- $tmpdata['handler'] = 'index.handler';
- $tmpdata['memory_size'] = 128;
- $tmpdata['runtime'] = 'PHP7.3';
- $tmpdata['timeout'] = 30;
- $tmpdata['user_data'] = json_encode($tmp_env);
- $req->body = json_encode($tmpdata);
- $curl = $signer->Sign($req);
- $response = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- curl_close($curl);
- return $response;
-}
-
-function updateProgram($HW_urn, $HW_key, $HW_secret, $source)
-{
- $URN = explode(':', $HW_urn);
- $Region = $URN[2];
- $project_id = $URN[3];
- $url = 'https://functiongraph.' . $Region . '.myhuaweicloud.com/v2/' . $project_id . '/fgs/functions/' . $HW_urn . '/code';
- $signer = new Signer();
- $signer->Key = $HW_key;
- $signer->Secret = $HW_secret;
- $req = new Request('PUT', $url);
- $req->headers = array(
- 'content-type' => 'application/json;charset=utf8',
- );
- $tmpdata['code_type'] = 'zip';
- $tmpdata['func_code']['file'] = base64_encode( file_get_contents($source) );
- $req->body = json_encode($tmpdata);
- $curl = $signer->Sign($req);
- $response = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- curl_close($curl);
- return $response;
-}
-
-function api_error($response)
-{
- return isset($response['error_code']);
-}
-
-function api_error_msg($response)
-{
- return $response['error_code'] . '
-' . $response['error_msg'] . '
-request_id: ' . $response['request_id'] . '
-function_name: ' . $_SERVER['function_name'] . '
-';
-}
-
-function setConfigResponse($response)
-{
- return json_decode( $response, true );
-}
-
-function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
-{
- $source = '/tmp/code.zip';
- $outPath = '/tmp/';
-
- // 从github下载对应tar.gz,并解压
- $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
- $tarfile = '/tmp/github.tar.gz';
- file_put_contents($tarfile, file_get_contents($url));
- $phar = new PharData($tarfile);
- $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
-
- // 获取解压出的目录名
-/*
- @ob_start();
- passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
- $html.='状态:' . $stat . '
- 结果:
- ';
- $archivefolder = ob_get_clean();
- if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
- $outPath .= $archivefolder;
- $html.=htmlspecialchars($archivefolder);
- //return $html;
-*/
- $tmp = scandir($outPath);
- $name = $auth.'-'.$project;
- foreach ($tmp as $f) {
- if ( substr($f, 0, strlen($name)) == $name) {
- $outPath .= $f;
- break;
- }
- }
-
- // 将目录中文件打包成zip
- //$zip=new ZipArchive();
- $zip=new PharData($source);
- //if($zip->open($source, ZipArchive::CREATE)){
- addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
- // $zip->close(); //关闭处理的zip文件
- //}
-
- return updateProgram(getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'), $source);
-}
-
-function addFileToZip($zip, $rootpath, $path = '')
-{
- if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
- if (substr($path,0,1)=='/') $path = substr($path, 1);
- $handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
- while($filename=readdir($handler)){
- if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
- $nowname = path_format($rootpath.'/'.$path."/".$filename);
- if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
- $zip->addEmptyDir($path."/".$filename);
- addFileToZip($zip, $rootpath, $path."/".$filename);
- }else{ //将文件加入zip对象
- $newname = $path."/".$filename;
- if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
- $zip->addFile($nowname, $newname);
- //$zip->renameName($nowname, $newname);
- }
- }
- }
- @closedir($path);
-}
-
-
-
-
-
-
-
-
-define("BasicDateFormat", "Ymd\THis\Z");
-define("Algorithm", "SDK-HMAC-SHA256");
-define("HeaderXDate", "X-Sdk-Date");
-define("HeaderHost", "host");
-define("HeaderAuthorization", "Authorization");
-define("HeaderContentSha256", "X-Sdk-Content-Sha256");
-
-class Request
-{
- public $method = '';
- public $scheme = '';
- public $host = '';
- public $uri = '';
- public $query = array();
- public $headers = array();
- public $body = '';
-
- function __construct()
- {
- $args = func_get_args();
- $i = count($args);
- if ($i == 0) {
- $this->construct(NULL, NULL, NULL, NULL);
- } elseif ($i == 1) {
- $this->construct($args[0], NULL, NULL, NULL);
- } elseif ($i == 2) {
- $this->construct($args[0], $args[1], NULL, NULL);
- } elseif ($i == 3) {
- $this->construct($args[0], $args[1], $args[2], NULL);
- } else {
- $this->construct($args[0], $args[1], $args[2], $args[3]);
- }
- }
-
- function construct($method, $url, $headers, $body)
- {
- if ($method != NULL) {
- $this->method = $method;
- }
- if ($url != NULL) {
- $spl = explode("://", $url, 2);
- $scheme = 'http';
- if (count($spl) > 1) {
- $scheme = $spl[0];
- $url = $spl[1];
- }
- $spl = explode("?", $url, 2);
- $url = $spl[0];
- $query = array();
- if (count($spl) > 1) {
- foreach (explode("&", $spl[1]) as $kv) {
- $spl = explode("=", $kv, 2);
- $key = $spl[0];
- if (count($spl) == 1) {
- $value = "";
- } else {
- $value = $spl[1];
- }
- if ($key != "") {
- $key = urldecode($key);
- $value = urldecode($value);
- if (array_key_exists($key, $query)) {
- array_push($query[$key], $value);
- } else {
- $query[$key] = array($value);
- }
- }
- }
- }
- $spl = explode("/", $url, 2);
- $host = $spl[0];
- if (count($spl) == 1) {
- $url = "/";
- } else {
- $url = "/" . $spl[1];
- }
- $this->scheme = $scheme;
- $this->host = $host;
- $this->uri = urldecode($url);
- $this->query = $query;
- }
- if ($headers != NULL) {
- $this->headers = $headers;
- }
- if ($body != NULL) {
- $this->body = $body;
- }
- }
-}
-
-class Signer
-{
- public $Key = '';
- public $Secret = '';
-
- function escape($string)
- {
- $entities = array('+', "%7E");
- $replacements = array('%20', "~");
- return str_replace($entities, $replacements, urlencode($string));
- }
-
- function findHeader($r, $header)
- {
- foreach ($r->headers as $key => $value) {
- if (!strcasecmp($key, $header)) {
- return $value;
- }
- }
- return NULL;
- }
-
-// Build a CanonicalRequest from a regular request string
-//
-// CanonicalRequest =
-// HTTPRequestMethod + '\n' +
-// CanonicalURI + '\n' +
-// CanonicalQueryString + '\n' +
-// CanonicalHeaders + '\n' +
-// SignedHeaders + '\n' +
-// HexEncode(Hash(RequestPayload))
- function CanonicalRequest($r, $signedHeaders)
- {
- $CanonicalURI = $this->CanonicalURI($r);
- $CanonicalQueryString = $this->CanonicalQueryString($r);
- $canonicalHeaders = $this->CanonicalHeaders($r, $signedHeaders);
- $signedHeadersString = join(";", $signedHeaders);
- $hash = $this->findHeader($r, HeaderContentSha256);
- if (!$hash) {
- $hash = hash("sha256", $r->body);
- }
- return "$r->method\n$CanonicalURI\n$CanonicalQueryString\n$canonicalHeaders\n$signedHeadersString\n$hash";
- }
-
-// CanonicalURI returns request uri
- function CanonicalURI($r)
- {
- $pattens = explode("/", $r->uri);
- $uri = array();
- foreach ($pattens as $v) {
- array_push($uri, $this->escape($v));
- }
- $urlpath = join("/", $uri);
- if (substr($urlpath, -1) != "/") {
- $urlpath = $urlpath . "/";
- }
- return $urlpath;
- }
-
-// CanonicalQueryString
- function CanonicalQueryString($r)
- {
- $keys = array();
- foreach ($r->query as $key => $value) {
- array_push($keys, $key);
- }
- sort($keys);
- $a = array();
- foreach ($keys as $key) {
- $k = $this->escape($key);
- $value = $r->query[$key];
- if (is_array($value)) {
- sort($value);
- foreach ($value as $v) {
- $kv = "$k=" . $this->escape($v);
- array_push($a, $kv);
- }
- } else {
- $kv = "$k=" . $this->escape($value);
- array_push($a, $kv);
- }
- }
- return join("&", $a);
- }
-
-// CanonicalHeaders
- function CanonicalHeaders($r, $signedHeaders)
- {
- $headers = array();
- foreach ($r->headers as $key => $value) {
- $headers[strtolower($key)] = trim($value);
- }
- $a = array();
- foreach ($signedHeaders as $key) {
- array_push($a, $key . ':' . $headers[$key]);
- }
- return join("\n", $a) . "\n";
- }
-
- function curlHeaders($r)
- {
- $header = array();
- foreach ($r->headers as $key => $value) {
- array_push($header, strtolower($key) . ':' . trim($value));
- }
- return $header;
- }
-
-// SignedHeaders
- function SignedHeaders($r)
- {
- $a = array();
- foreach ($r->headers as $key => $value) {
- array_push($a, strtolower($key));
- }
- sort($a);
- return $a;
- }
-
-// Create a "String to Sign".
- function StringToSign($canonicalRequest, $t)
- {
- date_default_timezone_set('UTC');
- $date = date(BasicDateFormat, $t);
- $hash = hash("sha256", $canonicalRequest);
- return "SDK-HMAC-SHA256\n$date\n$hash";
- }
-
-// Create the HWS Signature.
- function SignStringToSign($stringToSign, $signingKey)
- {
- return hash_hmac("sha256", $stringToSign, $signingKey);
- }
-
-// Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign
- function AuthHeaderValue($signature, $accessKey, $signedHeaders)
- {
- $signedHeadersString = join(";", $signedHeaders);
- return "SDK-HMAC-SHA256 Access=$accessKey, SignedHeaders=$signedHeadersString, Signature=$signature";
- }
-
- public function Sign($r)
- {
- date_default_timezone_set('UTC');
- $date = $this->findHeader($r, HeaderXDate);
- if ($date) {
- $t = date_timestamp_get(date_create_from_format(BasicDateFormat, $date));
- }
- if (!@$t) {
- $t = time();
- $r->headers[HeaderXDate] = date(BasicDateFormat, $t);
- }
- $queryString = $this->CanonicalQueryString($r);
- if ($queryString != "") {
- $queryString = "?" . $queryString;
- }
- $signedHeaders = $this->SignedHeaders($r);
- $canonicalRequest = $this->CanonicalRequest($r, $signedHeaders);
- $stringToSign = $this->StringToSign($canonicalRequest, $t);
- $signature = $this->SignStringToSign($stringToSign, $this->Secret);
- $authValue = $this->AuthHeaderValue($signature, $this->Key, $signedHeaders);
- $r->headers[HeaderAuthorization] = $authValue;
-
- $curl = curl_init();
- $uri = str_replace(array("%2F"), array("/"), rawurlencode($r->uri));
- $url = $r->scheme . '://' . $r->host . $uri . $queryString;
- $headers = $this->curlHeaders($r);
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $r->method);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $r->body);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($curl, CURLOPT_NOBODY, FALSE);
- return $curl;
- }
-}
diff --git a/platform/TencentSCF.php b/platform/TencentSCF.php
deleted file mode 100644
index cbeb8da..0000000
--- a/platform/TencentSCF.php
+++ /dev/null
@@ -1,448 +0,0 @@
-500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
- echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
-
-' . urldecode(json_encode($context, JSON_PRETTY_PRINT)) . '
-
-';
-}
-
-function GetGlobalVariable($event)
-{
- $_GET = $event['queryString'];
- $postbody = explode("&",$event['body']);
- foreach ($postbody as $postvalues) {
- $pos = strpos($postvalues,"=");
- $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
- }
- $cookiebody = explode("; ",$event['headers']['cookie']);
- foreach ($cookiebody as $cookievalues) {
- $pos = strpos($cookievalues,"=");
- $_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
- }
- $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
- $_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
- $_SERVER['USER'] = 'qcloud';
-}
-
-function GetPathSetting($event, $context)
-{
- $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]);
- $_SERVER['function_name'] = $context['function_name'];
- $_SERVER['namespace'] = $context['namespace'];
- $host_name = $event['headers']['host'];
- $_SERVER['HTTP_HOST'] = $host_name;
- $serviceId = $event['requestContext']['serviceId'];
- if ( $serviceId === substr($host_name,0,strlen($serviceId)) ) {
- $_SERVER['base_path'] = '/'.$event['requestContext']['stage'].'/'.$_SERVER['function_name'].'/';
- $_SERVER['Region'] = getenv('Region');
- if ($_SERVER['Region'] == '') {
- $_SERVER['Region'] = substr($host_name, strpos($host_name, '.')+1);
- $_SERVER['Region'] = substr($_SERVER['Region'], 0, strpos($_SERVER['Region'], '.'));
- }
- $path = substr($event['path'], strlen('/'.$_SERVER['function_name'].'/'));
- } else {
- $_SERVER['base_path'] = $event['requestContext']['path'];
- $_SERVER['Region'] = getenv('Region');
- $path = substr($event['path'], strlen($event['requestContext']['path']));
- }
- if (substr($path,-1)=='/') $path=substr($path,0,-1);
- $_SERVER['is_guestup_path'] = is_guestup_path($path);
- $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
- $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
- $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
- return $path;
-}
-
-function getConfig($str, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- if (in_array($str, $InnerEnv)) {
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $env = json_decode(getenv($disktag), true);
- if (isset($env[$str])) {
- if (in_array($str, $Base64Env)) return equal_replace($env[$str],1);
- else return $env[$str];
- }
- } else {
- if (in_array($str, $Base64Env)) return equal_replace(getenv($str),1);
- else return getenv($str);
- }
- return '';
-}
-
-function setConfig($arr, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $disktags = explode("|",getConfig('disktag'));
- $diskconfig = json_decode(getenv($disktag), true);
- $tmp = [];
- $indisk = 0;
- $oparetdisk = 0;
- foreach ($arr as $k => $v) {
- if (in_array($k, $InnerEnv)) {
- if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v);
- else $diskconfig[$k] = $v;
- $indisk = 1;
- } elseif ($k=='disktag_add') {
- array_push($disktags, $v);
- $oparetdisk = 1;
- } elseif ($k=='disktag_del') {
- $disktags = array_diff($disktags, [ $v ]);
- $tmp[$v] = '';
- $oparetdisk = 1;
- } else {
- if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v);
- else $tmp[$k] = $v;
- }
- }
- if ($indisk) {
- $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
- ksort($diskconfig);
- $tmp[$disktag] = json_encode($diskconfig);
- }
- if ($oparetdisk) {
- $disktags = array_unique($disktags);
- foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
- if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
- else $tmp['disktag'] = '';
- }
-// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
-//';
- $response = updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
- WaitSCFStat();
- return $response;
-}
-
-function WaitSCFStat()
-{
- $trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
-'.++$trynum;
-}
-
-function install()
-{
- global $constStr;
- if ($_GET['install2']) {
- $tmp['admin'] = $_POST['admin'];
- setConfig($tmp);
- if (needUpdate()) {
- OnekeyUpate();
- return message('update to github version, reinstall.
-
- ', 'Program updating', 201);
- }
- return output('Jump
-
- ', 302);
- }
- if ($_GET['install1']) {
- //if ($_POST['admin']!='') {
- //$tmp['language'] = $_POST['language'];
- $tmp['Region'] = $_POST['Region'];
- $tmp['timezone'] = $_COOKIE['timezone'];
- $SecretId = getConfig('SecretId');
- if ($SecretId=='') {
- $SecretId = $_POST['SecretId'];
- $tmp['SecretId'] = $SecretId;
- }
- $SecretKey = getConfig('SecretKey');
- if ($SecretKey=='') {
- $SecretKey = $_POST['SecretKey'];
- $tmp['SecretKey'] = $SecretKey;
- }
- $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_POST['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response'];
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- return message($html, $title, 201);
- } else {
- $html .= '
-
- ';
- $title = getconstStr('SetAdminPassword');
- return message($html, $title, 201);
- }
- //}
- }
- if ($_GET['install0']) {
- $html .= '
-
- ';
- $title = getconstStr('SelectLanguage');
- return message($html, $title, 201);
- }
- $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
- $title = 'Error';
- return message($html, $title, 201);
-}
-
-function post2url($url, $data)
-{
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- $response = curl_exec($ch);
- curl_close($ch);
- //echo $response;
- return $response;
-}
-
-function ReorganizeDate($arr)
-{
- $str = '';
- ksort($arr);
- foreach ($arr as $k1 => $v1) {
- $str .= '&' . $k1 . '=' . $v1;
- }
- $str = substr($str, 1); // remove first '&'. 去掉第一个&
- return $str;
-}
-
-function getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey)
-{
- //$meth = 'GET';
- $meth = 'POST';
- $host = 'scf.tencentcloudapi.com';
- $tmpdata['Action'] = 'GetFunction';
- $tmpdata['FunctionName'] = $function_name;
- $tmpdata['Namespace'] = $Namespace;
- $tmpdata['Nonce'] = time();
- $tmpdata['Region'] = $Region;
- $tmpdata['SecretId'] = $SecretId;
- $tmpdata['Timestamp'] = time();
- $tmpdata['Token'] = '';
- $tmpdata['Version'] = '2018-04-16';
- $data = ReorganizeDate($tmpdata);
- $signStr = base64_encode(hash_hmac('sha1', $meth.$host.'/?'.$data, $SecretKey, true));
- //echo urlencode($signStr);
- //return file_get_contents('https://'.$url.'&Signature='.urlencode($signStr));
- return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
-}
-
-function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId, $SecretKey)
-{
- //print_r($Envs);
- WaitSCFStat();
- //json_decode($a,true)['Response']['Environment']['Variables'][0]['Key']
- $tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
- foreach ($tmp as $tmp1) {
- $tmp_env[$tmp1['Key']] = $tmp1['Value'];
- }
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- $tmp_env['Region'] = $Region;
- ksort($tmp_env);
-
- $i = 0;
- foreach ($tmp_env as $key1 => $value1) {
- $tmpdata['Environment.Variables.'.$i.'.Key'] = $key1;
- $tmpdata['Environment.Variables.'.$i.'.Value'] = $value1;
- $i++;
- }
- $meth = 'POST';
- $host = 'scf.tencentcloudapi.com';
- $tmpdata['Action'] = 'UpdateFunctionConfiguration';
- $tmpdata['FunctionName'] = $function_name;
- $tmpdata['Namespace'] = $Namespace;
- $tmpdata['Nonce'] = time();
- $tmpdata['Region'] = $Region;
- $tmpdata['SecretId'] = $SecretId;
- $tmpdata['Timestamp'] = time();
- $tmpdata['Token'] = '';
- $tmpdata['Version'] = '2018-04-16';
- $data = ReorganizeDate($tmpdata);
- $signStr = base64_encode(hash_hmac('sha1', $meth.$host.'/?'.$data, $SecretKey, true));
- //echo urlencode($signStr);
- return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
-}
-
-function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $SecretKey)
-{
- echo json_encode($Envs,JSON_PRETTY_PRINT);
- /*$trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
-'.++$trynum;*/
- //json_decode($a,true)['Response']['Environment']['Variables'][0]['Key']
- $tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
- foreach ($tmp as $tmp1) {
- $tmp_env[$tmp1['Key']] = $tmp1['Value'];
- }
- foreach ($Envs as $key1 => $value1) {
- $tmp_env[$key1] = $value1;
- }
- $tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
- $tmp_env['Region'] = $Region;
- ksort($tmp_env);
-
- $i = 0;
- foreach ($tmp_env as $key1 => $value1) {
- $tmpdata['Environment.Variables.'.$i.'.Key'] = $key1;
- $tmpdata['Environment.Variables.'.$i.'.Value'] = $value1;
- $i++;
- }
- $meth = 'POST';
- $host = 'scf.tencentcloudapi.com';
- $tmpdata['Action'] = 'UpdateFunctionConfiguration';
- $tmpdata['FunctionName'] = $function_name;
- $tmpdata['Namespace'] = $Namespace;
- $tmpdata['Nonce'] = time();
- $tmpdata['Region'] = $Region;
- $tmpdata['SecretId'] = $SecretId;
- $tmpdata['Timestamp'] = time();
- $tmpdata['Token'] = '';
- $tmpdata['Version'] = '2018-04-16';
- $tmpdata['Description'] = 'Onedrive index and manager in SCF.';
- $tmpdata['MemorySize'] = 64;
- $tmpdata['Timeout'] = 30;
- $data = ReorganizeDate($tmpdata);
- echo $data;
- $signStr = base64_encode(hash_hmac('sha1', $meth.$host.'/?'.$data, $SecretKey, true));
- //echo urlencode($signStr);
- return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
-}
-
-function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
-{
- WaitSCFStat();
- $meth = 'POST';
- $host = 'scf.tencentcloudapi.com';
- $tmpdata['Action'] = 'UpdateFunctionCode';
- $tmpdata['Code.GitUrl'] = $source['url'];
- $tmpdata['Code.GitBranch'] = $source['branch'];
- $tmpdata['CodeSource'] = 'Git';
- $tmpdata['FunctionName'] = $function_name;
- $tmpdata['Handler'] = 'index.main_handler';
- $tmpdata['Namespace'] = $Namespace;
- $tmpdata['Nonce'] = time();
- $tmpdata['Region'] = $Region;
- $tmpdata['SecretId'] = $SecretId;
- $tmpdata['Timestamp'] = time();
- $tmpdata['Token'] = '';
- $tmpdata['Version'] = '2018-04-16';
- $data = ReorganizeDate($tmpdata);
- $signStr = base64_encode(hash_hmac('sha1', $meth.$host.'/?'.$data, $SecretKey, true));
- //echo urlencode($signStr);
- return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
-}
-
-function api_error($response)
-{
- return isset($response['Error']);
-}
-
-function api_error_msg($response)
-{
- return $response['Error']['Code'] . '
-' . $response['Error']['Message'] . '
-function_name:' . $_SERVER['function_name'] . '
-Region:' . $_SERVER['Region'] . '
-namespace:' . $_SERVER['namespace'] . '
-';
-}
-
-function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
-{
- $source['url'] = 'https://github.com/' . $auth . '/' . $project;
- $source['branch'] = $branch;
- return json_decode(updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'), $source), true)['Response'];
-}
-
-function setConfigResponse($response)
-{
- return json_decode( $response, true )['Response'];
-}
diff --git a/platform/heroku.php b/platform/heroku.php
deleted file mode 100644
index abfeb15..0000000
--- a/platform/heroku.php
+++ /dev/null
@@ -1,271 +0,0 @@
-0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
- else $path = $_SERVER['REQUEST_URI'];
- $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
- return substr($path, 1);
- //return spurlencode($path, '/');
-}
-
-function getGET()
-{
- $p = strpos($_SERVER['REQUEST_URI'],'?');
- if ($p>0) {
- $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
- $getstrarr = explode("&",$getstr);
- foreach ($getstrarr as $getvalues) {
- if ($getvalues != '') {
- $pos = strpos($getvalues, "=");
- //echo $pos;
- if ($pos > 0) {
- $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
- } else {
- $getarry[urldecode($getvalues)] = true;
- }
- }
- }
- }
- if (isset($getarry)) {
- return $getarry;
- } else {
- return [];
- }
-}
-
-function getConfig($str, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- if (in_array($str, $InnerEnv)) {
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $env = json_decode(getenv($disktag), true);
- if (isset($env[$str])) {
- if (in_array($str, $Base64Env)) return equal_replace($env[$str],1);
- else return $env[$str];
- }
- } else {
- if (in_array($str, $Base64Env)) return equal_replace(getenv($str),1);
- else return getenv($str);
- }
- return '';
-}
-
-function setConfig($arr, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- $disktags = explode("|",getConfig('disktag'));
- $diskconfig = json_decode(getenv($disktag), true);
- $tmp = [];
- $indisk = 0;
- $oparetdisk = 0;
- foreach ($arr as $k => $v) {
- if (in_array($k, $InnerEnv)) {
- if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v);
- else $diskconfig[$k] = $v;
- $indisk = 1;
- } elseif ($k=='disktag_add') {
- array_push($disktags, $v);
- $oparetdisk = 1;
- } elseif ($k=='disktag_del') {
- $disktags = array_diff($disktags, [ $v ]);
- $tmp[$v] = '';
- $oparetdisk = 1;
- } else {
- if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v);
- else $tmp[$k] = $v;
- }
- }
- if ($indisk) {
- $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
- ksort($diskconfig);
- $tmp[$disktag] = json_encode($diskconfig);
- }
- if ($oparetdisk) {
- $disktags = array_unique($disktags);
- foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
- if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
- else $tmp['disktag'] = '';
- }
- foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
-// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
-//';
- return setHerokuConfig($tmp, getConfig('function_name'), getConfig('APIKey'));
-}
-
-function install()
-{
- global $constStr;
- if ($_GET['install1']) {
- if ($_POST['admin']!='') {
- $tmp['admin'] = $_POST['admin'];
- //$tmp['language'] = $_POST['language'];
- $tmp['timezone'] = $_COOKIE['timezone'];
- $APIKey = getConfig('APIKey');
- if ($APIKey=='') {
- $APIKey = $_POST['APIKey'];
- $tmp['APIKey'] = $APIKey;
- }
- $function_name = getConfig('function_name');
- if ($function_name=='') {
- $tmp1 = substr($_SERVER['HTTP_HOST'], 0, strrpos($_SERVER['HTTP_HOST'], '.'));
- $maindomain = substr($tmp1, strrpos($tmp1, '.')+1);
- if ($maindomain=='herokuapp') $function_name = substr($tmp1, 0, strrpos($tmp1, '.'));
- else $function_name = 'visit from xxxx.herokuapp.com';
- $tmp['function_name'] = $function_name;
- }
- $response = json_decode(setHerokuConfig($tmp, $function_name, $APIKey)['body'], true);
- if (api_error($response)) {
- $html = api_error_msg($response);
- $title = 'Error';
- } else {
- return output('Jump
-
- ', 302);
- }
- return message($html, $title, 201);
- }
- }
- if ($_GET['install0']) {
- $html .= '
-
- ';
- $title = getconstStr('SelectLanguage');
- return message($html, $title, 201);
- }
- $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
- $title = 'Error';
- return message($html, $title, 201);
-}
-
-function HerokuAPI($method, $url, $data = '', $apikey)
-{
- if ($method=='PATCH'||$method=='POST') {
- $headers['Content-Type'] = 'application/json';
- }
- $headers['Authorization'] = 'Bearer ' . $apikey;
- $headers['Accept'] = 'application/vnd.heroku+json; version=3';
- //if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
- //if (!isset($headers['Referer'])) $headers['Referer'] = $url;
- $sendHeaders = array();
- foreach ($headers as $headerName => $headerVal) {
- $sendHeaders[] = $headerName . ': ' . $headerVal;
- }
- error_log($method . $url . $data . $apikey);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
- curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
- $response['body'] = curl_exec($ch);
- $response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
- curl_close($ch);
- error_log($response['stat'].'
-'.$response['body'].'
-');
- return $response;
-}
-
-function getHerokuConfig($function_name, $apikey)
-{
- return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', '', $apikey);
-}
-
-function setHerokuConfig($env, $function_name, $apikey)
-{
- $data = json_encode($env);
- return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', $data, $apikey);
-}
-
-function updateHerokuapp($function_name, $apikey, $source)
-{
- $tmp['source_blob']['url'] = $source;
- $data = json_encode($tmp);
- return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $function_name . '/builds', $data, $apikey);
-}
-
-function api_error($response)
-{
- return isset($response['id'])&&isset($response['message']);
-}
-
-function api_error_msg($response)
-{
- return $response['id'] . '
-' . $response['message'] . '
-function_name:' . $_SERVER['function_name'] . '
-';
-}
-
-function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
-{
- //'original:https://github.com/qkqpttgf/OneManager-php/tarball/master/';
- //'mine:https://https://github.com/BingoKingo/Tfo/tarball/master/';
- $source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
- return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'), $source)['body'], true);
-}
-
-function setConfigResponse($response)
-{
- return json_decode( $response['body'], true );
-}
diff --git a/platform/normal.php b/platform/normal.php
deleted file mode 100644
index 85bc1eb..0000000
--- a/platform/normal.php
+++ /dev/null
@@ -1,331 +0,0 @@
-0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
- else $path = $_SERVER['REQUEST_URI'];
- $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
- return substr($path, 1);
- //return spurlencode($path, '/');
-}
-
-function getGET()
-{
- $p = strpos($_SERVER['REQUEST_URI'],'?');
- if ($p>0) {
- $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
- $getstrarr = explode("&",$getstr);
- foreach ($getstrarr as $getvalues) {
- if ($getvalues != '') {
- $pos = strpos($getvalues, "=");
- //echo $pos;
- if ($pos > 0) {
- $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
- } else {
- $getarry[urldecode($getvalues)] = true;
- }
- }
- }
- }
- if (isset($getarry)) {
- return $getarry;
- } else {
- return [];
- }
-}
-
-function getConfig($str, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- //include 'config.php';
- $s = file_get_contents('config.php');
- $configs = substr($s, 18, -2);
- if ($configs!='') {
- $envs = json_decode($configs, true);
- if (in_array($str, $InnerEnv)) {
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- if (isset($envs[$disktag][$str])) {
- if (in_array($str, $Base64Env)) return equal_replace($envs[$disktag][$str],1);
- else return $envs[$disktag][$str];
- }
- } else {
- if (isset($envs[$str])) {
- if (in_array($str, $Base64Env)) return equal_replace($envs[$str],1);
- else return $envs[$str];
- }
- }
- }
- return '';
-}
-
-function setConfig($arr, $disktag = '')
-{
- global $InnerEnv;
- global $Base64Env;
- if ($disktag=='') $disktag = $_SERVER['disktag'];
- //include 'config.php';
- $s = file_get_contents('config.php');
- $configs = substr($s, 18, -2);
- if ($configs!='') $envs = json_decode($configs, true);
- $disktags = explode("|",getConfig('disktag'));
- $indisk = 0;
- $operatedisk = 0;
- foreach ($arr as $k => $v) {
- if (in_array($k, $InnerEnv)) {
- if (in_array($k, $Base64Env)) $envs[$disktag][$k] = equal_replace($v);
- else $envs[$disktag][$k] = $v;
- $indisk = 1;
- } elseif ($k=='disktag_add') {
- array_push($disktags, $v);
- $operatedisk = 1;
- } elseif ($k=='disktag_del') {
- $disktags = array_diff($disktags, [ $v ]);
- $envs[$v] = '';
- $operatedisk = 1;
- } else {
- if (in_array($k, $Base64Env)) $envs[$k] = equal_replace($v);
- else $envs[$k] = $v;
- }
- }
- if ($indisk) {
- $diskconfig = $envs[$disktag];
- $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
- ksort($diskconfig);
- $envs[$disktag] = $diskconfig;
- }
- if ($operatedisk) {
- $disktags = array_unique($disktags);
- foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
- if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
- else $envs['disktag'] = '';
- }
- $envs = array_filter($envs, 'array_value_isnot_null');
- ksort($envs);
- //echo ''. json_encode($envs, JSON_PRETTY_PRINT).'
';
- $prestr = '
- var expd = new Date();
- expd.setTime(expd.getTime()+(2*60*60*1000));
- var expires = "expires="+expd.toGMTString();
- document.cookie=\'language=; path=/; \'+expires;
-
- ', 302);
- }
- }
- }
- if ($_GET['install1']) {
- if (!ConfigWriteable()) {
- $html .= getconstStr('MakesuerWriteable');
- $title = 'Error';
- return message($html, $title, 201);
- }
- /*if (!RewriteEngineOn()) {
- $html .= getconstStr('MakesuerRewriteOn');
- $title = 'Error';
- return message($html, $title, 201);
- }*/
- $html .= '
-
-
-
- ';
- $title = getconstStr('SetAdminPassword');
- return message($html, $title, 201);
- }
- if ($_GET['install0']) {
- $html .= '
-
- ';
- $title = getconstStr('SelectLanguage');
- return message($html, $title, 201);
- }
- $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind');
- $title = 'Error';
- return message($html, $title, 201);
-}
-
-function ConfigWriteable()
-{
- $t = md5( md5(time()).rand(1000,9999) );
- $r = setConfig([ 'tmp' => $t ]);
- $tmp = getConfig('tmp');
- setConfig([ 'tmp' => '' ]);
- if ($tmp == $t) return true;
- if ($r) return true;
- return false;
-}
-
-function RewriteEngineOn()
-{
- $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
- $tmpurl = $http_type . $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
- $tmpurl .= path_format($_SERVER['base_path'] . '/config.php');
- $tmp = curl_request($tmpurl);
- if ($tmp['stat']==200) return false;
- if ($tmp['stat']==201) return true; //when install return 201, after installed return 404 or 200;
- return false;
-}
-
-function api_error($response)
-{
- return !$response;
-}
-
-function api_error_msg($response)
-{
- return $response . '
-Can not write config to file.
-';
-}
-
-function setConfigResponse($response)
-{
- return $response;
-}
-
-function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
-{
- // __DIR__ is xxx/platform
- $projectPath = splitlast(__DIR__, '/')[0];
-
- // 从github下载对应tar.gz,并解压
- $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
- $tarfile = $projectPath.'/github.tar.gz';
- $githubfile = file_get_contents($url);
- if (!$githubfile) return 0;
- file_put_contents($tarfile, $githubfile);
- if (splitfirst(PHP_VERSION, '.')[0] == '7') {
- $phar = new PharData($tarfile); // need php7
- $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
- } else {
- ob_start();
- passthru('tar -xzvf '.$tarfile,$stat);
- ob_get_clean();
- }
- unlink($tarfile);
-
- $outPath = '';
- $tmp = scandir($projectPath);
- $name = $auth.'-'.$project;
- foreach ($tmp as $f) {
- if ( substr($f, 0, strlen($name)) == $name) {
- $outPath = $projectPath . '/' . $f;
- break;
- }
- }
- //error_log($outPath);
- if ($outPath=='') return 0;
-
- //unlink($outPath.'/config.php');
- rename($projectPath.'/config.php', $outPath.'/config.php');
-
- return moveFolder($outPath, $projectPath);
-}
-
-function moveFolder($from, $to)
-{
- if (substr($from, -1)=='/') $from = substr($from, 0, -1);
- if (substr($to, -1)=='/') $to = substr($to, 0, -1);
- if (!file_exists($to)) mkdir($to, 0777);
- $handler=opendir($from);
- while($filename=readdir($handler)) {
- if($filename != '.' && $filename != '..'){
- $fromfile = $from.'/'.$filename;
- $tofile = $to.'/'.$filename;
- if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
- moveFolder($fromfile, $tofile);
- }else{
- //if (file_exists($tofile)) unlink($tofile);
- rename($fromfile, $tofile);
- if (file_exists($fromfile)) unlink($fromfile);
- }
- }
- }
- closedir($handler);
- rmdir($from);
- return 1;
-}
diff --git a/readme.md b/readme.md
deleted file mode 100644
index bc56962..0000000
--- a/readme.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# **Tfo**
-###### A website for two-point filestorage online (tfo)(20200713).
-
-
-
-## List of feature files 特色文件表
-Information [app.json](/app.json "app.json"),[version](/version "version"),[readme.md](/readme.md "readme.md"),[conststr.php](/conststr.php "conststr.php")
-
-UpdateAddress [Heroku.php](/platform/Heroku.php "Heroku.php"),[TencentSCF.php](/platform/TencentSCF.php "TencentSCF.php"),[HuaweiFG.php](/platform/HuaweiFG.php "HuaweiFG.php"),[AliyunFC.php](/platform/AliyunFC.php "AliyunFC.php")
-
-Theme
-
-Material Design for Classic Series(对默认主题的MD风格小优化,有对响应式、按钮外观、上传界面、路径栏随机赋色、背景模糊等的调整): [tfo_mdtr.php](/theme/tfo_mdtr.php "tfo_mdtr.php")(Transparent Material Design), [tfo_md.php](/theme/tfo_md.php "tfo_md.php")(Material Design), [tfo_mdtrbaw.php](/theme/tfo_mdtrbaw.php "tfo_mdtrbaw.php")(Black & White Material Design for Tomb-Sweeping Day) (All based on classic.php,latest at 2020.5.17)
-
-具体地,您可以下载/复制体验一下或参考示例中运用tfo_mdtr.php的[Li Share Storage Mini](https://tfo.herokuapp.com/ "Li Share Storage Mini")。需要注意:以上系列主题**默认隐藏右上角语言框**,请谨慎使用!示例中隐藏了多盘,但实际使用不隐藏哦。目前,主题仍存在诸多问题,请谅解。PS:主题将要实现的功能有狠多,敬请期待...
-
-## Deploy 部署
-Install program first, then add onedrive in setup after login.
-先安装程序,登录后在设置中添加onedrive。
-
-### Deploy to heroku 部署到Heroku
-Official: https://heroku.com
-
-How to Install: Click the button [](https://heroku.com/deploy) to Deploy a new app, or create an app then deploy via connect to your github fork.
-
-### Deploy to VPS (Virtual Private Server) 部署到VPS或空间
-How to Install:
-* 1.Start web service on your server (httpd or other), make sure you can visit it.
- 启动web服务器,确保你能访问到。
-* 2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
- 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
-* 3.Upload code.
- 上传好代码。
-* 4.Change the file config.php can be read&write (666 is suggested).
- 让代码中的config.php文件程序可读写,推荐chmod 666 config.php。
-* 5.View the website in chrome or other.
- 在浏览器中访问。
-
-### Deploy to SCF 部署到腾讯云函数
-Official: https://cloud.tencent.com/product/scf
-添加网盘时,SCF反应不过来,会添加失败,请不要删除,再添加一次相同的就可以了。
-~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview~~
-
-先手动在环境变量添加Region,ap-hongkong或ap-guangzhou之类,具体看 https://cloud.tencent.com/document/api/583/17238 最底下,然后再安装。
-添加网盘时,SCF反应不过来,会添加失败,请不要删除,再添加一次相同的就可以了。
-
-
-### Deploy to Aliyun Function Compute (FC 阿里函数计算)
-Official: https://fc.console.aliyun.com/
-How to Install:
-* 1,新建函数 -- HTTP函数
-* 2,运行环境选择php7.2
-* 3,触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
-* 4,上传代码
-* 5,触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
-* 6,访问你的域名,开始安装
-
-## Original Features 原始特性
-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.
-下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
-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.
-上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。
-The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
-设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。
-LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
-网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。
-Program will show content of 'readme.md' & 'head.md'.
-可以在文件列表显示head.md跟readme.md文件的内容。
-guest up path, is a folder that the guest can upload files, but can not be list (exclude admin).
-游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
-If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
-如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
-Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
-点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
diff --git a/tfo/ga.php b/tfo/ga.php
deleted file mode 100644
index 2266ab7..0000000
--- a/tfo/ga.php
+++ /dev/null
@@ -1,30 +0,0 @@
-verifyCode($secret, $oneCode, 2);
- if($checkResult){
- $user = $_POST['user'];
- $pass = $_POST['pass'];
- if($user=='admin'&&$pass=='admin000'){
- exit('登录成功');
- }else{
- exit('密码错误');
- }
- }else{
- exit('验证码错误');
- }}?>
- 登录
-
diff --git a/theme/classic.html b/theme/classic.html
deleted file mode 100644
index 8ce43ad..0000000
--- a/theme/classic.html
+++ /dev/null
@@ -1,1222 +0,0 @@
-
-{
- "music":"musical-notes",
- "video":"logo-youtube",
- "img":"image",
- "office":"paper",
- "txt":"clipboard",
- "zip":"filing",
- "iso":"disc",
- "apk":"logo-android",
- "exe":"logo-windows",
- "default":"document"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/ly_white.php b/theme/ly_white.php
deleted file mode 100644
index 13c0df4..0000000
--- a/theme/ly_white.php
+++ /dev/null
@@ -1,1289 +0,0 @@
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-"日)",
- "1"=>"一)",
- "2"=>"二)",
- "3"=>"三)",
- "4"=>"四)",
- "5"=>"五)",
- "6"=>"六)"
-);
-echo '(星期'.$week[$w];
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/lybwb.php b/theme/lybwb.php
deleted file mode 100644
index a273a94..0000000
--- a/theme/lybwb.php
+++ /dev/null
@@ -1,1283 +0,0 @@
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) {
- if (strtolower($file['name']) === 'head.md') $head = $file;
- if (strtolower($file['name']) === 'readme.md') $readme = $file;
- if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) {
- $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body'];
- return output($html,200);
- }
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/minus.php b/theme/minus.php
deleted file mode 100644
index 491601e..0000000
--- a/theme/minus.php
+++ /dev/null
@@ -1,1544 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Theme minus by Crazy白茫茫
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/nchyn_grey.html b/theme/nchyn_grey.html
deleted file mode 100644
index f07b8f5..0000000
--- a/theme/nchyn_grey.html
+++ /dev/null
@@ -1,1414 +0,0 @@
-
-{
- "music":"musical-notes",
- "video":"logo-youtube",
- "img":"image",
- "office":"paper",
- "txt":"clipboard",
- "zip":"filing",
- "iso":"disc",
- "apk":"logo-android",
- "exe":"logo-windows",
- "default":"document"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
OneManager By 逸笙 Theme By Nchyn
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/nexmoe.html b/theme/nexmoe.html
deleted file mode 100644
index 2051f30..0000000
--- a/theme/nexmoe.html
+++ /dev/null
@@ -1,341 +0,0 @@
-
-{
- "music":"audiotrack",
- "video":"ondemand_video",
- "img":"image",
- "default":"insert_drive_file"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--->
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
file_download
-
-
-
-
-
-
-
-
-
-
-
-
format_list_bulleted
-
-
-
-
-
-
-
diff --git a/theme/nexmoe1.html b/theme/nexmoe1.html
deleted file mode 100644
index 56998de..0000000
--- a/theme/nexmoe1.html
+++ /dev/null
@@ -1,377 +0,0 @@
-
-{
- "music":"audiotrack",
- "video":"ondemand_video",
- "img":"image",
- "default":"insert_drive_file"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- file_download
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- format_list_bulleted
-
-
-
-
-
-
-
-
diff --git a/theme/nexmoe2.html b/theme/nexmoe2.html
deleted file mode 100644
index 3ed1f54..0000000
--- a/theme/nexmoe2.html
+++ /dev/null
@@ -1,580 +0,0 @@
-
-{
- "music":"audiotrack",
- "video":"ondemand_video",
- "img":"image",
- "default":"insert_drive_file"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--->
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-file_download
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/onemoe.html b/theme/onemoe.html
deleted file mode 100644
index 431b2cc..0000000
--- a/theme/onemoe.html
+++ /dev/null
@@ -1,1180 +0,0 @@
-
-{
- "music":"musical-notes",
- "video":"logo-youtube",
- "img":"image",
- "office":"paper",
- "txt":"clipboard",
- "zip":"filing",
- "iso":"disc",
- "apk":"logo-android",
- "exe":"logo-windows",
- "default":"document"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/purenice.php b/theme/purenice.php
deleted file mode 100644
index 99e5b31..0000000
--- a/theme/purenice.php
+++ /dev/null
@@ -1,1272 +0,0 @@
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/renexmoe.html b/theme/renexmoe.html
deleted file mode 100644
index 94e880e..0000000
--- a/theme/renexmoe.html
+++ /dev/null
@@ -1,606 +0,0 @@
-
-{
- "music":"audiotrack",
- "video":"ondemand_video",
- "img":"image",
- "default":"insert_drive_file"
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--->
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-file_download
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
expand_more
- expand_more
- expand_more
-
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/ruoli_blue.php b/theme/ruoli_blue.php
deleted file mode 100644
index 92c4659..0000000
--- a/theme/ruoli_blue.php
+++ /dev/null
@@ -1,1240 +0,0 @@
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
登陆
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) {
- if (strtolower($file['name']) === 'head.md') $head = $file;
- if (strtolower($file['name']) === 'readme.md') $readme = $file;
- if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) {
- $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body'];
- return output($html,200);
- }
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- OneManager by 逸笙 theme by 若离
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/ruoli_violet.php b/theme/ruoli_violet.php
deleted file mode 100644
index ce71dfc..0000000
--- a/theme/ruoli_violet.php
+++ /dev/null
@@ -1,1259 +0,0 @@
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files['@microsoft.graph.downloadUrl'];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) {
- if (strtolower($file['name']) === 'head.md') $head = $file;
- if (strtolower($file['name']) === 'readme.md') $readme = $file;
- if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) {
- $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body'];
- return output($html,200);
- }
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/tfo_md.php b/theme/tfo_md.php
deleted file mode 100644
index 9e8cdc2..0000000
--- a/theme/tfo_md.php
+++ /dev/null
@@ -1,1296 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-';
-?>
-
-';
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files[$_SERVER['DownurlStrName']];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-';
- }
- }
- } else {
- echo '
-
-
-
-
- ';
- $statusCode = 401;
- }
- } ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/tfo_mdtr.php b/theme/tfo_mdtr.php
deleted file mode 100644
index e286954..0000000
--- a/theme/tfo_mdtr.php
+++ /dev/null
@@ -1,1296 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-';
-?>
-
-';
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files[$_SERVER['DownurlStrName']];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-';
- }
- }
- } else {
- echo '
-
-
-
-
- ';
- $statusCode = 401;
- }
- } ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/tfo_mdtr_nmd.php b/theme/tfo_mdtr_nmd.php
deleted file mode 100644
index 2265ea4..0000000
--- a/theme/tfo_mdtr_nmd.php
+++ /dev/null
@@ -1,1296 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-';
-?>
-
-';
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files[$_SERVER['DownurlStrName']];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-';
- }
- }
- } else {
- echo '
-
-
-
-
- ';
- $statusCode = 401;
- }
- } ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme/tfo_mdtrbaw.php b/theme/tfo_mdtrbaw.php
deleted file mode 100644
index b3d5248..0000000
--- a/theme/tfo_mdtrbaw.php
+++ /dev/null
@@ -1,1297 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-';
-?>
-
-';
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1) { ?>
-
-
-
-
-
-
-
-
';
- $statusCode=404;
- } else {
- if (isset($files['file'])) {
-?>
-
-
-
-document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" />
-';
- } elseif (in_array($ext, $exts['video'])) {
- //echo '
';
- $DPvideo=$files[$_SERVER['DownurlStrName']];
- echo '
-';
- } elseif (in_array($ext, $exts['music'])) {
- echo '
-';
- } elseif (in_array($ext, ['pdf'])) {
- /*echo '
-
-';
- }*/ else {
- echo '
'.getconstStr('FileNotSupport').'';
- } ?>
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-';
- foreach ($files['children'] as $file) {
- // Files
- if (isset($file['file'])) {
- if ($_SERVER['admin'] or !isHideFile($file['name'])) {
- $filenum++; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
-200) {
- $pagenum = $files['folder']['page'];
- $maxpage = ceil($files['folder']['childCount']/200);
- $prepagenext = '
-
';
- echo $prepagenext;
- }
- if ($_SERVER['admin']) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-';
- }
- }
- } else {
- echo '
-
-
-
-
- ';
- $statusCode = 401;
- }
- } ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/update.sh b/update.sh
deleted file mode 100644
index 3df4e0c..0000000
--- a/update.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!bash
-
-if [ $# -eq 0 ]; then
- echo "
-"$0" -i|u [-b branch]
- i a new install with empty config.
- u update use exist config.
- b install the branch after parameter b, default master
-
-example:
- "$0" -i
- "$0" -u
- "$0" -b master
- "$0" -u -b master
- "$0" -ib test
-"
-# exit
- echo "###############
-0, new install
-1, update"
- read -p "Input:" c
- [ g"$c" == g"0" ] && install=1
- [ g"$c" == g"1" ] && update=1
-fi
-
-i=0
-para[$i]=$0
-for av in "$@"
-do
-#echo $av
- ((i++))
- para[$i]=$av
- if [ g"${av:0:1}" == g"-" ]; then
- while [ g"$av" != g"" ]
- do
- ag=${av:0:1}
- av=${av:1}
- [ g"$ag" == g"b" ] && isbranch=1
- [ g"$ag" == g"i" ] && install=1
- [ g"$ag" == g"u" ] && update=1
- done
- else
- if [ g"$isbranch" == g"1" ]; then
- branch="-b $av"
- isbranch=0
- fi
- fi
-done
-
-if [ g"$install" == g"1" -a g"$update" == g"1" ]; then
- echo "Both install & update, exit"
- exit
-fi
-if [ g"$install" != g"1" -a g"$update" != g"1" ]; then
- echo "Not install & Not update, exit"
- exit
-fi
-
-gitsource='https://github.com/qkqpttgf/OneManager-php'
-
-OneManagerPath=`cd $(dirname $0);pwd -P`
-cd ${OneManagerPath}
-
-git clone ${branch} ${gitsource}
-[ g"$install" == g"1" ] || \mv -b config.php OneManager-php/
-\mv -b OneManager-php/* ./
-\mv -b OneManager-php/.[^.]* ./
-rm -rf *~
-rm -rf .[^.]*~
-rm -rf OneManager-php
-chmod 666 config.php
-
diff --git a/vendor/autoload.php b/vendor/autoload.php
deleted file mode 100644
index 8abd9f2..0000000
--- a/vendor/autoload.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
- * Jordi Boggiano
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Composer\Autoload;
-
-/**
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
- *
- * $loader = new \Composer\Autoload\ClassLoader();
- *
- * // register classes with namespaces
- * $loader->add('Symfony\Component', __DIR__.'/component');
- * $loader->add('Symfony', __DIR__.'/framework');
- *
- * // activate the autoloader
- * $loader->register();
- *
- * // to enable searching the include path (eg. for PEAR packages)
- * $loader->setUseIncludePath(true);
- *
- * In this example, if you try to use a class in the Symfony\Component
- * namespace or one of its children (Symfony\Component\Console for instance),
- * the autoloader will first look for the class under the component/
- * directory, and it will then fallback to the framework/ directory if not
- * found before giving up.
- *
- * This class is loosely based on the Symfony UniversalClassLoader.
- *
- * @author Fabien Potencier
- * @author Jordi Boggiano
- * @see http://www.php-fig.org/psr/psr-0/
- * @see http://www.php-fig.org/psr/psr-4/
- */
-class ClassLoader
-{
- // PSR-4
- private $prefixLengthsPsr4 = array();
- private $prefixDirsPsr4 = array();
- private $fallbackDirsPsr4 = array();
-
- // PSR-0
- private $prefixesPsr0 = array();
- private $fallbackDirsPsr0 = array();
-
- private $useIncludePath = false;
- private $classMap = array();
- private $classMapAuthoritative = false;
- private $missingClasses = array();
- private $apcuPrefix;
-
- public function getPrefixes()
- {
- if (!empty($this->prefixesPsr0)) {
- return call_user_func_array('array_merge', $this->prefixesPsr0);
- }
-
- return array();
- }
-
- public function getPrefixesPsr4()
- {
- return $this->prefixDirsPsr4;
- }
-
- public function getFallbackDirs()
- {
- return $this->fallbackDirsPsr0;
- }
-
- public function getFallbackDirsPsr4()
- {
- return $this->fallbackDirsPsr4;
- }
-
- public function getClassMap()
- {
- return $this->classMap;
- }
-
- /**
- * @param array $classMap Class to filename map
- */
- public function addClassMap(array $classMap)
- {
- if ($this->classMap) {
- $this->classMap = array_merge($this->classMap, $classMap);
- } else {
- $this->classMap = $classMap;
- }
- }
-
- /**
- * Registers a set of PSR-0 directories for a given prefix, either
- * appending or prepending to the ones previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
- */
- public function add($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- if ($prepend) {
- $this->fallbackDirsPsr0 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr0
- );
- } else {
- $this->fallbackDirsPsr0 = array_merge(
- $this->fallbackDirsPsr0,
- (array) $paths
- );
- }
-
- return;
- }
-
- $first = $prefix[0];
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
-
- return;
- }
- if ($prepend) {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- (array) $paths,
- $this->prefixesPsr0[$first][$prefix]
- );
- } else {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- $this->prefixesPsr0[$first][$prefix],
- (array) $paths
- );
- }
- }
-
- /**
- * Registers a set of PSR-4 directories for a given namespace, either
- * appending or prepending to the ones previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
- *
- * @throws \InvalidArgumentException
- */
- public function addPsr4($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- // Register directories for the root namespace.
- if ($prepend) {
- $this->fallbackDirsPsr4 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr4
- );
- } else {
- $this->fallbackDirsPsr4 = array_merge(
- $this->fallbackDirsPsr4,
- (array) $paths
- );
- }
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
- // Register directories for a new namespace.
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- } elseif ($prepend) {
- // Prepend directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- (array) $paths,
- $this->prefixDirsPsr4[$prefix]
- );
- } else {
- // Append directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- $this->prefixDirsPsr4[$prefix],
- (array) $paths
- );
- }
- }
-
- /**
- * Registers a set of PSR-0 directories for a given prefix,
- * replacing any others previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 base directories
- */
- public function set($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr0 = (array) $paths;
- } else {
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
- }
- }
-
- /**
- * Registers a set of PSR-4 directories for a given namespace,
- * replacing any others previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
- *
- * @throws \InvalidArgumentException
- */
- public function setPsr4($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr4 = (array) $paths;
- } else {
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- }
- }
-
- /**
- * Turns on searching the include path for class files.
- *
- * @param bool $useIncludePath
- */
- public function setUseIncludePath($useIncludePath)
- {
- $this->useIncludePath = $useIncludePath;
- }
-
- /**
- * Can be used to check if the autoloader uses the include path to check
- * for classes.
- *
- * @return bool
- */
- public function getUseIncludePath()
- {
- return $this->useIncludePath;
- }
-
- /**
- * Turns off searching the prefix and fallback directories for classes
- * that have not been registered with the class map.
- *
- * @param bool $classMapAuthoritative
- */
- public function setClassMapAuthoritative($classMapAuthoritative)
- {
- $this->classMapAuthoritative = $classMapAuthoritative;
- }
-
- /**
- * Should class lookup fail if not found in the current class map?
- *
- * @return bool
- */
- public function isClassMapAuthoritative()
- {
- return $this->classMapAuthoritative;
- }
-
- /**
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
- *
- * @param string|null $apcuPrefix
- */
- public function setApcuPrefix($apcuPrefix)
- {
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
- }
-
- /**
- * The APCu prefix in use, or null if APCu caching is not enabled.
- *
- * @return string|null
- */
- public function getApcuPrefix()
- {
- return $this->apcuPrefix;
- }
-
- /**
- * Registers this instance as an autoloader.
- *
- * @param bool $prepend Whether to prepend the autoloader or not
- */
- public function register($prepend = false)
- {
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
- }
-
- /**
- * Unregisters this instance as an autoloader.
- */
- public function unregister()
- {
- spl_autoload_unregister(array($this, 'loadClass'));
- }
-
- /**
- * Loads the given class or interface.
- *
- * @param string $class The name of the class
- * @return bool|null True if loaded, null otherwise
- */
- public function loadClass($class)
- {
- if ($file = $this->findFile($class)) {
- includeFile($file);
-
- return true;
- }
- }
-
- /**
- * Finds the path to the file where the class is defined.
- *
- * @param string $class The name of the class
- *
- * @return string|false The path if found, false otherwise
- */
- public function findFile($class)
- {
- // class map lookup
- if (isset($this->classMap[$class])) {
- return $this->classMap[$class];
- }
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
- return false;
- }
- if (null !== $this->apcuPrefix) {
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
- if ($hit) {
- return $file;
- }
- }
-
- $file = $this->findFileWithExtension($class, '.php');
-
- // Search for Hack files if we are running on HHVM
- if (false === $file && defined('HHVM_VERSION')) {
- $file = $this->findFileWithExtension($class, '.hh');
- }
-
- if (null !== $this->apcuPrefix) {
- apcu_add($this->apcuPrefix.$class, $file);
- }
-
- if (false === $file) {
- // Remember that this class does not exist.
- $this->missingClasses[$class] = true;
- }
-
- return $file;
- }
-
- private function findFileWithExtension($class, $ext)
- {
- // PSR-4 lookup
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
-
- $first = $class[0];
- if (isset($this->prefixLengthsPsr4[$first])) {
- $subPath = $class;
- while (false !== $lastPos = strrpos($subPath, '\\')) {
- $subPath = substr($subPath, 0, $lastPos);
- $search = $subPath . '\\';
- if (isset($this->prefixDirsPsr4[$search])) {
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
- if (file_exists($file = $dir . $pathEnd)) {
- return $file;
- }
- }
- }
- }
- }
-
- // PSR-4 fallback dirs
- foreach ($this->fallbackDirsPsr4 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
- return $file;
- }
- }
-
- // PSR-0 lookup
- if (false !== $pos = strrpos($class, '\\')) {
- // namespaced class name
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
- } else {
- // PEAR-like class name
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
- }
-
- if (isset($this->prefixesPsr0[$first])) {
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
- if (0 === strpos($class, $prefix)) {
- foreach ($dirs as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- }
- }
- }
-
- // PSR-0 fallback dirs
- foreach ($this->fallbackDirsPsr0 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
-
- // PSR-0 include paths.
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
- return $file;
- }
-
- return false;
- }
-}
-
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- */
-function includeFile($file)
-{
- include $file;
-}
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
deleted file mode 100644
index f27399a..0000000
--- a/vendor/composer/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-
-Copyright (c) Nils Adermann, Jordi Boggiano
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
deleted file mode 100644
index 7a91153..0000000
--- a/vendor/composer/autoload_classmap.php
+++ /dev/null
@@ -1,9 +0,0 @@
- array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
- 'App\\' => array($baseDir . '/app'),
-);
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
deleted file mode 100644
index 14baf56..0000000
--- a/vendor/composer/autoload_real.php
+++ /dev/null
@@ -1,52 +0,0 @@
-= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
- if ($useStaticLoader) {
- require_once __DIR__ . '/autoload_static.php';
-
- call_user_func(\Composer\Autoload\ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::getInitializer($loader));
- } else {
- $map = require __DIR__ . '/autoload_namespaces.php';
- foreach ($map as $namespace => $path) {
- $loader->set($namespace, $path);
- }
-
- $map = require __DIR__ . '/autoload_psr4.php';
- foreach ($map as $namespace => $path) {
- $loader->setPsr4($namespace, $path);
- }
-
- $classMap = require __DIR__ . '/autoload_classmap.php';
- if ($classMap) {
- $loader->addClassMap($classMap);
- }
- }
-
- $loader->register(true);
-
- return $loader;
- }
-}
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
deleted file mode 100644
index 62275fa..0000000
--- a/vendor/composer/autoload_static.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- array (
- 'Doctrine\\Common\\Cache\\' => 22,
- ),
- 'A' =>
- array (
- 'App\\' => 4,
- ),
- );
-
- public static $prefixDirsPsr4 = array (
- 'Doctrine\\Common\\Cache\\' =>
- array (
- 0 => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache',
- ),
- 'App\\' =>
- array (
- 0 => __DIR__ . '/../..' . '/app',
- ),
- );
-
- public static function getInitializer(ClassLoader $loader)
- {
- return \Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit95653bfe69a47d1c8f876456a9c468fd::$prefixDirsPsr4;
-
- }, null, ClassLoader::class);
- }
-}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
deleted file mode 100644
index 2355284..0000000
--- a/vendor/composer/installed.json
+++ /dev/null
@@ -1,80 +0,0 @@
-[
- {
- "name": "doctrine/cache",
- "version": "v1.6.2",
- "version_normalized": "1.6.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/cache.git",
- "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
- "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": "~5.5|~7.0"
- },
- "conflict": {
- "doctrine/common": ">2.2,<2.4"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.8|~5.0",
- "predis/predis": "~1.0",
- "satooshi/php-coveralls": "~0.6"
- },
- "time": "2017-07-22T12:49:21+00:00",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.6.x-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com"
- },
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Caching library offering an object-oriented API for many cache backends",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "cache",
- "caching"
- ]
- }
-]
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php
deleted file mode 100644
index 0dfbd6a..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php
+++ /dev/null
@@ -1,118 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * APC cache provider.
- *
- * @link www.doctrine-project.org
- * @deprecated since version 1.6, use ApcuCache instead
- * @since 2.0
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class ApcCache extends CacheProvider
-{
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return apc_fetch($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return apc_exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return apc_store($id, $data, $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- // apc_delete returns false if the id does not exist
- return apc_delete($id) || ! apc_exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return apc_clear_cache() && apc_clear_cache('user');
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- return apc_fetch($keys) ?: [];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- $result = apc_store($keysAndValues, null, $lifetime);
-
- return empty($result);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $info = apc_cache_info('', true);
- $sma = apc_sma_info();
-
- // @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42
- if (PHP_VERSION_ID >= 50500) {
- $info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits'];
- $info['num_misses'] = isset($info['num_misses']) ? $info['num_misses'] : $info['nmisses'];
- $info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime'];
- }
-
- return array(
- Cache::STATS_HITS => $info['num_hits'],
- Cache::STATS_MISSES => $info['num_misses'],
- Cache::STATS_UPTIME => $info['start_time'],
- Cache::STATS_MEMORY_USAGE => $info['mem_size'],
- Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php
deleted file mode 100644
index 2a91752..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php
+++ /dev/null
@@ -1,106 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * APCu cache provider.
- *
- * @link www.doctrine-project.org
- * @since 1.6
- * @author Kévin Dunglas
- */
-class ApcuCache extends CacheProvider
-{
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return apcu_fetch($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return apcu_exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return apcu_store($id, $data, $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- // apcu_delete returns false if the id does not exist
- return apcu_delete($id) || ! apcu_exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return apcu_clear_cache();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- return apcu_fetch($keys) ?: [];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- $result = apcu_store($keysAndValues, null, $lifetime);
-
- return empty($result);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $info = apcu_cache_info(true);
- $sma = apcu_sma_info();
-
- return array(
- Cache::STATS_HITS => $info['num_hits'],
- Cache::STATS_MISSES => $info['num_misses'],
- Cache::STATS_UPTIME => $info['start_time'],
- Cache::STATS_MEMORY_USAGE => $info['mem_size'],
- Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php
deleted file mode 100644
index 6610cc2..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php
+++ /dev/null
@@ -1,142 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Array cache driver.
- *
- * @link www.doctrine-project.org
- * @since 2.0
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class ArrayCache extends CacheProvider
-{
- /**
- * @var array[] $data each element being a tuple of [$data, $expiration], where the expiration is int|bool
- */
- private $data = [];
-
- /**
- * @var int
- */
- private $hitsCount = 0;
-
- /**
- * @var int
- */
- private $missesCount = 0;
-
- /**
- * @var int
- */
- private $upTime;
-
- /**
- * {@inheritdoc}
- */
- public function __construct()
- {
- $this->upTime = time();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- if (! $this->doContains($id)) {
- $this->missesCount += 1;
-
- return false;
- }
-
- $this->hitsCount += 1;
-
- return $this->data[$id][0];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- if (! isset($this->data[$id])) {
- return false;
- }
-
- $expiration = $this->data[$id][1];
-
- if ($expiration && $expiration < time()) {
- $this->doDelete($id);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- $this->data[$id] = [$data, $lifeTime ? time() + $lifeTime : false];
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- unset($this->data[$id]);
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- $this->data = [];
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- return [
- Cache::STATS_HITS => $this->hitsCount,
- Cache::STATS_MISSES => $this->missesCount,
- Cache::STATS_UPTIME => $this->upTime,
- Cache::STATS_MEMORY_USAGE => null,
- Cache::STATS_MEMORY_AVAILABLE => null,
- ];
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php
deleted file mode 100644
index 89fe323..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php
+++ /dev/null
@@ -1,116 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Interface for cache drivers.
- *
- * @link www.doctrine-project.org
- * @since 2.0
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author Fabio B. Silva
- * @author Kévin Dunglas
- */
-interface Cache
-{
- const STATS_HITS = 'hits';
- const STATS_MISSES = 'misses';
- const STATS_UPTIME = 'uptime';
- const STATS_MEMORY_USAGE = 'memory_usage';
- const STATS_MEMORY_AVAILABLE = 'memory_available';
- /**
- * Only for backward compatibility (may be removed in next major release)
- *
- * @deprecated
- */
- const STATS_MEMORY_AVAILIABLE = 'memory_available';
-
- /**
- * Fetches an entry from the cache.
- *
- * @param string $id The id of the cache entry to fetch.
- *
- * @return mixed The cached data or FALSE, if no cache entry exists for the given id.
- */
- public function fetch($id);
-
- /**
- * Tests if an entry exists in the cache.
- *
- * @param string $id The cache id of the entry to check for.
- *
- * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise.
- */
- public function contains($id);
-
- /**
- * Puts data into the cache.
- *
- * If a cache entry with the given id already exists, its data will be replaced.
- *
- * @param string $id The cache id.
- * @param mixed $data The cache entry/data.
- * @param int $lifeTime The lifetime in number of seconds for this cache entry.
- * If zero (the default), the entry never expires (although it may be deleted from the cache
- * to make place for other entries).
- *
- * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
- */
- public function save($id, $data, $lifeTime = 0);
-
- /**
- * Deletes a cache entry.
- *
- * @param string $id The cache id.
- *
- * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise.
- * Deleting a non-existing entry is considered successful.
- */
- public function delete($id);
-
- /**
- * Retrieves cached information from the data store.
- *
- * The server's statistics array has the following values:
- *
- * - hits
- * Number of keys that have been requested and found present.
- *
- * - misses
- * Number of items that have been requested and not found.
- *
- * - uptime
- * Time that the server is running.
- *
- * - memory_usage
- * Memory used by this server to store items.
- *
- * - memory_available
- * Memory allowed to use for storage.
- *
- * @since 2.2
- *
- * @return array|null An associative array with server's statistics if available, NULL otherwise.
- */
- public function getStats();
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php
deleted file mode 100644
index 9f57923..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php
+++ /dev/null
@@ -1,312 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Base class for cache provider implementations.
- *
- * @since 2.2
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author Fabio B. Silva
- */
-abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiGetCache, MultiPutCache
-{
- const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]';
-
- /**
- * The namespace to prefix all cache ids with.
- *
- * @var string
- */
- private $namespace = '';
-
- /**
- * The namespace version.
- *
- * @var integer|null
- */
- private $namespaceVersion;
-
- /**
- * Sets the namespace to prefix all cache ids with.
- *
- * @param string $namespace
- *
- * @return void
- */
- public function setNamespace($namespace)
- {
- $this->namespace = (string) $namespace;
- $this->namespaceVersion = null;
- }
-
- /**
- * Retrieves the namespace that prefixes all cache ids.
- *
- * @return string
- */
- public function getNamespace()
- {
- return $this->namespace;
- }
-
- /**
- * {@inheritdoc}
- */
- public function fetch($id)
- {
- return $this->doFetch($this->getNamespacedId($id));
- }
-
- /**
- * {@inheritdoc}
- */
- public function fetchMultiple(array $keys)
- {
- if (empty($keys)) {
- return array();
- }
-
- // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys
- $namespacedKeys = array_combine($keys, array_map(array($this, 'getNamespacedId'), $keys));
- $items = $this->doFetchMultiple($namespacedKeys);
- $foundItems = array();
-
- // no internal array function supports this sort of mapping: needs to be iterative
- // this filters and combines keys in one pass
- foreach ($namespacedKeys as $requestedKey => $namespacedKey) {
- if (isset($items[$namespacedKey]) || array_key_exists($namespacedKey, $items)) {
- $foundItems[$requestedKey] = $items[$namespacedKey];
- }
- }
-
- return $foundItems;
- }
-
- /**
- * {@inheritdoc}
- */
- public function saveMultiple(array $keysAndValues, $lifetime = 0)
- {
- $namespacedKeysAndValues = array();
- foreach ($keysAndValues as $key => $value) {
- $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value;
- }
-
- return $this->doSaveMultiple($namespacedKeysAndValues, $lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function contains($id)
- {
- return $this->doContains($this->getNamespacedId($id));
- }
-
- /**
- * {@inheritdoc}
- */
- public function save($id, $data, $lifeTime = 0)
- {
- return $this->doSave($this->getNamespacedId($id), $data, $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function delete($id)
- {
- return $this->doDelete($this->getNamespacedId($id));
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStats()
- {
- return $this->doGetStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public function flushAll()
- {
- return $this->doFlush();
- }
-
- /**
- * {@inheritDoc}
- */
- public function deleteAll()
- {
- $namespaceCacheKey = $this->getNamespaceCacheKey();
- $namespaceVersion = $this->getNamespaceVersion() + 1;
-
- if ($this->doSave($namespaceCacheKey, $namespaceVersion)) {
- $this->namespaceVersion = $namespaceVersion;
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Prefixes the passed id with the configured namespace value.
- *
- * @param string $id The id to namespace.
- *
- * @return string The namespaced id.
- */
- private function getNamespacedId($id)
- {
- $namespaceVersion = $this->getNamespaceVersion();
-
- return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion);
- }
-
- /**
- * Returns the namespace cache key.
- *
- * @return string
- */
- private function getNamespaceCacheKey()
- {
- return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace);
- }
-
- /**
- * Returns the namespace version.
- *
- * @return integer
- */
- private function getNamespaceVersion()
- {
- if (null !== $this->namespaceVersion) {
- return $this->namespaceVersion;
- }
-
- $namespaceCacheKey = $this->getNamespaceCacheKey();
- $this->namespaceVersion = $this->doFetch($namespaceCacheKey) ?: 1;
-
- return $this->namespaceVersion;
- }
-
- /**
- * Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
- *
- * @param array $keys Array of keys to retrieve from cache
- * @return array Array of values retrieved for the given keys.
- */
- protected function doFetchMultiple(array $keys)
- {
- $returnValues = array();
-
- foreach ($keys as $key) {
- if (false !== ($item = $this->doFetch($key)) || $this->doContains($key)) {
- $returnValues[$key] = $item;
- }
- }
-
- return $returnValues;
- }
-
- /**
- * Fetches an entry from the cache.
- *
- * @param string $id The id of the cache entry to fetch.
- *
- * @return mixed|false The cached data or FALSE, if no cache entry exists for the given id.
- */
- abstract protected function doFetch($id);
-
- /**
- * Tests if an entry exists in the cache.
- *
- * @param string $id The cache id of the entry to check for.
- *
- * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise.
- */
- abstract protected function doContains($id);
-
- /**
- * Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.
- *
- * @param array $keysAndValues Array of keys and values to save in cache
- * @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these
- * cache entries (0 => infinite lifeTime).
- *
- * @return bool TRUE if the operation was successful, FALSE if it wasn't.
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- $success = true;
-
- foreach ($keysAndValues as $key => $value) {
- if (!$this->doSave($key, $value, $lifetime)) {
- $success = false;
- }
- }
-
- return $success;
- }
-
- /**
- * Puts data into the cache.
- *
- * @param string $id The cache id.
- * @param string $data The cache entry/data.
- * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this
- * cache entry (0 => infinite lifeTime).
- *
- * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
- */
- abstract protected function doSave($id, $data, $lifeTime = 0);
-
- /**
- * Deletes a cache entry.
- *
- * @param string $id The cache id.
- *
- * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise.
- */
- abstract protected function doDelete($id);
-
- /**
- * Flushes all cache entries.
- *
- * @return bool TRUE if the cache entries were successfully flushed, FALSE otherwise.
- */
- abstract protected function doFlush();
-
- /**
- * Retrieves cached information from the data store.
- *
- * @since 2.2
- *
- * @return array|null An associative array with server's statistics if available, NULL otherwise.
- */
- abstract protected function doGetStats();
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php
deleted file mode 100644
index 96c9b54..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php
+++ /dev/null
@@ -1,147 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Cache provider that allows to easily chain multiple cache providers
- *
- * @author Michaël Gallego
- */
-class ChainCache extends CacheProvider
-{
- /**
- * @var CacheProvider[]
- */
- private $cacheProviders = array();
-
- /**
- * Constructor
- *
- * @param CacheProvider[] $cacheProviders
- */
- public function __construct($cacheProviders = array())
- {
- $this->cacheProviders = $cacheProviders;
- }
-
- /**
- * {@inheritDoc}
- */
- public function setNamespace($namespace)
- {
- parent::setNamespace($namespace);
-
- foreach ($this->cacheProviders as $cacheProvider) {
- $cacheProvider->setNamespace($namespace);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doFetch($id)
- {
- foreach ($this->cacheProviders as $key => $cacheProvider) {
- if ($cacheProvider->doContains($id)) {
- $value = $cacheProvider->doFetch($id);
-
- // We populate all the previous cache layers (that are assumed to be faster)
- for ($subKey = $key - 1 ; $subKey >= 0 ; $subKey--) {
- $this->cacheProviders[$subKey]->doSave($id, $value);
- }
-
- return $value;
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doContains($id)
- {
- foreach ($this->cacheProviders as $cacheProvider) {
- if ($cacheProvider->doContains($id)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- $stored = true;
-
- foreach ($this->cacheProviders as $cacheProvider) {
- $stored = $cacheProvider->doSave($id, $data, $lifeTime) && $stored;
- }
-
- return $stored;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doDelete($id)
- {
- $deleted = true;
-
- foreach ($this->cacheProviders as $cacheProvider) {
- $deleted = $cacheProvider->doDelete($id) && $deleted;
- }
-
- return $deleted;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doFlush()
- {
- $flushed = true;
-
- foreach ($this->cacheProviders as $cacheProvider) {
- $flushed = $cacheProvider->doFlush() && $flushed;
- }
-
- return $flushed;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doGetStats()
- {
- // We return all the stats from all adapters
- $stats = array();
-
- foreach ($this->cacheProviders as $cacheProvider) {
- $stats[] = $cacheProvider->doGetStats();
- }
-
- return $stats;
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php
deleted file mode 100644
index 3a91eaf..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php
+++ /dev/null
@@ -1,40 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Interface for cache that can be flushed.
- *
- * Intended to be used for partial clearing of a cache namespace. For a more
- * global "flushing", see {@see FlushableCache}.
- *
- * @link www.doctrine-project.org
- * @since 1.4
- * @author Adirelle
- */
-interface ClearableCache
-{
- /**
- * Deletes all cache entries in the current cache namespace.
- *
- * @return bool TRUE if the cache entries were successfully deleted, FALSE otherwise.
- */
- public function deleteAll();
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php
deleted file mode 100644
index c21691d..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php
+++ /dev/null
@@ -1,121 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use \Couchbase;
-
-/**
- * Couchbase cache provider.
- *
- * @link www.doctrine-project.org
- * @since 2.4
- * @author Michael Nitschinger
- */
-class CouchbaseCache extends CacheProvider
-{
- /**
- * @var Couchbase|null
- */
- private $couchbase;
-
- /**
- * Sets the Couchbase instance to use.
- *
- * @param Couchbase $couchbase
- *
- * @return void
- */
- public function setCouchbase(Couchbase $couchbase)
- {
- $this->couchbase = $couchbase;
- }
-
- /**
- * Gets the Couchbase instance used by the cache.
- *
- * @return Couchbase|null
- */
- public function getCouchbase()
- {
- return $this->couchbase;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return $this->couchbase->get($id) ?: false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return (null !== $this->couchbase->get($id));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 30 * 24 * 3600) {
- $lifeTime = time() + $lifeTime;
- }
- return $this->couchbase->set($id, $data, (int) $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return $this->couchbase->delete($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return $this->couchbase->flush();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $stats = $this->couchbase->getStats();
- $servers = $this->couchbase->getServers();
- $server = explode(":", $servers[0]);
- $key = $server[0] . ":" . "11210";
- $stats = $stats[$key];
- return array(
- Cache::STATS_HITS => $stats['get_hits'],
- Cache::STATS_MISSES => $stats['get_misses'],
- Cache::STATS_UPTIME => $stats['uptime'],
- Cache::STATS_MEMORY_USAGE => $stats['bytes'],
- Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php
deleted file mode 100644
index b2e0427..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php
+++ /dev/null
@@ -1,286 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Base file cache driver.
- *
- * @since 2.3
- * @author Fabio B. Silva
- * @author Tobias Schultze
- */
-abstract class FileCache extends CacheProvider
-{
- /**
- * The cache directory.
- *
- * @var string
- */
- protected $directory;
-
- /**
- * The cache file extension.
- *
- * @var string
- */
- private $extension;
-
- /**
- * @var int
- */
- private $umask;
-
- /**
- * @var int
- */
- private $directoryStringLength;
-
- /**
- * @var int
- */
- private $extensionStringLength;
-
- /**
- * @var bool
- */
- private $isRunningOnWindows;
-
- /**
- * Constructor.
- *
- * @param string $directory The cache directory.
- * @param string $extension The cache file extension.
- *
- * @throws \InvalidArgumentException
- */
- public function __construct($directory, $extension = '', $umask = 0002)
- {
- // YES, this needs to be *before* createPathIfNeeded()
- if ( ! is_int($umask)) {
- throw new \InvalidArgumentException(sprintf(
- 'The umask parameter is required to be integer, was: %s',
- gettype($umask)
- ));
- }
- $this->umask = $umask;
-
- if ( ! $this->createPathIfNeeded($directory)) {
- throw new \InvalidArgumentException(sprintf(
- 'The directory "%s" does not exist and could not be created.',
- $directory
- ));
- }
-
- if ( ! is_writable($directory)) {
- throw new \InvalidArgumentException(sprintf(
- 'The directory "%s" is not writable.',
- $directory
- ));
- }
-
- // YES, this needs to be *after* createPathIfNeeded()
- $this->directory = realpath($directory);
- $this->extension = (string) $extension;
-
- $this->directoryStringLength = strlen($this->directory);
- $this->extensionStringLength = strlen($this->extension);
- $this->isRunningOnWindows = defined('PHP_WINDOWS_VERSION_BUILD');
- }
-
- /**
- * Gets the cache directory.
- *
- * @return string
- */
- public function getDirectory()
- {
- return $this->directory;
- }
-
- /**
- * Gets the cache file extension.
- *
- * @return string
- */
- public function getExtension()
- {
- return $this->extension;
- }
-
- /**
- * @param string $id
- *
- * @return string
- */
- protected function getFilename($id)
- {
- $hash = hash('sha256', $id);
-
- // This ensures that the filename is unique and that there are no invalid chars in it.
- if (
- '' === $id
- || ((strlen($id) * 2 + $this->extensionStringLength) > 255)
- || ($this->isRunningOnWindows && ($this->directoryStringLength + 4 + strlen($id) * 2 + $this->extensionStringLength) > 258)
- ) {
- // Most filesystems have a limit of 255 chars for each path component. On Windows the the whole path is limited
- // to 260 chars (including terminating null char). Using long UNC ("\\?\" prefix) does not work with the PHP API.
- // And there is a bug in PHP (https://bugs.php.net/bug.php?id=70943) with path lengths of 259.
- // So if the id in hex representation would surpass the limit, we use the hash instead. The prefix prevents
- // collisions between the hash and bin2hex.
- $filename = '_' . $hash;
- } else {
- $filename = bin2hex($id);
- }
-
- return $this->directory
- . DIRECTORY_SEPARATOR
- . substr($hash, 0, 2)
- . DIRECTORY_SEPARATOR
- . $filename
- . $this->extension;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- $filename = $this->getFilename($id);
-
- return @unlink($filename) || ! file_exists($filename);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- foreach ($this->getIterator() as $name => $file) {
- if ($file->isDir()) {
- // Remove the intermediate directories which have been created to balance the tree. It only takes effect
- // if the directory is empty. If several caches share the same directory but with different file extensions,
- // the other ones are not removed.
- @rmdir($name);
- } elseif ($this->isFilenameEndingWithExtension($name)) {
- // If an extension is set, only remove files which end with the given extension.
- // If no extension is set, we have no other choice than removing everything.
- @unlink($name);
- }
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $usage = 0;
- foreach ($this->getIterator() as $name => $file) {
- if (! $file->isDir() && $this->isFilenameEndingWithExtension($name)) {
- $usage += $file->getSize();
- }
- }
-
- $free = disk_free_space($this->directory);
-
- return array(
- Cache::STATS_HITS => null,
- Cache::STATS_MISSES => null,
- Cache::STATS_UPTIME => null,
- Cache::STATS_MEMORY_USAGE => $usage,
- Cache::STATS_MEMORY_AVAILABLE => $free,
- );
- }
-
- /**
- * Create path if needed.
- *
- * @param string $path
- * @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
- */
- private function createPathIfNeeded($path)
- {
- if ( ! is_dir($path)) {
- if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Writes a string content to file in an atomic way.
- *
- * @param string $filename Path to the file where to write the data.
- * @param string $content The content to write
- *
- * @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
- */
- protected function writeFile($filename, $content)
- {
- $filepath = pathinfo($filename, PATHINFO_DIRNAME);
-
- if ( ! $this->createPathIfNeeded($filepath)) {
- return false;
- }
-
- if ( ! is_writable($filepath)) {
- return false;
- }
-
- $tmpFile = tempnam($filepath, 'swap');
- @chmod($tmpFile, 0666 & (~$this->umask));
-
- if (file_put_contents($tmpFile, $content) !== false) {
- if (@rename($tmpFile, $filename)) {
- return true;
- }
-
- @unlink($tmpFile);
- }
-
- return false;
- }
-
- /**
- * @return \Iterator
- */
- private function getIterator()
- {
- return new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS),
- \RecursiveIteratorIterator::CHILD_FIRST
- );
- }
-
- /**
- * @param string $name The filename
- *
- * @return bool
- */
- private function isFilenameEndingWithExtension($name)
- {
- return '' === $this->extension
- || strrpos($name, $this->extension) === (strlen($name) - $this->extensionStringLength);
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
deleted file mode 100644
index d988294..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
+++ /dev/null
@@ -1,111 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Filesystem cache driver.
- *
- * @since 2.3
- * @author Fabio B. Silva
- */
-class FilesystemCache extends FileCache
-{
- const EXTENSION = '.doctrinecache.data';
-
- /**
- * {@inheritdoc}
- */
- public function __construct($directory, $extension = self::EXTENSION, $umask = 0002)
- {
- parent::__construct($directory, $extension, $umask);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- $data = '';
- $lifetime = -1;
- $filename = $this->getFilename($id);
-
- if ( ! is_file($filename)) {
- return false;
- }
-
- $resource = fopen($filename, "r");
-
- if (false !== ($line = fgets($resource))) {
- $lifetime = (int) $line;
- }
-
- if ($lifetime !== 0 && $lifetime < time()) {
- fclose($resource);
-
- return false;
- }
-
- while (false !== ($line = fgets($resource))) {
- $data .= $line;
- }
-
- fclose($resource);
-
- return unserialize($data);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- $lifetime = -1;
- $filename = $this->getFilename($id);
-
- if ( ! is_file($filename)) {
- return false;
- }
-
- $resource = fopen($filename, "r");
-
- if (false !== ($line = fgets($resource))) {
- $lifetime = (int) $line;
- }
-
- fclose($resource);
-
- return $lifetime === 0 || $lifetime > time();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 0) {
- $lifeTime = time() + $lifeTime;
- }
-
- $data = serialize($data);
- $filename = $this->getFilename($id);
-
- return $this->writeFile($filename, $lifeTime . PHP_EOL . $data);
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php
deleted file mode 100644
index 4311d4f..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php
+++ /dev/null
@@ -1,37 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Interface for cache that can be flushed.
- *
- * @link www.doctrine-project.org
- * @since 1.4
- * @author Adirelle
- */
-interface FlushableCache
-{
- /**
- * Flushes all cache entries, globally.
- *
- * @return bool TRUE if the cache entries were successfully flushed, FALSE otherwise.
- */
- public function flushAll();
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php
deleted file mode 100644
index 8afaeea..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php
+++ /dev/null
@@ -1,126 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use \Memcache;
-
-/**
- * Memcache cache provider.
- *
- * @link www.doctrine-project.org
- * @since 2.0
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class MemcacheCache extends CacheProvider
-{
- /**
- * @var Memcache|null
- */
- private $memcache;
-
- /**
- * Sets the memcache instance to use.
- *
- * @param Memcache $memcache
- *
- * @return void
- */
- public function setMemcache(Memcache $memcache)
- {
- $this->memcache = $memcache;
- }
-
- /**
- * Gets the memcache instance used by the cache.
- *
- * @return Memcache|null
- */
- public function getMemcache()
- {
- return $this->memcache;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return $this->memcache->get($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- $flags = null;
- $this->memcache->get($id, $flags);
-
- //if memcache has changed the value of "flags", it means the value exists
- return ($flags !== null);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 30 * 24 * 3600) {
- $lifeTime = time() + $lifeTime;
- }
- return $this->memcache->set($id, $data, 0, (int) $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- // Memcache::delete() returns false if entry does not exist
- return $this->memcache->delete($id) || ! $this->doContains($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return $this->memcache->flush();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $stats = $this->memcache->getStats();
- return array(
- Cache::STATS_HITS => $stats['get_hits'],
- Cache::STATS_MISSES => $stats['get_misses'],
- Cache::STATS_UPTIME => $stats['uptime'],
- Cache::STATS_MEMORY_USAGE => $stats['bytes'],
- Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php
deleted file mode 100644
index 5a0fc0e..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php
+++ /dev/null
@@ -1,147 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use \Memcached;
-
-/**
- * Memcached cache provider.
- *
- * @link www.doctrine-project.org
- * @since 2.2
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class MemcachedCache extends CacheProvider
-{
- /**
- * @var Memcached|null
- */
- private $memcached;
-
- /**
- * Sets the memcache instance to use.
- *
- * @param Memcached $memcached
- *
- * @return void
- */
- public function setMemcached(Memcached $memcached)
- {
- $this->memcached = $memcached;
- }
-
- /**
- * Gets the memcached instance used by the cache.
- *
- * @return Memcached|null
- */
- public function getMemcached()
- {
- return $this->memcached;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return $this->memcached->get($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- return $this->memcached->getMulti($keys) ?: [];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- if ($lifetime > 30 * 24 * 3600) {
- $lifetime = time() + $lifetime;
- }
-
- return $this->memcached->setMulti($keysAndValues, $lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- $this->memcached->get($id);
-
- return $this->memcached->getResultCode() === Memcached::RES_SUCCESS;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 30 * 24 * 3600) {
- $lifeTime = time() + $lifeTime;
- }
- return $this->memcached->set($id, $data, (int) $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return $this->memcached->delete($id)
- || $this->memcached->getResultCode() === Memcached::RES_NOTFOUND;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return $this->memcached->flush();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $stats = $this->memcached->getStats();
- $servers = $this->memcached->getServerList();
- $key = $servers[0]['host'] . ':' . $servers[0]['port'];
- $stats = $stats[$key];
- return array(
- Cache::STATS_HITS => $stats['get_hits'],
- Cache::STATS_MISSES => $stats['get_misses'],
- Cache::STATS_UPTIME => $stats['uptime'],
- Cache::STATS_MEMORY_USAGE => $stats['bytes'],
- Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php
deleted file mode 100644
index 75fe0ca..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php
+++ /dev/null
@@ -1,197 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use MongoBinData;
-use MongoCollection;
-use MongoCursorException;
-use MongoDate;
-
-/**
- * MongoDB cache provider.
- *
- * @since 1.1
- * @author Jeremy Mikola
- */
-class MongoDBCache extends CacheProvider
-{
- /**
- * The data field will store the serialized PHP value.
- */
- const DATA_FIELD = 'd';
-
- /**
- * The expiration field will store a MongoDate value indicating when the
- * cache entry should expire.
- *
- * With MongoDB 2.2+, entries can be automatically deleted by MongoDB by
- * indexing this field with the "expireAfterSeconds" option equal to zero.
- * This will direct MongoDB to regularly query for and delete any entries
- * whose date is older than the current time. Entries without a date value
- * in this field will be ignored.
- *
- * The cache provider will also check dates on its own, in case expired
- * entries are fetched before MongoDB's TTLMonitor pass can expire them.
- *
- * @see http://docs.mongodb.org/manual/tutorial/expire-data/
- */
- const EXPIRATION_FIELD = 'e';
-
- /**
- * @var MongoCollection
- */
- private $collection;
-
- /**
- * Constructor.
- *
- * This provider will default to the write concern and read preference
- * options set on the MongoCollection instance (or inherited from MongoDB or
- * MongoClient). Using an unacknowledged write concern (< 1) may make the
- * return values of delete() and save() unreliable. Reading from secondaries
- * may make contain() and fetch() unreliable.
- *
- * @see http://www.php.net/manual/en/mongo.readpreferences.php
- * @see http://www.php.net/manual/en/mongo.writeconcerns.php
- * @param MongoCollection $collection
- */
- public function __construct(MongoCollection $collection)
- {
- $this->collection = $collection;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- $document = $this->collection->findOne(array('_id' => $id), array(self::DATA_FIELD, self::EXPIRATION_FIELD));
-
- if ($document === null) {
- return false;
- }
-
- if ($this->isExpired($document)) {
- $this->doDelete($id);
- return false;
- }
-
- return unserialize($document[self::DATA_FIELD]->bin);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- $document = $this->collection->findOne(array('_id' => $id), array(self::EXPIRATION_FIELD));
-
- if ($document === null) {
- return false;
- }
-
- if ($this->isExpired($document)) {
- $this->doDelete($id);
- return false;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- try {
- $result = $this->collection->update(
- array('_id' => $id),
- array('$set' => array(
- self::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null),
- self::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY),
- )),
- array('upsert' => true, 'multiple' => false)
- );
- } catch (MongoCursorException $e) {
- return false;
- }
-
- return isset($result['ok']) ? $result['ok'] == 1 : true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- $result = $this->collection->remove(array('_id' => $id));
-
- return isset($result['ok']) ? $result['ok'] == 1 : true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- // Use remove() in lieu of drop() to maintain any collection indexes
- $result = $this->collection->remove();
-
- return isset($result['ok']) ? $result['ok'] == 1 : true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $serverStatus = $this->collection->db->command(array(
- 'serverStatus' => 1,
- 'locks' => 0,
- 'metrics' => 0,
- 'recordStats' => 0,
- 'repl' => 0,
- ));
-
- $collStats = $this->collection->db->command(array('collStats' => 1));
-
- return array(
- Cache::STATS_HITS => null,
- Cache::STATS_MISSES => null,
- Cache::STATS_UPTIME => (isset($serverStatus['uptime']) ? (int) $serverStatus['uptime'] : null),
- Cache::STATS_MEMORY_USAGE => (isset($collStats['size']) ? (int) $collStats['size'] : null),
- Cache::STATS_MEMORY_AVAILABLE => null,
- );
- }
-
- /**
- * Check if the document is expired.
- *
- * @param array $document
- *
- * @return bool
- */
- private function isExpired(array $document)
- {
- return isset($document[self::EXPIRATION_FIELD]) &&
- $document[self::EXPIRATION_FIELD] instanceof MongoDate &&
- $document[self::EXPIRATION_FIELD]->sec < time();
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php
deleted file mode 100644
index df7146d..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php
+++ /dev/null
@@ -1,39 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Interface for cache drivers that allows to get many items at once.
- *
- * @link www.doctrine-project.org
- * @since 1.4
- * @author Asmir Mustafic
- */
-interface MultiGetCache
-{
- /**
- * Returns an associative array of values for keys is found in cache.
- *
- * @param string[] $keys Array of keys to retrieve from cache
- * @return mixed[] Array of retrieved values, indexed by the specified keys.
- * Values that couldn't be retrieved are not contained in this array.
- */
- function fetchMultiple(array $keys);
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php
deleted file mode 100644
index bf87ea9..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php
+++ /dev/null
@@ -1,41 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Interface for cache drivers that allows to put many items at once.
- *
- * @link www.doctrine-project.org
- * @since 1.6
- * @author Daniel Gorgan
- */
-interface MultiPutCache
-{
- /**
- * Returns a boolean value indicating if the operation succeeded.
- *
- * @param array $keysAndValues Array of keys and values to save in cache
- * @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these
- * cache entries (0 => infinite lifeTime).
- *
- * @return bool TRUE if the operation was successful, FALSE if it wasn't.
- */
- function saveMultiple(array $keysAndValues, $lifetime = 0);
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
deleted file mode 100644
index 5e75196..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
+++ /dev/null
@@ -1,120 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Php file cache driver.
- *
- * @since 2.3
- * @author Fabio B. Silva
- */
-class PhpFileCache extends FileCache
-{
- const EXTENSION = '.doctrinecache.php';
-
- /**
- * {@inheritdoc}
- */
- public function __construct($directory, $extension = self::EXTENSION, $umask = 0002)
- {
- parent::__construct($directory, $extension, $umask);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- $value = $this->includeFileForId($id);
-
- if (! $value) {
- return false;
- }
-
- if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) {
- return false;
- }
-
- return $value['data'];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- $value = $this->includeFileForId($id);
-
- if (! $value) {
- return false;
- }
-
- return $value['lifetime'] === 0 || $value['lifetime'] > time();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 0) {
- $lifeTime = time() + $lifeTime;
- }
-
- if (is_object($data) && ! method_exists($data, '__set_state')) {
- throw new \InvalidArgumentException(
- "Invalid argument given, PhpFileCache only allows objects that implement __set_state() " .
- "and fully support var_export(). You can use the FilesystemCache to save arbitrary object " .
- "graphs using serialize()/deserialize()."
- );
- }
-
- $filename = $this->getFilename($id);
-
- $value = array(
- 'lifetime' => $lifeTime,
- 'data' => $data
- );
-
- $value = var_export($value, true);
- $code = sprintf('writeFile($filename, $code);
- }
-
- /**
- * @param string $id
- *
- * @return array|false
- */
- private function includeFileForId($id)
- {
- $fileName = $this->getFilename($id);
-
- // note: error suppression is still faster than `file_exists`, `is_file` and `is_readable`
- $value = @include $fileName;
-
- if (! isset($value['lifetime'])) {
- return false;
- }
-
- return $value;
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php
deleted file mode 100644
index bcd2749..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php
+++ /dev/null
@@ -1,136 +0,0 @@
-
- */
-class PredisCache extends CacheProvider
-{
- /**
- * @var ClientInterface
- */
- private $client;
-
- /**
- * @param ClientInterface $client
- *
- * @return void
- */
- public function __construct(ClientInterface $client)
- {
- $this->client = $client;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- $result = $this->client->get($id);
- if (null === $result) {
- return false;
- }
-
- return unserialize($result);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- $fetchedItems = call_user_func_array(array($this->client, 'mget'), $keys);
-
- return array_map('unserialize', array_filter(array_combine($keys, $fetchedItems)));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- if ($lifetime) {
- $success = true;
-
- // Keys have lifetime, use SETEX for each of them
- foreach ($keysAndValues as $key => $value) {
- $response = $this->client->setex($key, $lifetime, serialize($value));
-
- if ((string) $response != 'OK') {
- $success = false;
- }
- }
-
- return $success;
- }
-
- // No lifetime, use MSET
- $response = $this->client->mset(array_map(function ($value) {
- return serialize($value);
- }, $keysAndValues));
-
- return (string) $response == 'OK';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return (bool) $this->client->exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- $data = serialize($data);
- if ($lifeTime > 0) {
- $response = $this->client->setex($id, $lifeTime, $data);
- } else {
- $response = $this->client->set($id, $data);
- }
-
- return $response === true || $response == 'OK';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return $this->client->del($id) >= 0;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- $response = $this->client->flushdb();
-
- return $response === true || $response == 'OK';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $info = $this->client->info();
-
- return array(
- Cache::STATS_HITS => $info['Stats']['keyspace_hits'],
- Cache::STATS_MISSES => $info['Stats']['keyspace_misses'],
- Cache::STATS_UPTIME => $info['Server']['uptime_in_seconds'],
- Cache::STATS_MEMORY_USAGE => $info['Memory']['used_memory'],
- Cache::STATS_MEMORY_AVAILABLE => false
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php
deleted file mode 100644
index 22add66..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php
+++ /dev/null
@@ -1,180 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use Redis;
-
-/**
- * Redis cache provider.
- *
- * @link www.doctrine-project.org
- * @since 2.2
- * @author Osman Ungur
- */
-class RedisCache extends CacheProvider
-{
- /**
- * @var Redis|null
- */
- private $redis;
-
- /**
- * Sets the redis instance to use.
- *
- * @param Redis $redis
- *
- * @return void
- */
- public function setRedis(Redis $redis)
- {
- $redis->setOption(Redis::OPT_SERIALIZER, $this->getSerializerValue());
- $this->redis = $redis;
- }
-
- /**
- * Gets the redis instance used by the cache.
- *
- * @return Redis|null
- */
- public function getRedis()
- {
- return $this->redis;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return $this->redis->get($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- $fetchedItems = array_combine($keys, $this->redis->mget($keys));
-
- // Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data.
- $foundItems = array();
-
- foreach ($fetchedItems as $key => $value) {
- if (false !== $value || $this->redis->exists($key)) {
- $foundItems[$key] = $value;
- }
- }
-
- return $foundItems;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- if ($lifetime) {
- $success = true;
-
- // Keys have lifetime, use SETEX for each of them
- foreach ($keysAndValues as $key => $value) {
- if (!$this->redis->setex($key, $lifetime, $value)) {
- $success = false;
- }
- }
-
- return $success;
- }
-
- // No lifetime, use MSET
- return (bool) $this->redis->mset($keysAndValues);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return $this->redis->exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- if ($lifeTime > 0) {
- return $this->redis->setex($id, $lifeTime, $data);
- }
-
- return $this->redis->set($id, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return $this->redis->delete($id) >= 0;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return $this->redis->flushDB();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $info = $this->redis->info();
- return array(
- Cache::STATS_HITS => $info['keyspace_hits'],
- Cache::STATS_MISSES => $info['keyspace_misses'],
- Cache::STATS_UPTIME => $info['uptime_in_seconds'],
- Cache::STATS_MEMORY_USAGE => $info['used_memory'],
- Cache::STATS_MEMORY_AVAILABLE => false
- );
- }
-
- /**
- * Returns the serializer constant to use. If Redis is compiled with
- * igbinary support, that is used. Otherwise the default PHP serializer is
- * used.
- *
- * @return integer One of the Redis::SERIALIZER_* constants
- */
- protected function getSerializerValue()
- {
- if (defined('HHVM_VERSION')) {
- return Redis::SERIALIZER_PHP;
- }
-
- if (defined('Redis::SERIALIZER_IGBINARY') && extension_loaded('igbinary')) {
- return Redis::SERIALIZER_IGBINARY;
- }
-
- return Redis::SERIALIZER_PHP;
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php
deleted file mode 100644
index 0baa3f2..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php
+++ /dev/null
@@ -1,250 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use Riak\Bucket;
-use Riak\Connection;
-use Riak\Input;
-use Riak\Exception;
-use Riak\Object;
-
-/**
- * Riak cache provider.
- *
- * @link www.doctrine-project.org
- * @since 1.1
- * @author Guilherme Blanco
- */
-class RiakCache extends CacheProvider
-{
- const EXPIRES_HEADER = 'X-Riak-Meta-Expires';
-
- /**
- * @var \Riak\Bucket
- */
- private $bucket;
-
- /**
- * Sets the riak bucket instance to use.
- *
- * @param \Riak\Bucket $bucket
- */
- public function __construct(Bucket $bucket)
- {
- $this->bucket = $bucket;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- try {
- $response = $this->bucket->get($id);
-
- // No objects found
- if ( ! $response->hasObject()) {
- return false;
- }
-
- // Check for attempted siblings
- $object = ($response->hasSiblings())
- ? $this->resolveConflict($id, $response->getVClock(), $response->getObjectList())
- : $response->getFirstObject();
-
- // Check for expired object
- if ($this->isExpired($object)) {
- $this->bucket->delete($object);
-
- return false;
- }
-
- return unserialize($object->getContent());
- } catch (Exception\RiakException $e) {
- // Covers:
- // - Riak\ConnectionException
- // - Riak\CommunicationException
- // - Riak\UnexpectedResponseException
- // - Riak\NotFoundException
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- try {
- // We only need the HEAD, not the entire object
- $input = new Input\GetInput();
-
- $input->setReturnHead(true);
-
- $response = $this->bucket->get($id, $input);
-
- // No objects found
- if ( ! $response->hasObject()) {
- return false;
- }
-
- $object = $response->getFirstObject();
-
- // Check for expired object
- if ($this->isExpired($object)) {
- $this->bucket->delete($object);
-
- return false;
- }
-
- return true;
- } catch (Exception\RiakException $e) {
- // Do nothing
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- try {
- $object = new Object($id);
-
- $object->setContent(serialize($data));
-
- if ($lifeTime > 0) {
- $object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime));
- }
-
- $this->bucket->put($object);
-
- return true;
- } catch (Exception\RiakException $e) {
- // Do nothing
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- try {
- $this->bucket->delete($id);
-
- return true;
- } catch (Exception\BadArgumentsException $e) {
- // Key did not exist on cluster already
- } catch (Exception\RiakException $e) {
- // Covers:
- // - Riak\Exception\ConnectionException
- // - Riak\Exception\CommunicationException
- // - Riak\Exception\UnexpectedResponseException
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- try {
- $keyList = $this->bucket->getKeyList();
-
- foreach ($keyList as $key) {
- $this->bucket->delete($key);
- }
-
- return true;
- } catch (Exception\RiakException $e) {
- // Do nothing
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- // Only exposed through HTTP stats API, not Protocol Buffers API
- return null;
- }
-
- /**
- * Check if a given Riak Object have expired.
- *
- * @param \Riak\Object $object
- *
- * @return bool
- */
- private function isExpired(Object $object)
- {
- $metadataMap = $object->getMetadataMap();
-
- return isset($metadataMap[self::EXPIRES_HEADER])
- && $metadataMap[self::EXPIRES_HEADER] < time();
- }
-
- /**
- * On-read conflict resolution. Applied approach here is last write wins.
- * Specific needs may override this method to apply alternate conflict resolutions.
- *
- * {@internal Riak does not attempt to resolve a write conflict, and store
- * it as sibling of conflicted one. By following this approach, it is up to
- * the next read to resolve the conflict. When this happens, your fetched
- * object will have a list of siblings (read as a list of objects).
- * In our specific case, we do not care about the intermediate ones since
- * they are all the same read from storage, and we do apply a last sibling
- * (last write) wins logic.
- * If by any means our resolution generates another conflict, it'll up to
- * next read to properly solve it.}
- *
- * @param string $id
- * @param string $vClock
- * @param array $objectList
- *
- * @return \Riak\Object
- */
- protected function resolveConflict($id, $vClock, array $objectList)
- {
- // Our approach here is last-write wins
- $winner = $objectList[count($objectList)];
-
- $putInput = new Input\PutInput();
- $putInput->setVClock($vClock);
-
- $mergedObject = new Object($id);
- $mergedObject->setContent($winner->getContent());
-
- $this->bucket->put($mergedObject, $putInput);
-
- return $mergedObject;
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php
deleted file mode 100644
index 0bf6e4d..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php
+++ /dev/null
@@ -1,220 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-use SQLite3;
-use SQLite3Result;
-
-/**
- * SQLite3 cache provider.
- *
- * @since 1.4
- * @author Jake Bell
- */
-class SQLite3Cache extends CacheProvider
-{
- /**
- * The ID field will store the cache key.
- */
- const ID_FIELD = 'k';
-
- /**
- * The data field will store the serialized PHP value.
- */
- const DATA_FIELD = 'd';
-
- /**
- * The expiration field will store a date value indicating when the
- * cache entry should expire.
- */
- const EXPIRATION_FIELD = 'e';
-
- /**
- * @var SQLite3
- */
- private $sqlite;
-
- /**
- * @var string
- */
- private $table;
-
- /**
- * Constructor.
- *
- * Calling the constructor will ensure that the database file and table
- * exist and will create both if they don't.
- *
- * @param SQLite3 $sqlite
- * @param string $table
- */
- public function __construct(SQLite3 $sqlite, $table)
- {
- $this->sqlite = $sqlite;
- $this->table = (string) $table;
-
- list($id, $data, $exp) = $this->getFields();
-
- return $this->sqlite->exec(sprintf(
- 'CREATE TABLE IF NOT EXISTS %s(%s TEXT PRIMARY KEY NOT NULL, %s BLOB, %s INTEGER)',
- $table,
- $id,
- $data,
- $exp
- ));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- if ($item = $this->findById($id)) {
- return unserialize($item[self::DATA_FIELD]);
- }
-
- return false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return null !== $this->findById($id, false);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- $statement = $this->sqlite->prepare(sprintf(
- 'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)',
- $this->table,
- implode(',', $this->getFields())
- ));
-
- $statement->bindValue(':id', $id);
- $statement->bindValue(':data', serialize($data), SQLITE3_BLOB);
- $statement->bindValue(':expire', $lifeTime > 0 ? time() + $lifeTime : null);
-
- return $statement->execute() instanceof SQLite3Result;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- list($idField) = $this->getFields();
-
- $statement = $this->sqlite->prepare(sprintf(
- 'DELETE FROM %s WHERE %s = :id',
- $this->table,
- $idField
- ));
-
- $statement->bindValue(':id', $id);
-
- return $statement->execute() instanceof SQLite3Result;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return $this->sqlite->exec(sprintf('DELETE FROM %s', $this->table));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- // no-op.
- }
-
- /**
- * Find a single row by ID.
- *
- * @param mixed $id
- * @param bool $includeData
- *
- * @return array|null
- */
- private function findById($id, $includeData = true)
- {
- list($idField) = $fields = $this->getFields();
-
- if (!$includeData) {
- $key = array_search(static::DATA_FIELD, $fields);
- unset($fields[$key]);
- }
-
- $statement = $this->sqlite->prepare(sprintf(
- 'SELECT %s FROM %s WHERE %s = :id LIMIT 1',
- implode(',', $fields),
- $this->table,
- $idField
- ));
-
- $statement->bindValue(':id', $id, SQLITE3_TEXT);
-
- $item = $statement->execute()->fetchArray(SQLITE3_ASSOC);
-
- if ($item === false) {
- return null;
- }
-
- if ($this->isExpired($item)) {
- $this->doDelete($id);
-
- return null;
- }
-
- return $item;
- }
-
- /**
- * Gets an array of the fields in our table.
- *
- * @return array
- */
- private function getFields()
- {
- return array(static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD);
- }
-
- /**
- * Check if the item is expired.
- *
- * @param array $item
- *
- * @return bool
- */
- private function isExpired(array $item)
- {
- return isset($item[static::EXPIRATION_FIELD]) &&
- $item[self::EXPIRATION_FIELD] !== null &&
- $item[self::EXPIRATION_FIELD] < time();
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php
deleted file mode 100644
index a6399ec..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php
+++ /dev/null
@@ -1,25 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-class Version
-{
- const VERSION = '1.6.1-DEV';
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php
deleted file mode 100644
index 65e8456..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php
+++ /dev/null
@@ -1,78 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Void cache driver. The cache could be of use in tests where you don`t need to cache anything.
- *
- * @link www.doctrine-project.org
- * @since 1.5
- * @author Kotlyar Maksim
- */
-class VoidCache extends CacheProvider
-{
- /**
- * {@inheritDoc}
- */
- protected function doFetch($id)
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doContains($id)
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doDelete($id)
- {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doFlush()
- {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected function doGetStats()
- {
- return;
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php
deleted file mode 100644
index 8a250b2..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php
+++ /dev/null
@@ -1,109 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * WinCache cache provider.
- *
- * @link www.doctrine-project.org
- * @since 2.2
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class WinCacheCache extends CacheProvider
-{
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return wincache_ucache_get($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return wincache_ucache_exists($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return wincache_ucache_set($id, $data, $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return wincache_ucache_delete($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- return wincache_ucache_clear();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFetchMultiple(array $keys)
- {
- return wincache_ucache_get($keys);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
- {
- $result = wincache_ucache_set($keysAndValues, null, $lifetime);
-
- return empty($result);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $info = wincache_ucache_info();
- $meminfo = wincache_ucache_meminfo();
-
- return array(
- Cache::STATS_HITS => $info['total_hit_count'],
- Cache::STATS_MISSES => $info['total_miss_count'],
- Cache::STATS_UPTIME => $info['total_cache_uptime'],
- Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'],
- Cache::STATS_MEMORY_AVAILABLE => $meminfo['memory_free'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php
deleted file mode 100644
index a2c4ca5..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php
+++ /dev/null
@@ -1,112 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Xcache cache driver.
- *
- * @link www.doctrine-project.org
- * @since 2.0
- * @author Benjamin Eberlei
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author David Abdemoulaie
- */
-class XcacheCache extends CacheProvider
-{
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return $this->doContains($id) ? unserialize(xcache_get($id)) : false;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return xcache_isset($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return xcache_set($id, serialize($data), (int) $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return xcache_unset($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- $this->checkAuthorization();
-
- xcache_clear_cache(XC_TYPE_VAR);
-
- return true;
- }
-
- /**
- * Checks that xcache.admin.enable_auth is Off.
- *
- * @return void
- *
- * @throws \BadMethodCallException When xcache.admin.enable_auth is On.
- */
- protected function checkAuthorization()
- {
- if (ini_get('xcache.admin.enable_auth')) {
- throw new \BadMethodCallException(
- 'To use all features of \Doctrine\Common\Cache\XcacheCache, '
- . 'you must set "xcache.admin.enable_auth" to "Off" in your php.ini.'
- );
- }
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- $this->checkAuthorization();
-
- $info = xcache_info(XC_TYPE_VAR, 0);
- return array(
- Cache::STATS_HITS => $info['hits'],
- Cache::STATS_MISSES => $info['misses'],
- Cache::STATS_UPTIME => null,
- Cache::STATS_MEMORY_USAGE => $info['size'],
- Cache::STATS_MEMORY_AVAILABLE => $info['avail'],
- );
- }
-}
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php
deleted file mode 100644
index 6e35ac8..0000000
--- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php
+++ /dev/null
@@ -1,83 +0,0 @@
-.
- */
-
-namespace Doctrine\Common\Cache;
-
-/**
- * Zend Data Cache cache driver.
- *
- * @link www.doctrine-project.org
- * @since 2.0
- * @author Ralph Schindler
- * @author Guilherme Blanco
- */
-class ZendDataCache extends CacheProvider
-{
- /**
- * {@inheritdoc}
- */
- protected function doFetch($id)
- {
- return zend_shm_cache_fetch($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doContains($id)
- {
- return (false !== zend_shm_cache_fetch($id));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return zend_shm_cache_store($id, $data, $lifeTime);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDelete($id)
- {
- return zend_shm_cache_delete($id);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doFlush()
- {
- $namespace = $this->getNamespace();
- if (empty($namespace)) {
- return zend_shm_cache_clear();
- }
- return zend_shm_cache_clear($namespace);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doGetStats()
- {
- return null;
- }
-}
diff --git a/version b/version
deleted file mode 100644
index bb425e5..0000000
--- a/version
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Update Data:
-20200607-1856.19 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 现在可以安装到阿里函数计算FC了。php空间可以一键更新了。可以设置某个盘替换sharpoint.com域名为你的反代域名。新增disableShowThumb,customTheme。
-20200503-1848.18 Rebuild theme. Add custom Css & custom Script, add FunctionalityFile: head.omf & foot.omf 重建主题文件结构。增加自定义css与自定义script。增加2个功能文件:head.omf、foot.omf。
-20200402-1830.17 Oneclick update can select which branch to update. Now use the accept language instead of the language config.一键更新可以选择哪个分支了。现在开始使用浏览器语言,抛弃language设置。
-20200326-0001.16 You can add sharepoint site drive as a disk,you must reinstall after update.可以将sharepoint网站添加成一个盘,由于结构改变,升级后只能重装。
-20200321-1830.15 after this update, then 'index.html' function will bug in other theme.cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。本次更新后,'index.html'功能在其它主题会导致bug。文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
-20200311-2150.14 Add a switch, can download a known file or not, while the folder is encrypted.Hide time and size in mobile.Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after the folder.增加一个开关,在目录加密后能否下载其中的某个文件。在手机上浏览时,隐藏修改时间跟大小。加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
-20200229-1300.13 In SCF, some config can input Special symbols now, like ?&= 。在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
-20200225-1310.12 Can update by one click any time. fix bugs: special tag, reupload.可以不管版本直接一键更新(覆盖)了。修复可以使用特殊onedrive标签的bug,修复断网续传的问题。
-20200222-2130.11 you can set background now. fix bug: 2nd disk upload.可以设置背景图片了。第2个盘上传后链接不对。
-20200222-1700.09 Can copy file and folder now.可以复制文件跟目录了。
-20200220-1220.08 Multy Mode! You can add more Onedrive in one project (bind Onedrive in setup). And now, heroku apps can update in setup! 多盘来了,在设置中添加Onedrive,另,heroku 上也能一键更新了!
-20200215-1850.07 fix: head.md not show if no readme.md.修复当没有readme的时候就不显示head的问题。
-20200215-1700.06 classic theme can read the head.md file now.classic主题可以处理head.md文件了。
-20200202-2010.05 refresh token expires in 90 day, save a new token per month. classic theme add some icon for admin.refresh token 90天过期,所以每月保存一个新的token。classic主题加了点管理图标。
-20200129-2050.04 if there is 'index.html', then do not show file but show the index.html, except admin.如果有index.html,就不显示文件列表了,直接显示index.html内容,除非是管理员。
-20200120.02 fix domain_path do not work. domain_path正常工作了。
-20200118.01 Can be deploy to heroku/SCF/normal space.Change imgup_path to guestup_path, plz make sure it after update. SCF、heroku、普通VPS,三种环境都可以用了。将imgup_path改成guestup_path更符合用途,更新后请注意更改。
-
\ No newline at end of file
diff --git a/writeable.sh b/writeable.sh
deleted file mode 100644
index 8d3b5dc..0000000
--- a/writeable.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-OneManagerPath=`cd $(dirname $0);pwd -P`
-cd ${OneManagerPath}
-chmod 666 config.php