diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..c548b41
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,15 @@
+# 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
new file mode 100644
index 0000000..b3f61c0
--- /dev/null
+++ b/app.json
@@ -0,0 +1,7 @@
+{
+ "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
new file mode 100644
index 0000000..0b06330
--- /dev/null
+++ b/common.php
@@ -0,0 +1,1686 @@
+ $url ]);
+ }
+ }
+ if (getConfig('admin')!='')
+ if ( (isset($_COOKIE['admin'])&&$_COOKIE['admin']==md5(getConfig('admin'))) || (isset($_POST['password1'])&&$_POST['password1']==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'] = $path;
+ $pos = strpos($path, '/');
+ if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
+ if (!in_array($_SERVER['disktag'], $disktags)) 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'&&substr($_GET['filename'],-4)=='.tmp') {
+ // del '.tmp' without login. 无需登录即可删除.tmp后缀文件
+ error_log('del.tmp:GET,'.json_encode($_GET,JSON_PRETTY_PRINT));
+ $tmp = MSAPI('DELETE',path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . spurlencode($_GET['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' );
+ $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);
+ } 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 (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) {
+ if (isset($_GET['url'])) return output($tmp[rand(0,count($tmp)-1)], 200);
+ return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]);
+ } 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')) ) return output('', 302, [ 'Location' => $files[$_SERVER['DownurlStrName']] ]);
+ }
+ 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 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']);
+ }
+ error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT));
+ savecache('access_token', $_SERVER['access_token']);
+ if (getConfig('sharecookie')==''||getConfig('shareapiurl')=='') setConfig([ 'sharecookie' => $_SERVER['sharecookie'], 'shareapiurl' => $_SERVER['api_url'] ]);
+ } else {
+ $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 );
+ 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=' . $refresh_token);
+ error_log('failed to get access_token. response' . json_encode($ret));
+ throw new Exception($response['stat'].', failed to get access_token.'.$response['body']);
+ }
+ error_log('Get access token:'.json_encode($ret, 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',
+ 'favicon.ico',
+ ];
+
+ 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)
+{
+ if (getConfig('Drive_ver')=='MS') $url = 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname');
+ if (getConfig('Drive_ver')=='CN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/sites/'.getConfig('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($_COOKIE['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')
+{
+ $timezones = array(
+ '-12'=>'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'
+ );
+ 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');
+ $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 = '/')
+{
+ $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!='') return output($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']);
+ return output($files['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) {
+ $fileinfo['name'] = $_GET['upbigfilename'];
+ $fileinfo['size'] = $_GET['filesize'];
+ $fileinfo['lastModified'] = $_GET['lastModified'];
+ $filename = spurlencode( $fileinfo['name'] );
+ $cachefilename = '.' . $fileinfo['lastModified'] . '_' . $fileinfo['size'] . '_' . $filename . '.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);
+ 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=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']);
+ } else {
+ // files num < 200 , then cache
+ //if (isset($files['children'])) {
+ $files['children'] = children_name($files['children']);
+ //}
+ 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=name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'];
+ } else {
+ $url .= '/children?$select=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 render_list($path = '', $files = '')
+{
+ global $exts;
+ global $constStr;
+
+ if (isset($files['children']['index.html']) && !$_SERVER['admin']) {
+ $htmlcontent = fetch_files(spurlencode(path_format($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($path,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($_COOKIE['timezone']));
+ @ob_start();
+
+ $theme = getConfig('theme');
+ if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
+ include 'theme/'.$theme;
+
+ $html = '' . ob_get_clean();
+ //if (isset($htmlpage['statusCode'])) return $htmlpage;
+ if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
+ return output($html,$statusCode);
+}
+
+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, try 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 . ''.getconstStr('Refresh').' ', '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'];
+ }
+ if ($_POST['usesharepoint']=='on') {
+ $tmp['usesharepoint'] = $_POST['usesharepoint'];
+ $tmp['sharepointname'] = $_POST['sharepointname'];
+ }
+ }
+ $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;
+ 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') . '
+'.getconstStr('Refresh').' ';
+ $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();
+ //sleep(3);
+ $html .= getconstStr('Success') . '!
+'.getconstStr('Refresh').' ';
+ $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 .= '
+ ';
+ }
+ $html .= '
+
';
+ }
+ }
+ $html .= '
+'.getconstStr('AddDisk').' ';
+ if (!((isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud')||(isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app'))) {
+ $html .= '
+'.getconstStr('VPSnotupdate').' ';
+ } else {
+ $html .= '
+
+
+';
+ }
+ if ($needUpdate) {
+ $html .= '
+ ' . str_replace("\r", ' ',$_SERVER['github_version']) . '
+
';
+ } else {
+ $html .= getconstStr('NotNeedUpdate');
+ }
+ return message($html, getconstStr('Setup'));
+}
diff --git a/config.php b/config.php
new file mode 100644
index 0000000..4fe2ccb
--- /dev/null
+++ b/config.php
@@ -0,0 +1,4 @@
+ [
+ '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}\'.',
+ 'domain_path' => 'more custom domain, format is a1.com:/dirto/path1|b2.com:/path2',
+ 'diskname' => 'The disk name you want show.',
+ 'disktag' => 'A tag used in store config and url.',
+ 'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password',
+ 'background' => 'Set an url as background photo.',
+ 'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
+ 'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md',
+ 'passfile' => 'The password of dir will save in this file.',
+ 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.',
+ 'sitename' => 'sitename',
+ 'Onedrive_ver' => 'Onedrive version',
+ ],
+ 'zh-cn' => [
+ 'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
+ 'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。',
+ 'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2,比private_path优先。',
+ 'diskname' => '这个盘你想显示什么名称。',
+ 'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
+ 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
+ 'background' => '设置一个url作为背景。',
+ 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
+ 'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md',
+ 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
+ 'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。',
+ 'sitename' => '网站的名称',
+ 'Onedrive_ver' => 'Onedrive版本',
+ ],
+ 'ja' => [
+ 'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
+ 'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?admin \'ではなく、\'?この設定の値\'。',
+ 'domain_path' => '複数のカスタムドメイン名を使用する場合、各ドメイン名に表示されるディレクトリを指定します。形式はa1.com:/dirto/path1|b1.com:/path2で、private_pathよりも優先されます。',
+ 'diskname' => '',
+ 'disktag' => '',
+ 'downloadencrypt' => '',
+ 'background' => '',
+ 'guestup_path' => 'マップベッドのパスを設定します。この値が設定されていない場合、ディレクトリの内容は通常ファイルにリストされ、設定後はアップロードインターフェイスのみが表示されます。',
+ 'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。',
+ 'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり、private_pathの上位にはなりません(publicはprivate以上のものを見ることができません。それ以外は異なります。)。',
+ 'sitename' => 'ウェブサイト名',
+ 'Onedrive_ver' => 'Onedriveバージョン',
+ ],
+ 'ko-kr' => [
+ 'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
+ 'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?Admin\'이 아니라 \ ?이 설정의 값 \'입니다.',
+ 'domain_path' => '여러 개의 사용자 정의 도메인 이름을 사용하는 경우 각 도메인 이름에 표시되는 디렉토리를 지정하십시오. 형식은 a1.com:/dirto/path1|b1.com:/path2이며 private_path보다 우선합니다.',
+ 'diskname' => '이 디스크에 어떤 이름을 표시 하시겠습니까?',
+ 'disktag' => '레이블은 구성을 저장하는 데 사용되며 디스크가 여러 개인 경우 URL에 표시됩니다.',
+ 'downloadencrypt' => '',
+ 'background' => 'URL을 배경으로 설정하거나 표시하는.',
+ 'guestup_path' => '방문자의 업로드 경로 (맵 베드 경로)를 설정합니다.이 값을 설정하지 않으면 디렉토리의 내용이 파일로 표시되고 설정 후에는 업로드 인터페이스 만 표시되고 파일은 표시되지 않습니다 (로그인 후 표시).',
+ 'passfile' => '사용자 정의 비밀번호 파일의 이름은 \'pppppp\' \'aaaa.txt \'등이 될 수 있으며 디렉토리가 나열되어 있으면 표시되지 않으며 비밀번호를 알고있는 경우에만이 파일을 보거나 다운로드 할 수 있습니다. 암호는이 파일의 내용이며 공백이거나 한국어 일 수 있습니다.',
+ 'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.',
+ 'sitename' => '웹 사이트 이름',
+ 'Onedrive_ver' => 'Onedrive 버전',
+ ],
+ 'fa' => [
+ 'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمیآید',
+ 'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?admin\ نیست بلکه \?{مقدار ورودی شما}\ است.',
+ 'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
+ 'diskname' => 'نام دیسک که میخواهید نشان دهید.',
+ 'disktag' => 'تگی که در ذخیره پیکربندی و نشانی اینترنتی استفاده میشود.',
+ 'downloadencrypt' => '',
+ 'background' => 'تنظیم عکس پشت زمینه به صورت url یا قرار دادن بک گراند به صورت دستی در مسیر نشان داده شده.',
+ 'guestup_path' => 'قبل از تنظیم این گزینه ، فایل آپلود guest را تنظیم کنید ، پرونده های موجود در این حالت به صورت عادی نشان داده می شوند.',
+ 'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.',
+ 'public_path' => 'این مسیر Onedrive را هنگامی که از طریق آدرس طولانی API Gateway استفاده می کنید ، نشان دهید. فایل های نمایش عمومی کمتر از خصوصی.',
+ 'sitename' => 'نام سایت',
+ 'Onedrive_ver' => 'ورژن Onedrive',
+ ],
+ ],
+ 'SetSecretsFirst' => [
+ 'en-us' => 'Set API in Config first! or reinstall.',
+ 'zh-cn' => '先在环境变量设置API!或重装。',
+ 'ja' => '最初に環境変数にAPIを設定してください!',
+ 'ko-kr' => '먼저 환경 변수에서 API를 설정하십시오! 또는 다시 설치하십시오.',
+ 'fa' => 'ابتدا API را در پیکربندی تنظیم کنید! یا دوباره نصب کنید.',
+ ],
+ 'RefreshtoLogin' => [
+ 'en-us' => 'Refresh and login.',
+ 'zh-cn' => '请刷新 页面后重新登录',
+ 'ja' => 'ページを更新 して、再度ログインしてください',
+ 'ko-kr' => '페이지를 새로 고침 font> 하시고 다시 로그인하십시오',
+ 'fa' => 'رفرش و لاگین.',
+ ],
+ 'AdminLogin' => [
+ 'en-us' => 'Admin Login',
+ 'zh-cn' => '管理登录',
+ 'ja' => 'ログインを管理する',
+ 'ko-kr' => '로그인 관리',
+ 'fa' => 'ورود ادمین',
+ ],
+ 'LoginSuccess' => [
+ 'en-us' => 'Login Success!',
+ 'zh-cn' => '登录成功,正在跳转',
+ 'ja' => 'ログイン成功、ジャンプ',
+ 'ko-kr' => '로그인 성공, 점프',
+ 'fa' => 'ورود با موفقیت انجام شد!',
+ ],
+ 'InputPassword' => [
+ 'en-us' => 'Input Password',
+ 'zh-cn' => '输入密码',
+ 'ja' => 'パスワードを入力してください',
+ 'ko-kr' => '비밀번호 입력',
+ 'fa' => 'رمز عبور را وارد کنید',
+ ],
+ 'Login' => [
+ 'en-us' => 'Login',
+ 'zh-cn' => '登录',
+ 'ja' => 'サインイン',
+ 'ko-kr' => '로그인',
+ 'fa' => 'ورود',
+ ],
+ 'encrypt' => [
+ 'en-us' => 'Encrypt',
+ 'zh-cn' => '加密',
+ 'ja' => '暗号化',
+ 'ko-kr' => '암호화',
+ 'fa' => 'رمزگذاری',
+ ],
+ 'SetpassfileBfEncrypt' => [
+ 'en-us' => 'Set \'passfile\' in Environments before encrypt',
+ 'zh-cn' => '先在环境变量设置passfile才能加密',
+ 'ja' => '最初に暗号化する環境変数にパスファイルを設定します',
+ 'ko-kr' => '암호화하기 전에 환경 변수에 패스 파일을 설정하십시오',
+ 'fa' => 'قبل از رمزگذاری \ "pass file \" را در محیط تنظیم کنید',
+ ],
+ 'updateProgram' => [
+ 'en-us' => 'Update Program',
+ 'zh-cn' => '一键更新',
+ 'ja' => 'ワンクリック更新',
+ 'ko-kr' => '원 클릭 업데이트',
+ 'fa' => 'برنامه را به روز کنید',
+ ],
+ 'UpdateSuccess' => [
+ 'en-us' => 'Program update Success!',
+ 'zh-cn' => '程序升级成功!',
+ 'ja' => 'プログラムのアップグレードに成功しました!',
+ 'ko-kr' => '프로그램 업그레이드 성공!',
+ 'fa' => 'موفقیت به روز رسانی برنامه!',
+ ],
+ 'Setup' => [
+ 'en-us' => 'Setup',
+ 'zh-cn' => '设置',
+ 'ja' => '設定する',
+ 'ko-kr' => '설정',
+ 'fa' => 'نصب',
+ ],
+ 'Back' => [
+ 'en-us' => 'Back',
+ 'zh-cn' => '返回',
+ 'ja' => 'back',
+ 'ko-kr' => '돌아 가기',
+ 'fa' => 'بازگشت',
+ ],
+ 'NotNeedUpdate' => [
+ 'en-us' => 'Not Need Update',
+ 'zh-cn' => '不需要更新',
+ 'ja' => '更新不要',
+ 'ko-kr' => '업데이트가 필요하지 않습니다',
+ 'fa' => 'آپدیت لازم نیست',
+ ],
+ 'PlatformConfig' => [
+ 'en-us' => 'Platform Config',
+ 'zh-cn' => '平台变量',
+ 'ja' => 'プラットフォーム変数',
+ 'ko-kr' => '플랫폼 변수',
+ 'fa' => 'پیکربندی پلتفرم',
+ ],
+ 'DelDisk' => [
+ 'en-us' => 'Del This Disk',
+ 'zh-cn' => '删除此盘',
+ 'ja' => 'このディスクを削除',
+ 'ko-kr' => '이 디스크를 삭제',
+ 'fa' => 'پاک کردن این دیسک',
+ ],
+ 'AddDisk' => [
+ 'en-us' => 'Add Onedrive Disk',
+ 'zh-cn' => '添加Onedrive盘',
+ 'ja' => 'Onedriveを追加',
+ 'ko-kr' => 'Onedrive 추가',
+ 'fa' => 'اضافه کردن دیسک Onedrive',
+ ],
+ 'Home' => [
+ 'en-us' => 'Home',
+ 'zh-cn' => '首页',
+ 'ja' => 'ホーム',
+ 'ko-kr' => '홈',
+ 'fa' => 'خانه',
+ ],
+ 'NeedUpdate' => [
+ 'en-us' => 'Program can update Click setup in Operate at top.',
+ 'zh-cn' => '可以升级程序 在上方管理菜单中 进入设置页面升级',
+ 'ja' => 'プログラムをアップグレードできます 上記の管理メニューで アップグレードする設定ページに入ります',
+ 'ko-kr' => '프로그램을 업그레이드 할 수 있습니다. 위의 관리 메뉴에서 업그레이드 할 설정 페이지를 입력하십시오.',
+ 'fa' => 'برنامه می تواند آپدیت شود روی گزینه نصب در بالای صفحه کلیک کنید.',
+ ],
+ 'Operate' => [
+ 'en-us' => 'Operate',
+ 'zh-cn' => '管理',
+ 'ja' => '管理',
+ 'ko-kr' => '관리',
+ 'fa' => 'مدیریت',
+ ],
+ 'Logout' => [
+ 'en-us' => 'Logout',
+ 'zh-cn' => '登出',
+ 'ja' => 'ログアウトする',
+ 'ko-kr' => '로그 아웃',
+ 'fa' => 'خروج',
+ ],
+ 'Create' => [
+ 'en-us' => 'Create',
+ 'zh-cn' => '新建',
+ 'ja' => '新しい',
+ 'ko-kr' => '새로운',
+ 'fa' => 'ایجاد کردن',
+ ],
+ 'Download' => [
+ 'en-us' => 'download',
+ 'zh-cn' => '下载',
+ 'ja' => 'ダウンロードする',
+ 'ko-kr' => '다운로드',
+ 'fa' => 'دانلود',
+ ],
+ 'ClicktoEdit' => [
+ 'en-us' => 'Click to edit',
+ 'zh-cn' => '点击后编辑',
+ 'ja' => 'クリック後に編集',
+ 'ko-kr' => '클릭 후 편집',
+ 'fa' => 'برای ویرایش کلیک کنید',
+ ],
+ 'Save' => [
+ 'en-us' => 'Save',
+ 'zh-cn' => '保存',
+ 'ja' => '保存する',
+ 'ko-kr' => '저장',
+ 'fa' => 'ذخیره',
+ ],
+ 'FileNotSupport' => [
+ 'en-us' => 'File not support preview.',
+ 'zh-cn' => '文件格式不支持预览',
+ 'ja' => 'ファイル形式はプレビューをサポートしていません',
+ 'ko-kr' => '파일 형식은 미리보기를 지원하지 않습니다',
+ 'fa' => 'پیش نمایش برای این فایل پشتیبانی نمی شود.',
+ ],
+ 'File' => [
+ 'en-us' => 'File',
+ 'zh-cn' => '文件',
+ 'ja' => 'ファイル',
+ 'ko-kr' => '파일',
+ 'fa' => 'فایل',
+ ],
+ 'ShowThumbnails' => [
+ 'en-us' => 'Thumbnails',
+ 'zh-cn' => '图片缩略',
+ 'ja' => '画像のサムネイル',
+ 'ko-kr' => '사진 섬네일',
+ 'fa' => 'تصویر بندانگشتی',
+ ],
+ 'CopyAllDownloadUrl' => [
+ 'en-us' => 'CopyAllDownloadUrl',
+ 'zh-cn' => '复制所有下载链接',
+ 'ja' => 'すべてのダウンロードリンクをコピー',
+ 'ko-kr' => '모든 다운로드 링크 복사',
+ 'fa' => 'کپی از تمام لینک ها',
+ ],
+ 'EditTime' => [
+ 'en-us' => 'EditTime',
+ 'zh-cn' => '修改时间',
+ 'ja' => '変更時間',
+ 'ko-kr' => '수정 시간',
+ 'fa' => 'زمان ویرایش',
+ ],
+ 'Size' => [
+ 'en-us' => 'Size',
+ 'zh-cn' => '大小',
+ 'ja' => 'サイズ ',
+ 'ko-kr' => '사이즈',
+ 'fa' => 'سایز',
+ ],
+ 'Rename' => [
+ 'en-us' => 'Rename',
+ 'zh-cn' => '重命名',
+ 'ja' => '名前を変更',
+ 'ko-kr' => '이름 바꾸기',
+ 'fa' => 'تغییر نام',
+ ],
+ 'Move' => [
+ 'en-us' => 'Move',
+ 'zh-cn' => '移动',
+ 'ja' => '移動する',
+ 'ko-kr' => '이동',
+ 'fa' => 'انتقال',
+ ],
+ 'Copy' => [
+ 'en-us' => 'Copy',
+ 'zh-cn' => '复制',
+ 'ja' => 'コピー',
+ 'ko-kr' => '복사',
+ 'fa' => 'کپی',
+ ],
+ 'CannotMove' => [
+ 'en-us' => 'Can not Move!',
+ 'zh-cn' => '不能移动!',
+ 'ja' => '動かない!',
+ 'ko-kr' => '움직일 수 없어!',
+ 'fa' => 'نمیتواند منتقل شود!',
+ ],
+ 'Delete' => [
+ 'en-us' => 'Delete',
+ 'zh-cn' => '删除',
+ 'ja' => '削除する',
+ 'ko-kr' => '삭제',
+ 'fa' => 'حذف کردن',
+ ],
+ 'PrePage' => [
+ 'en-us' => 'PrePage',
+ 'zh-cn' => '上一页',
+ 'ja' => '前へ',
+ 'ko-kr' => '이전',
+ 'fa' => 'صفحه قبل',
+ ],
+ 'NextPage' => [
+ 'en-us' => 'NextPage',
+ 'zh-cn' => '下一页',
+ 'ja' => '次のページ',
+ 'ko-kr' => '다음 페이지',
+ 'fa' => 'صفحه بعد',
+ ],
+ 'Upload' => [
+ 'en-us' => 'Upload',
+ 'zh-cn' => '上传',
+ 'ja' => 'アップロードする',
+ 'ko-kr' => '업로드',
+ 'fa' => 'آپلود',
+ ],
+ 'FileSelected' => [
+ 'en-us' => 'Select File',
+ 'zh-cn' => '选择文件',
+ 'ja' => 'ファイルを選択',
+ 'ko-kr' => '파일 선택',
+ 'fa' => 'انتخاب فایل',
+ ],
+ 'NoFileSelected' => [
+ 'en-us' => 'Not Select File',
+ 'zh-cn' => '没有选择文件',
+ 'ja' => 'ファイルが選択されていません',
+ 'ko-kr' => '선택된 파일이 없습니다',
+ 'fa' => 'فایل را انتخاب نکنید',
+ ],
+ 'Submit' => [
+ 'en-us' => 'Submit',
+ 'zh-cn' => '确认',
+ 'ja' => '確認する',
+ 'ko-kr' => '확인',
+ 'fa' => 'ارسال',
+ ],
+ 'Close' => [
+ 'en-us' => 'Close',
+ 'zh-cn' => '关闭',
+ 'ja' => '閉じる',
+ 'ko-kr' => '닫기',
+ 'fa' => 'بستن',
+ ],
+ 'InputPasswordUWant' => [
+ 'en-us' => 'Input Password you Want',
+ 'zh-cn' => '输入想要设置的密码',
+ 'ja' => '設定するパスワードを入力してください',
+ 'ko-kr' => '설정하려는 비밀번호를 입력하십시오',
+ 'fa' => 'پسورد خود را وارد کنید',
+ ],
+ 'ParentDir' => [
+ 'en-us' => 'Parent Dir',
+ 'zh-cn' => '上一级目录',
+ 'ja' => '親ディレクトリ',
+ 'ko-kr' => '부모 디렉토리',
+ 'fa' => 'مسیر',
+ ],
+ 'Folder' => [
+ 'en-us' => 'Folder',
+ 'zh-cn' => '文件夹',
+ 'ja' => 'フォルダー',
+ 'ko-kr' => '폴더',
+ 'fa' => 'پوشه',
+ ],
+ 'Name' => [
+ 'en-us' => 'Name',
+ 'zh-cn' => '名称',
+ 'ja' => '名前',
+ 'ko-kr' => '이름',
+ 'fa' => 'نام',
+ ],
+ 'Content' => [
+ 'en-us' => 'Content',
+ 'zh-cn' => '内容',
+ 'ja' => '内容',
+ 'ko-kr' => '내용',
+ 'fa' => 'محتوا',
+ ],
+ 'CancelEdit' => [
+ 'en-us' => 'Cancel Edit',
+ 'zh-cn' => '取消编辑',
+ 'ja' => '編集をキャンセル',
+ 'ko-kr' => '편집 취소',
+ 'fa' => 'لغو ویرایش',
+ ],
+ 'GetFileNameFail' => [
+ 'en-us' => 'Fail to Get File Name!',
+ 'zh-cn' => '获取文件名失败!',
+ 'ja' => 'ファイル名を取得できませんでした!',
+ 'ko-kr' => '파일 이름을 가져 오지 못했습니다!',
+ 'fa' => 'نام فایل به دست نیامد!',
+ ],
+ 'GetUploadLink' => [
+ 'en-us' => 'Get Upload Link',
+ 'zh-cn' => '获取上传链接',
+ 'ja' => 'アップロードリンクを取得',
+ 'ko-kr' => '업로드 링크 받기',
+ 'fa' => 'دریافت لینک آپلود',
+ ],
+ 'UpFileTooLarge' => [
+ 'en-us' => 'The File is too Large!',
+ 'zh-cn' => '文件过大,终止上传。',
+ 'ja' => '超えると、アップロードは終了します。',
+ 'ko-kr' => '파일이 너무 커서 업로드가 종료되었습니다.',
+ 'fa' => 'فایل خیلی بزرگ است!',
+ ],
+ 'UploadStart' => [
+ 'en-us' => 'Upload Start',
+ 'zh-cn' => '开始上传',
+ 'ja' => 'アップロードを開始',
+ 'ko-kr' => '업로드 시작',
+ 'fa' => 'شروع آپلود',
+ ],
+ 'UploadStartAt' => [
+ 'en-us' => 'Start At',
+ 'zh-cn' => '开始于',
+ 'ja' => 'で開始',
+ 'ko-kr' => '에서 시작',
+ 'fa' => 'شروع از',
+ ],
+ 'ThisTime' => [
+ 'en-us' => 'This Time',
+ 'zh-cn' => '本次',
+ 'ja' => '今回は',
+ 'ko-kr' => '이번에는',
+ 'fa' => 'این زمان',
+ ],
+ 'LastUpload' => [
+ 'en-us' => 'Last time Upload',
+ 'zh-cn' => '上次上传',
+ 'ja' => '上回は',
+ 'ko-kr' => '마지막 업로드',
+ 'fa' => 'آخرین زمان آپلود',
+ ],
+ 'AverageSpeed' => [
+ 'en-us' => 'AverageSpeed',
+ 'zh-cn' => '平均速度',
+ 'ja' => '平均速度',
+ 'ko-kr' => '평균 속도',
+ 'fa' => 'میانگین سرعت',
+ ],
+ 'CurrentSpeed' => [
+ 'en-us' => 'CurrentSpeed',
+ 'zh-cn' => '即时速度',
+ 'ja' => 'インスタントスピード',
+ 'ko-kr' => '즉각적인 속도',
+ 'fa' => 'سرعت فعلی',
+ ],
+ 'Expect' => [
+ 'en-us' => 'Expect',
+ 'zh-cn' => '预计还要',
+ 'ja' => '期待される',
+ 'ko-kr' => '예상',
+ 'fa' => 'انتظار',
+ ],
+ 'EndAt' => [
+ 'en-us' => 'End At',
+ 'zh-cn' => '结束于',
+ 'ja' => 'で終了',
+ 'ko-kr' => '에 끝남',
+ 'fa' => 'پایان از',
+ ],
+ 'UploadErrorUpAgain' => [
+ 'en-us' => 'Maybe error, do upload again.',
+ 'zh-cn' => '可能出错,重新上传。',
+ 'ja' => '間違っている可能性があります。もう一度アップロードしてください。',
+ 'ko-kr' => '잘못되었을 수 있습니다. 다시 업로드하십시오.',
+ 'fa' => 'خطا، دوباره آپلود کنید',
+ ],
+ 'UploadComplete' => [
+ 'en-us' => 'Upload Complete',
+ 'zh-cn' => '上传完成',
+ 'ja' => 'アップロード完了',
+ 'ko-kr' => '업로드 완료',
+ 'fa' => 'آپلود با موفقیت انجام شد',
+ ],
+ 'UploadFail23' => [
+ 'en-us' => 'Upload Fail, contain #.',
+ 'zh-cn' => '目录或文件名含有#,上传失败。',
+ 'ja' => 'ディレクトリまたはファイル名に#が含まれています。アップロードに失敗しました。',
+ 'ko-kr' => '디렉토리 또는 파일 이름에 #이 포함되어 있습니다. 업로드하지 못했습니다.',
+ 'fa' => 'بارگذاری ناموفق، حاوی #.',
+ ],
+ 'defaultSitename' => [
+ 'en-us' => 'OneManager',
+ ],
+ 'SavingToken' => [
+ 'en-us' => 'Saving refresh_token!',
+ 'zh-cn' => '正在保存 refresh_token!',
+ 'ja' => 'refresh_tokenを保存しています!',
+ 'ko-kr' => 'refresh_token 저장 중!',
+ 'fa' => 'در حال ذخیره refresh_token!',
+ ],
+ 'MayinEnv' => [
+ 'en-us' => 'The \'Onedrive_ver\' may in Config',
+ 'zh-cn' => 'Onedrive_ver应该已经写入',
+ 'ja' => 'Onedrive_verは環境変数に書き込まれている必要があります',
+ 'ko-kr' => 'Onedrive_verが書き込まれている必要があります',
+ 'fa' => 'The \'Onedrive_ver\' may in Config',
+ ],
+ 'Wait' => [
+ 'en-us' => 'Wait',
+ 'zh-cn' => '稍等',
+ 'ja' => 'ちょっと待って',
+ 'ko-kr' => '잠깐만',
+ 'fa' => 'منتظر بمانید',
+ ],
+ 'WaitJumpIndex' => [
+ 'en-us' => 'Wait 5s jump to Home page',
+ 'zh-cn' => '等5s跳到首页',
+ 'ja' => '5秒待ってホームページにジャンプします',
+ 'ko-kr' => '5 초 동안 홈페이지로 이동',
+ 'fa' => '۵ دقیقه صبر کنید تا به صفحه نخست برگردید',
+ ],
+ 'JumptoOffice' => [
+ 'en-us' => 'Login Office and Get a refresh_token',
+ 'zh-cn' => '跳转到Office,登录获取refresh_token',
+ 'ja' => 'Officeにジャンプしてログインし、refresh_tokenを取得します',
+ 'ko-kr' => '사무실로 이동하여 로그인하여 refresh_token을 받으십시오.',
+ 'fa' => 'وارد Office شوید و یک refresh_token دریافت کنید',
+ ],
+ 'OnedriveDiskTag' => [
+ 'en-us' => 'Onedrive Disk Tag',
+ 'zh-cn' => 'Onedrive 标签',
+ 'ja' => 'Onedriveタグ',
+ 'ko-kr' => 'Onedrive 태그',
+ 'fa' => 'برچسب دیسک Onedrive',
+ ],
+ 'OnedriveDiskName' => [
+ 'en-us' => 'Onedrive Showed Name',
+ 'zh-cn' => 'Onedrive 显示名称',
+ 'ja' => 'Onedrive表示名',
+ 'ko-kr' => 'Onedrive 표시 이름',
+ 'fa' => 'نام نشان داده شده Onedrive',
+ ],
+ 'DriveVerMS' => [
+ 'en-us' => 'Onedrive, Onedrive for business',
+ 'zh-cn' => '国际版(商业版与个人版)',
+ ],
+ 'DriveVerCN' => [
+ 'en-us' => 'Onedrive in China',
+ 'zh-cn' => '世纪互联版',
+ 'ja' => '中国のOnedrive',
+ 'ko-kr' => '중국 Onedrive',
+ 'fa' => 'Onedrive در چین',
+ ],
+ 'UseShareLink' => [
+ 'en-us' => 'Share a folder in Onedrive (enable EDIT for everyone), input the link url below.',
+ 'zh-cn' => '对一个Onedrive文件夹共享,允许所有人编辑,然后将共享链接填在下方',
+ ],
+ 'CustomIdSecret' => [
+ 'en-us' => 'Use custom client id & secret',
+ 'zh-cn' => '自己申请应用ID与机密',
+ 'ja' => 'アプリケーションIDとシークレットを自分で申請する',
+ 'ko-kr' => '응용 프로그램 ID 및 비밀 신청',
+ 'fa' => 'به طور پیش فرض اما از شناسه برنامه و سکرت استفاده کنید',
+ ],
+ 'GetSecretIDandKEY' => [
+ 'en-us' => 'Get custom client id & secret',
+ 'zh-cn' => '申请应用ID与机密',
+ 'ja' => 'アプリケーションIDとシークレット',
+ 'fa' => 'دریافت شناسه برنامه و سکرت',
+ ],
+ 'UseSharepointInstead' => [
+ 'en-us' => 'Use space in Sharepoint website instead of Onedrive',
+ 'zh-cn' => '使用Sharepoint网站的空间,不使用Onedrive',
+ ],
+ 'GetSharepointName' => [
+ 'en-us' => 'Login office.com and click the SharePoint, create a website or find an exist website, input the name below',
+ 'zh-cn' => '登录office.com,点击Sharepoint,创建一个网站或使用原有网站,然后将它的名字填在下方',
+ ],
+ 'InputSharepointName' => [
+ 'en-us' => 'Input the name of Sharepoint website',
+ 'zh-cn' => '输入Sharepoint网站的名称',
+ ],
+ 'TagFormatAlert' => [
+ 'en-us' => 'Tag must start with a letter, end with a letter or digit and can only contain lowercase letters, digits, and dashes, at least 2 letters!',
+ 'zh-cn' => '标签只能以字母开头,以字母或数字结尾,至少2位',
+ 'ja' => 'タグは、文字で始まり、文字または数字で終わる必要があります。少なくとも2つ',
+ 'ko-kr' => '태그는 문자로 시작하고 문자 또는 숫자로 끝나야합니다 (2 이상).',
+ 'fa' => 'برچسب باید با یک حرف شروع شود، با یک حرف یا رقم پایان یابد و تنها میتواند حاوی حروف کوچک، ارقام و خط فاصله، حداقل ۲ حرف باشد!',
+ ],
+ 'ClickInstall' => [
+ 'en-us' => 'Click to install the project',
+ 'zh-cn' => '点击开始安装程序',
+ 'ja' => 'クリックしてインストールプロセスを開始します',
+ 'ko-kr' => '설치 과정을 시작하려면 클릭',
+ 'fa' => 'برای نصب پروژه کلیک کنید',
+ ],
+ 'LogintoBind' => [
+ 'en-us' => 'then login and bind your onedrive in setup',
+ 'zh-cn' => '然后登录后在设置中绑定你的onedrive。',
+ 'ja' => '次に、ログインして、設定でonedriveをバインドします。',
+ 'ko-kr' => '그런 다음 로그인하여 onedrive를 설정에 바인딩하십시오.',
+ 'fa' => 'پس از آن وارد سیستم شوید و تنظیمات خود را در onedrive متصل کنید',
+ ],
+ 'MakesuerWriteable' => [
+ 'en-us' => 'Plase make sure the config.php is writeable. run writeable.sh.',
+ 'zh-cn' => '确认config.php可写。',
+ 'ja' => 'config.phpが書き込み可能であることを確認してください。',
+ 'ko-kr' => 'config.php가 쓰기 가능한지 확인하십시오.',
+ 'fa' => 'اطمینان حاصل کنید که config.php قابل نوشتن است. writeable.sh را اجرا کنید.',
+ ],
+ 'MakesuerRewriteOn' => [
+ 'en-us' => 'Plase make sure the RewriteEngine is On.',
+ 'zh-cn' => '确认重写(伪静态)功能启用。',
+ 'ja' => '書き換え(擬似静的)機能が有効になっていることを確認します。',
+ 'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.',
+ 'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.',
+ ],
+ 'CopyUrl' => [
+ 'en-us' => 'Copy URL',
+ 'zh-cn' => '复制链接',
+ ],
+ 'Success' => [
+ 'en-us' => 'Success',
+ 'zh-cn' => '成功',
+ ],
+ 'SetAdminPassword' => [
+ 'en-us' => 'Set Admin Password',
+ 'zh-cn' => '设置管理密码',
+ ],
+ 'Refresh' => [
+ 'en-us' => 'Refresh',
+ 'zh-cn' => '刷新',
+ 'ja' => 'リフレッシュ',
+ 'ko-kr' => '새로 고침',
+ 'fa' => 'رفرش',
+ ],
+ 'SelectLanguage' => [
+ 'en-us' => 'Select Language',
+ 'zh-cn' => '选择语言',
+ 'ja' => '言語を選択してください',
+ 'ko-kr' => '언어를 선택하십시오',
+ 'fa' => 'زبان را انتخاب کنید',
+ ],
+ 'RefreshCache' => [
+ 'en-us' => 'RefreshCache',
+ 'zh-cn' => '刷新缓存',
+ 'ja' => 'キャッシュを再構築',
+ 'ko-kr' => '캐시 플러시',
+ 'fa' => 'رفرش cache',
+ ],
+ 'VPSnotupdate' => [
+ 'en-us' => 'In VPS can not update by a click! run update.sh',
+ 'zh-cn' => '在VPS中不能一键更新,可以运行update.sh',
+ ],
+ 'QueryBranchs' => [
+ 'en-us' => 'Query Branchs',
+ 'zh-cn' => '查询分支',
+ ],
+];
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..efc0ac1
--- /dev/null
+++ b/index.php
@@ -0,0 +1,52 @@
+'. json_encode($_SERVER, JSON_PRETTY_PRINT).'';
+if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
+ include 'platform/scf.php';
+} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
+ include 'platform/heroku.php';
+ $path = getpath();
+ //echo 'path:'. $path;
+ $_GET = getGET();
+ //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).' ';
+ $re = main($path);
+ $sendHeaders = array();
+ foreach ($re['headers'] as $headerName => $headerVal) {
+ header($headerName . ': ' . $headerVal, true);
+ }
+ http_response_code($re['statusCode']);
+ echo $re['body'];
+} else {
+ include 'platform/normal.php';
+ $path = getpath();
+ //echo 'path:'. $path;
+ $_GET = getGET();
+ //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).' ';
+
+ $re = main($path);
+ $sendHeaders = array();
+ foreach ($re['headers'] as $headerName => $headerVal) {
+ header($headerName . ': ' . $headerVal, true);
+ }
+ http_response_code($re['statusCode']);
+ echo $re['body'];
+}
+
+function main_handler($event, $context)
+{
+ $event = json_decode(json_encode($event), true);
+ $context = json_decode(json_encode($context), true);
+ printInput($event, $context);
+ unset($_POST);
+ unset($_GET);
+ unset($_COOKIE);
+ unset($_SERVER);
+ GetGlobalVariable($event);
+ //echo ''. json_encode($_COOKIE, JSON_PRETTY_PRINT).' ';
+ $path = GetPathSetting($event, $context);
+
+ return main($path);
+}
diff --git a/platform/heroku.php b/platform/heroku.php
new file mode 100644
index 0000000..0077a77
--- /dev/null
+++ b/platform/heroku.php
@@ -0,0 +1,254 @@
+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'];
+ $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'] . '
+'.getconstStr('Refresh').' ';
+}
+
+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/' . $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
new file mode 100644
index 0000000..6906ddc
--- /dev/null
+++ b/platform/normal.php
@@ -0,0 +1,255 @@
+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;
+ /*$diskconfig[$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 = array_filter($diskconfig, 'array_value_isnot_null');
+ ksort($diskconfig);
+ $tmp[$disktag] = json_encode($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 = 'document.cookie=\'language=; path=/\'; ', 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 .= ''.getconstStr('MakesuerRewriteOn').'
+
+
+
+ ';
+ $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.
+'.getconstStr('Refresh').' ';
+}
+
+function OnekeyUpate()
+{
+ return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true);
+}
+
+function setConfigResponse($response)
+{
+ return $response;
+}
diff --git a/platform/scf.php b/platform/scf.php
new file mode 100644
index 0000000..c72599b
--- /dev/null
+++ b/platform/scf.php
@@ -0,0 +1,422 @@
+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['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'];
+ $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'] . '
+'.getconstStr('Refresh').' ';
+}
+
+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/readme.md b/readme.md
new file mode 100644
index 0000000..017ff55
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,60 @@
+Tfo:
+# List of files changed:
+##### Information app.json,version,readme.md
+##### UpdateAddress heroku.php,scf.php
+##### Theme tfo_md_tr.php ,tfo_md.php (based on classic.php,latest at 2020.4.4)
+
+Original:
+Install program first, then add onedrive in setup after login.
+先安装程序,登录后在设置中添加onedrive。
+
+# Deploy to 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.
+
+DEMO: https://herooneindex.herokuapp.com/
+
+# 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
+
+~~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反应不过来,会添加失败,请不要删除,再添加一次相同的就可以了。
+
+DEMO: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/
+
+# 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.
+点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
+
+QQ Group: 943919989
+Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
diff --git a/theme/classic.php b/theme/classic.php
new file mode 100644
index 0000000..072fd48
--- /dev/null
+++ b/theme/classic.php
@@ -0,0 +1,1238 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files[$_SERVER['DownurlStrName']];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']);
+?>
+
+
+ ' . curl_request($files[$_SERVER['DownurlStrName']])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/group_ov_bingrandom.php b/theme/group_ov_bingrandom.php
new file mode 100644
index 0000000..e29206d
--- /dev/null
+++ b/theme/group_ov_bingrandom.php
@@ -0,0 +1,1265 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/theme/group_ov_landscape.php b/theme/group_ov_landscape.php
new file mode 100644
index 0000000..eb379d9
--- /dev/null
+++ b/theme/group_ov_landscape.php
@@ -0,0 +1,1381 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/theme/group_ov_onemoe.php b/theme/group_ov_onemoe.php
new file mode 100644
index 0000000..a345bb3
--- /dev/null
+++ b/theme/group_ov_onemoe.php
@@ -0,0 +1,1191 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/group_ov_secondary.php b/theme/group_ov_secondary.php
new file mode 100644
index 0000000..3ea3352
--- /dev/null
+++ b/theme/group_ov_secondary.php
@@ -0,0 +1,1265 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/theme/ly_bwb.php b/theme/ly_bwb.php
new file mode 100644
index 0000000..a6d611d
--- /dev/null
+++ b/theme/ly_bwb.php
@@ -0,0 +1,1283 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/ly_white.php b/theme/ly_white.php
new file mode 100644
index 0000000..1db80bd
--- /dev/null
+++ b/theme/ly_white.php
@@ -0,0 +1,1289 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"日)",
+ "1"=>"一)",
+ "2"=>"二)",
+ "3"=>"三)",
+ "4"=>"四)",
+ "5"=>"五)",
+ "6"=>"六)"
+);
+echo '(星期'.$week[$w];
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/onemoe.php b/theme/onemoe.php
new file mode 100644
index 0000000..8567957
--- /dev/null
+++ b/theme/onemoe.php
@@ -0,0 +1,1198 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/purenice.php b/theme/purenice.php
new file mode 100644
index 0000000..1dba99e
--- /dev/null
+++ b/theme/purenice.php
@@ -0,0 +1,1263 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/ruoli_blue.php b/theme/ruoli_blue.php
new file mode 100644
index 0000000..7ec4e1b
--- /dev/null
+++ b/theme/ruoli_blue.php
@@ -0,0 +1,1240 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
登陆
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OneManager by 逸笙 theme by 若离
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/ruoli_violet.php b/theme/ruoli_violet.php
new file mode 100644
index 0000000..ce71dfc
--- /dev/null
+++ b/theme/ruoli_violet.php
@@ -0,0 +1,1259 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files['@microsoft.graph.downloadUrl'];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']);
+?>
+
+
+ ' . curl_request($files['@microsoft.graph.downloadUrl'])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/tfo_mdtr.php b/theme/tfo_mdtr.php
new file mode 100644
index 0000000..60e3e91
--- /dev/null
+++ b/theme/tfo_mdtr.php
@@ -0,0 +1,1248 @@
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+';
+?>
+
+';
+?>
+
+
+
+
+
+
+
+
+ Language
+ $value1) { ?>
+ >
+
+
+
+
+
+
+
+
+
+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 '
+
+';*/
+ $pdfurl = $files[$_SERVER['DownurlStrName']];
+ echo '
+';
+ } elseif (in_array($ext, $exts['office'])) {
+ echo '
+';
+ } elseif (in_array($ext, $exts['txt'])) {
+ $txtstr = htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']);
+?>
+
+
+ ' . curl_request($files[$_SERVER['DownurlStrName']])['body'] . '
+
+';
+ }*/ 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 = '
+
+
+
+
+ ';
+ if ($pagenum!=1) {
+ $prepagenum = $pagenum-1;
+ $prepagenext .= '
+ '.getconstStr('PrePage').' ';
+ }
+ $prepagenext .= '
+
+ ';
+ for ($page=1;$page<=$maxpage;$page++) {
+ if ($page == $pagenum) {
+ $prepagenext .= '
+ ' . $page . ' ';
+ } else {
+ $prepagenext .= '
+ ' . $page . ' ';
+ }
+ }
+ $prepagenext = substr($prepagenext,0,-1);
+ $prepagenext .= '
+
+ ';
+ if ($pagenum!=$maxpage) {
+ $nextpagenum = $pagenum+1;
+ $prepagenext .= '
+ '.getconstStr('NextPage').' ';
+ }
+ $prepagenext .= '
+
+
+
+ ';
+ echo $prepagenext;
+ }
+ if ($_SERVER['admin']) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/update.sh b/update.sh
new file mode 100644
index 0000000..23cc7c2
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,72 @@
+#!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" -r -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
new file mode 100644
index 0000000..8abd9f2
--- /dev/null
+++ b/vendor/autoload.php
@@ -0,0 +1,7 @@
+
+ * 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
new file mode 100644
index 0000000..f27399a
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,21 @@
+
+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
new file mode 100644
index 0000000..7a91153
--- /dev/null
+++ b/vendor/composer/autoload_classmap.php
@@ -0,0 +1,9 @@
+ 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
new file mode 100644
index 0000000..14baf56
--- /dev/null
+++ b/vendor/composer/autoload_real.php
@@ -0,0 +1,52 @@
+= 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
new file mode 100644
index 0000000..62275fa
--- /dev/null
+++ b/vendor/composer/autoload_static.php
@@ -0,0 +1,39 @@
+
+ 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
new file mode 100644
index 0000000..2355284
--- /dev/null
+++ b/vendor/composer/installed.json
@@ -0,0 +1,80 @@
+[
+ {
+ "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
new file mode 100644
index 0000000..0dfbd6a
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php
@@ -0,0 +1,118 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..2a91752
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php
@@ -0,0 +1,106 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..6610cc2
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php
@@ -0,0 +1,142 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..89fe323
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php
@@ -0,0 +1,116 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..9f57923
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php
@@ -0,0 +1,312 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..96c9b54
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php
@@ -0,0 +1,147 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..3a91eaf
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php
@@ -0,0 +1,40 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..c21691d
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php
@@ -0,0 +1,121 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..b2e0427
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php
@@ -0,0 +1,286 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..d988294
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
@@ -0,0 +1,111 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..4311d4f
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php
@@ -0,0 +1,37 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..8afaeea
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php
@@ -0,0 +1,126 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..5a0fc0e
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php
@@ -0,0 +1,147 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..75fe0ca
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php
@@ -0,0 +1,197 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..df7146d
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php
@@ -0,0 +1,39 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..bf87ea9
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php
@@ -0,0 +1,41 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..5e75196
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
@@ -0,0 +1,120 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..bcd2749
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php
@@ -0,0 +1,136 @@
+
+ */
+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
new file mode 100644
index 0000000..22add66
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php
@@ -0,0 +1,180 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..0baa3f2
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php
@@ -0,0 +1,250 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..0bf6e4d
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php
@@ -0,0 +1,220 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..a6399ec
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php
@@ -0,0 +1,25 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..65e8456
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php
@@ -0,0 +1,78 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..8a250b2
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php
@@ -0,0 +1,109 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..a2c4ca5
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php
@@ -0,0 +1,112 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..6e35ac8
--- /dev/null
+++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php
@@ -0,0 +1,83 @@
+.
+ */
+
+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
new file mode 100644
index 0000000..05e0bac
--- /dev/null
+++ b/version
@@ -0,0 +1,20 @@
+20200402-1830.17
+Oneclick update can select which branch to update. Now use the accept language instead of the language config.
+一键更新可以选择哪个分支了。现在开始使用浏览器语言,抛弃language设置。
+
+Update Data:
+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
new file mode 100644
index 0000000..8d3b5dc
--- /dev/null
+++ b/writeable.sh
@@ -0,0 +1,3 @@
+OneManagerPath=`cd $(dirname $0);pwd -P`
+cd ${OneManagerPath}
+chmod 666 config.php