diff --git a/common.php b/common.php index 813485f..fcb9824 100644 --- a/common.php +++ b/common.php @@ -16,6 +16,8 @@ $Base64Env = [ //'timezone', //'passfile', 'sitename', + 'customScript', + 'customCss', //'theme', //'Drive_ver', //'Drive_custom', @@ -24,7 +26,7 @@ $Base64Env = [ 'domain_path', 'guestup_path', //'usesharepoint', - 'sharepointname', + 'sharepointSiteAddress', 'shareurl', //'sharecookie', 'shareapiurl', @@ -48,6 +50,8 @@ $CommonEnv = [ 'timezone', 'passfile', 'sitename', + 'customScript', + 'customCss', 'theme', ]; @@ -65,6 +69,8 @@ $ShowedCommonEnv = [ 'timezone', 'passfile', 'sitename', + 'customScript', + 'customCss', 'theme', ]; @@ -78,7 +84,7 @@ $InnerEnv = [ 'downloadencrypt', 'guestup_path', 'usesharepoint', - 'sharepointname', + 'sharepointSiteAddress', 'siteid', 'shareurl', //'sharecookie', @@ -98,7 +104,7 @@ $ShowedInnerEnv = [ 'downloadencrypt', 'guestup_path', //'usesharepoint', - //'sharepointname', + //'sharepointSiteAddress', //'siteid', //'shareurl', //'sharecookie', @@ -237,10 +243,17 @@ function main($path) } if ($_SERVER['ajax']) { - if ($_GET['action']=='del_upload_cache'&&substr($_GET['filename'],-4)=='.tmp') { + if ($_GET['action']=='del_upload_cache') { // 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']); + $tmp = splitlast($_GET['filename'], '/'); + if ($tmp[1]!='') { + $filename = $tmp[0] . '/.' . $_GET['filelastModified'] . '_' . $_GET['filesize'] . '_' . $tmp[1] . '.tmp'; + } else { + $filename = '.' . $_GET['filelastModified'] . '_' . $_GET['filesize'] . '_' . $_GET['filename'] . '.tmp'; + } + $filename = path_format( path_format($_SERVER['list_path'] . path_format($path)) . '/' . spurlencode($filename, '/') ); + $tmp = MSAPI('DELETE', $filename, '', $_SERVER['access_token']); $path1 = path_format($_SERVER['list_path'] . path_format($path)); if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1); savecache('path_' . $path1, json_decode('{}',true), 1); @@ -382,7 +395,10 @@ function isHideFile($name) $FunctionalityFile = [ 'head.md', 'readme.md', + 'head.omf', + 'foot.omf', 'favicon.ico', + 'index.html', ]; if ($name == getConfig('passfile')) return true; @@ -456,8 +472,15 @@ function config_oauth() 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'); + $sharepointSiteAddress = getConfig('sharepointSiteAddress'); + while (substr($sharepointSiteAddress, -1)=='/') $sharepointSiteAddress = substr($sharepointSiteAddress, 0, -1); + $tmp = splitlast($sharepointSiteAddress, '/'); + $sharepointname = $tmp[1]; + $tmp = splitlast($tmp[0], '/'); + $sharepointname = $tmp[1] . '/' . $sharepointname; + if (getConfig('Drive_ver')=='MS') $url = 'https://graph.microsoft.com/v1.0/sites/root:/'.$sharepointname; + if (getConfig('Drive_ver')=='CN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/'.$sharepointname; + $i=0; $response = []; while ($url!=''&&$response['stat']!=200&&$i<4) { @@ -682,7 +705,10 @@ function needUpdate() $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_version = file_get_contents('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); + $tmp = curl_request('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); + if ($tmp['stat']==0) return 0; + $github_version = $tmp['body']; $github_ver = substr($github_version, strpos($github_version, '.')+1); $github_ver = explode(urldecode('%0A'),$github_ver)[0]; $github_ver = explode(urldecode('%0D'),$github_ver)[0]; @@ -769,11 +795,17 @@ 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']; + $tmp = splitlast($_GET['upbigfilename'], '/'); + if ($tmp[1]!='') { + $fileinfo['name'] = $tmp[1]; + $fileinfo['path'] = $tmp[0]; + } else { + $fileinfo['name'] = $_GET['upbigfilename']; + } $fileinfo['size'] = $_GET['filesize']; $fileinfo['lastModified'] = $_GET['lastModified']; - $filename = spurlencode( $fileinfo['name'] ); - $cachefilename = '.' . $fileinfo['lastModified'] . '_' . $fileinfo['size'] . '_' . $filename . '.tmp'; + $filename = spurlencode($_GET['upbigfilename'],'/'); + $cachefilename = spurlencode( $fileinfo['path'] . '/.' . $fileinfo['lastModified'] . '_' . $fileinfo['size'] . '_' . $fileinfo['name'] . '.tmp', '/'); $getoldupinfo=fetch_files(path_format($path . '/' . $cachefilename)); //echo json_encode($getoldupinfo, JSON_PRETTY_PRINT); if (isset($getoldupinfo['file'])&&$getoldupinfo['size']<5120) { @@ -1088,7 +1120,7 @@ function fetch_files($path = '/') $url .= ':' . $path; if (substr($url,-1)=='/') $url=substr($url,0,-1); } - $url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'].')'; + $url .= '?expand=children(select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName'].')'; $retry = 0; $arr = []; while ($retry<3&&!$arr['stat']) { @@ -1104,6 +1136,16 @@ function fetch_files($path = '/') $page = $_POST['pagenum']==''?1:$_POST['pagenum']; if ($page>1) $files=fetch_files_children($files, $path1, $page); $files['children'] = children_name($files['children']); + /*$url = $_SERVER['api_url']; + if ($path !== '/') { + $url .= ':' . $path; + if (substr($url,-1)=='/') $url=substr($url,0,-1); + $url .= ':/children?$top=9999&$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; + } else { + $url .= '/children?$top=9999&$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; + } + $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true); + $files['children'] = $children['value'];*/ } else { // files num < 200 , then cache //if (isset($files['children'])) { @@ -1179,9 +1221,9 @@ function fetch_files_children($files, $path, $page) if ($path !== '/') { $url .= ':' . $path; if (substr($url,-1)=='/') $url=substr($url,0,-1); - $url .= ':/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; + $url .= ':/children?$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; } else { - $url .= '/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; + $url .= '/children?$select=id,name,size,file,folder,parentReference,lastModifiedDateTime,'.$_SERVER['DownurlStrName']; } $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true); // echo $url . '
' . json_encode($children, JSON_PRETTY_PRINT) . '
'; @@ -1281,8 +1323,8 @@ function render_list($path = '', $files = '') $p_path = $tmp[1]; } } else { - if (substr($path,0,1)=='/') $pretitle = substr($path,1); - if (substr($path,-1)=='/') $pretitle = substr($path,0,-1); + if (substr($path, 0, 1)=='/') $pretitle = substr($path, 1); + if (substr($path, -1)=='/') $pretitle = substr($pretitle, 0, -1); $tmp=splitlast($pretitle,'/'); if ($tmp[1]=='') { $n_path = $tmp[0]; @@ -1305,16 +1347,671 @@ function render_list($path = '', $files = '') $pretitle = str_replace('%23','#',$pretitle); $statusCode=200; date_default_timezone_set(get_timezone($_SERVER['timezone'])); - @ob_start(); + $authinfo = ''; $theme = getConfig('theme'); - if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php'; - include 'theme/'.$theme; + if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.html'; + if (substr($theme,-4)=='.php') { + @ob_start(); + include 'theme/'.$theme; + $html = ob_get_clean(); + } else { + $file_path = 'theme/'.$theme; + $fp = fopen($file_path,"r"); + $html = fread($fp,filesize($file_path)); + fclose($fp); - $html = '' . ob_get_clean(); - //if (isset($htmlpage['statusCode'])) return $htmlpage; + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $IconValues = json_decode($tmp[0], true); + $html .= $tmp[1]; + + if (!$files) { + //$html = '
'.json_encode($files, JSON_PRETTY_PRINT).'
' . $html; + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + if ($_SERVER['admin']) { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + while (strpos($html, '')) $html = str_replace('', getconstStr('Operate'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Create'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Encrypt'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('RefreshCache'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Setup'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Logout'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Rename'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Submit'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Delete'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Copy'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Move'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Folder'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('File'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Name'), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Content'), $html); + + } else { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + if (getConfig('adminloginpage')=='') { + while (strpos($html, '')) $html = str_replace('', '', $html); + while (strpos($html, '')) $html = str_replace('', '', $html); + } else { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + } + + if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + } + if ($_SERVER['is_guestup_path']||$_SERVER['admin']) { + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + } else { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + if ($_SERVER['ishidden']==4) { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + /*$tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + }*/ + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + /*while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + }*/ + } + + if (isset($files['folder'])) { + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + $html = str_replace('', getconstStr('File'), $html); + $html = str_replace('', getconstStr('ShowThumbnails'), $html); + $html = str_replace('', getconstStr('CopyAllDownloadUrl'), $html); + $html = str_replace('', getconstStr('EditTime'), $html); + $html = str_replace('', getconstStr('Size'), $html); + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $FolderList = $tmp[0]; + foreach ($files['children'] as $file) { + if (isset($file['folder'])) { + if ($_SERVER['admin'] or !isHideFile($file['name'])) { + $filenum++; + $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList); + $FolderListStr = str_replace('', str_replace('&','&', $file['name']), $FolderListStr); + $FolderListStr = str_replace('', time_format($file['lastModifiedDateTime']), $FolderListStr); + $FolderListStr = str_replace('', size_format($file['size']), $FolderListStr); + while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr); + $html .= $FolderListStr; + } + } + } + $html .= $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $FolderList = $tmp[0]; + foreach ($files['children'] as $file) { + if (isset($file['file'])) { + if ($_SERVER['admin'] or !isHideFile($file['name'])) { + $filenum++; + $ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1)); + $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList); + $FolderListStr = str_replace('', str_replace('&','&', $file['name']), $FolderListStr); + //$FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . str_replace('&','&', $file['name'])), $FolderListStr); + $FolderListStr = str_replace('', time_format($file['lastModifiedDateTime']), $FolderListStr); + $FolderListStr = str_replace('', size_format($file['size']), $FolderListStr); + foreach ($IconValues as $key1 => $value1) { + if (isset($exts[$key1])&&in_array($ext, $exts[$key1])) { + $FolderListStr = str_replace('', $value1, $FolderListStr); + } + if ($ext==$key1) { + $FolderListStr = str_replace('', $value1, $FolderListStr); + } + } + $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr); + while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr); + $html .= $FolderListStr; + } + } + } + $html .= $tmp[1]; + while (strpos($html, '')) $html = str_replace('', $filenum, $html); + + if ($files['folder']['childCount']>200) { + while (strpos($html, '')) $html = str_replace('', '', $html); + while (strpos($html, '')) $html = str_replace('', '', $html); + + $pagenum = $files['folder']['page']; + if ($pagenum=='') $pagenum = 1; + $maxpage = ceil($files['folder']['childCount']/200); + + if ($pagenum!=1) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + $html = str_replace('', getconstStr('PrePage'), $html); + $html = str_replace('', $pagenum-1, $html); + } else { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + //$html .= json_encode($files['folder']); + if ($pagenum!=$maxpage) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + $html = str_replace('', getconstStr('NextPage'), $html); + $html = str_replace('', $pagenum+1, $html); + } else { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $MorePageListNow = str_replace('', $pagenum, $tmp[0]); + $html .= $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $MorePageList = $tmp[0]; + for ($page=1;$page<=$maxpage;$page++) { + if ($page == $pagenum) { + $MorePageListStr = $MorePageListNow; + } else { + $MorePageListStr = str_replace('', $page, $MorePageList); + $MorePageListStr = str_replace('', $page, $MorePageListStr); + } + $html .= $MorePageListStr; + } + $html .= $tmp[1]; + + } else { + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + + } elseif (isset($files['file'])) { + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + $html = str_replace('', str_replace('%2523', '%23', str_replace('%26amp%3B','&',spurlencode(path_format($_SERVER['base_disk_path'] . '/' . $path), '/'))), $html); + $html = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path), $html); + $html = str_replace('', getconstStr('Download'), $html); + + $ext = strtolower(substr($path, strrpos($path, '.') + 1)); + if (in_array($ext, $exts['img'])) $ext = 'img'; + elseif (in_array($ext, $exts['video'])) $ext = 'video'; + elseif (in_array($ext, $exts['music'])) $ext = 'music'; + elseif (in_array($ext, $exts['pdf'])) $ext = 'pdf'; + elseif (in_array($ext, $exts['office'])) $ext = 'office'; + elseif (in_array($ext, $exts['txt'])) $ext = 'txt'; + else $ext = 'Other'; + $previewext = ['img', 'video', 'music', 'pdf', 'office', 'txt', 'Other']; + $previewext = array_diff($previewext, [ $ext ]); + foreach ($previewext as $ext1) { + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + while (strpos($html, '')) $html = str_replace('', $files[$_SERVER['DownurlStrName']], $html); + while (strpos($html, '')) $html = str_replace('', $files['name'], $html); + $html = str_replace('', urlencode($files[$_SERVER['DownurlStrName']]), $html); + $html = str_replace('', getconstStr('ClicktoEdit'), $html); + $html = str_replace('', getconstStr('CancelEdit'), $html); + $html = str_replace('', getconstStr('Save'), $html); + $html = str_replace('', htmlspecialchars(curl_request($files[$_SERVER['DownurlStrName']])['body']), $html); + $html = str_replace('', getconstStr('FileNotSupport'), $html); + + + //$html = str_replace('', getconstStr('File'), $html); + } + + $html = str_replace('', $constStr['language'], $html); + + $title = $pretitle; + if ($_SERVER['base_disk_path']!=$_SERVER['base_path']) { + if (getConfig('diskname')!='') $diskname = getConfig('diskname'); + else $diskname = $_SERVER['disktag']; + $title .= ' - ' . $diskname; + } + $title .= ' - ' . $_SERVER['sitename']; + $html = str_replace('', $title, $html); + + $keywords = $n_path; + if ($p_path!='') $keywords .= ',' . $p_path; + $keywords .= ',' . $_SERVER['sitename'] . ',OneManager'; + $html = str_replace('', $keywords, $html); + + if ($_GET['preview']) $description = 'Preview of '.$n_path.'. '; + elseif (isset($files['folder'])) $description = 'List of '.$n_path.'. '; + $description .= 'In '.$_SERVER['sitename']; + $html = str_replace('', $description, $html); + + while (strpos($html, '')) $html = str_replace('', $_SERVER['base_disk_path'], $html); + while (strpos($html, '')) $html = str_replace('', $_SERVER['base_path'], $html); + while (strpos($html, '')) $html = str_replace('', str_replace('%23', '#', str_replace('&','&', $path)), $html); + while (strpos($html, '')) $html = str_replace('', getconstStr('Home'), $html); + + $html = str_replace('', $_SERVER['timezone'], $html); + + $html = str_replace('', getConfig('customCss'), $html); + $html = str_replace('', getConfig('customScript'), $html); + + $html = str_replace('', getconstStr('Login'), $html); + $html = str_replace('', getconstStr('Close'), $html); + $html = str_replace('', getconstStr('InputPassword'), $html); + $html = str_replace('', getconstStr('InputPasswordUWant'), $html); + $html = str_replace('', getconstStr('Success'), $html); + $html = str_replace('', getconstStr('GetUploadLink'), $html); + $html = str_replace('', getconstStr('UpFileTooLarge'), $html); + $html = str_replace('', getconstStr('UploadStart'), $html); + $html = str_replace('', getconstStr('UploadStartAt'), $html); + $html = str_replace('', getconstStr('LastUpload'), $html); + $html = str_replace('', getconstStr('ThisTime'), $html); + $html = str_replace('', getconstStr('UploadStartAt'), $html); + $html = str_replace('', getconstStr('Upload'), $html); + $html = str_replace('', getconstStr('AverageSpeed'), $html); + $html = str_replace('', getconstStr('CurrentSpeed'), $html); + $html = str_replace('', getconstStr('Expect'), $html); + $html = str_replace('', getconstStr('UploadErrorUpAgain'), $html); + $html = str_replace('', getconstStr('EndAt'), $html); + $html = str_replace('', getconstStr('AverageSpeed'), $html); + $html = str_replace('', getconstStr('ThisTime'), $html); + $html = str_replace('', getconstStr('AverageSpeed'), $html); + $html = str_replace('', getconstStr('UploadComplete'), $html); + $html = str_replace('', getconstStr('CopyUrl'), $html); + $html = str_replace('', getconstStr('UploadFail23'), $html); + $html = str_replace('', getconstStr('GetFileNameFail'), $html); + $html = str_replace('', getconstStr('UploadFile'), $html); + $html = str_replace('', getconstStr('UploadFolder'), $html); + + + $html = str_replace('', (isset($_GET['preview'])?'?preview&':'?'), $html); + + + $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'], $html); + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (getConfig('background')) { + $background = str_replace('', getConfig('background'), $tmp[0]); + } + $html .= $background . $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $SelectLanguage = $tmp[0]; + foreach ($constStr['languages'] as $key1 => $value1) { + $SelectLanguageStr = str_replace('', $key1, $SelectLanguage); + $SelectLanguageStr = str_replace('', $value1, $SelectLanguageStr); + $SelectLanguageStr = str_replace('', ($key1==$constStr['language']?'selected="selected"':''), $SelectLanguageStr); + $html .= $SelectLanguageStr; + } + $html .= $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $NeedUpdateStr = $tmp[0]; + if (isset($_SERVER['needUpdate'])&&$_SERVER['needUpdate']) $NeedUpdateStr = str_replace('', getconstStr('NeedUpdate'), $NeedUpdateStr); + else $NeedUpdateStr =''; + $html .= $NeedUpdateStr . $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if ($path !== '/') { + $current_url = $_SERVER['PHP_SELF']; + while (substr($current_url, -1) === '/') { + $current_url = substr($current_url, 0, -1); + } + if (strpos($current_url, '/') !== FALSE) { + $parent_url = substr($current_url, 0, strrpos($current_url, '/')); + } else { + $parent_url = $current_url; + } + $BackArrow = str_replace('', $parent_url.'/', $tmp[0]); + } + $html .= $BackArrow . $tmp[1]; + + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) { + $html .= $tmp[0] . $tmp[1]; + } else $html .= $tmp[1]; + } + $imgextstr = ''; + foreach ($exts['img'] as $imgext) $imgextstr .= '\''.$imgext.'\', '; + $html = str_replace('', $imgextstr, $html); + + + $html = str_replace('', $_SERVER['sitename'], $html); + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $disktags = explode("|",getConfig('disktag')); + if (count($disktags)>1) { + $tmp1 = $tmp[1]; + $tmp = splitfirst($tmp[0], ''); + $MultiDiskArea = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $MultiDisks = $tmp[0]; + foreach ($disktags as $disk) { + $diskname = getConfig('diskname', $disk); + if ($diskname=='') $diskname = $disk; + $MultiDisksStr = str_replace('', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks); + $MultiDisksStr = str_replace('', ($_SERVER['disktag']==$disk?' now':''), $MultiDisksStr); + $MultiDisksStr = str_replace('', $diskname, $MultiDisksStr); + $MultiDiskArea .= $MultiDisksStr; + } + $MultiDiskArea .= $tmp[1]; + $tmp[1] = $tmp1; + } + $html .= $MultiDiskArea . $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (isset($files['children']['head.omf'])) { + $headomf = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/head.omf'),'/'))['content']['body'], $tmp[0]); + } + $html .= $headomf . $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (isset($files['children']['head.md'])) { + $headmd = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/head.md'),'/'))['content']['body'], $tmp[0]); + $html .= $headmd . $tmp[1]; + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + } else { + $html .= $tmp[1]; + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html_aft = $tmp[1]; + if ($files) { + $listarea = $tmp[0]; + } + $html .= $listarea . $html_aft; + } + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (isset($files['children']['readme.md'])) { + $Readmemd = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/readme.md'),'/'))['content']['body'], $tmp[0]); + $html .= $Readmemd . $tmp[1]; + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + } else { + $html .= $tmp[1]; + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + } + + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (isset($files['children']['foot.omf'])) { + $Footomf = str_replace('', fetch_files(spurlencode(path_format(urldecode($path) . '/foot.omf'),'/'))['content']['body'], $tmp[0]); + } + $html .= $Footomf . $tmp[1]; + + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (isset($files['children']['head.md'])||isset($files['children']['readme.md'])) { + $html .= $tmp[0] . $tmp[1]; + } else $html .= $tmp[1]; + + if (getConfig('passfile')!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= str_replace('', getconstStr('Encrypt'), $tmp[0]) . $tmp[1]; + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } else { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= str_replace('', getconstStr('SetpassfileBfEncrypt'), $tmp[0]) . $tmp[1]; + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if ($path != '/') { + $html .= str_replace('', getconstStr('ParentDir'), $tmp[0]) . $tmp[1]; + } else $html .= $tmp[1]; + + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $MoveDirs = $tmp[0]; + if (isset($files['children'])) { + foreach ($files['children'] as $file) { + if (isset($file['folder'])) { + $MoveDirsStr = str_replace('', str_replace('&','&', $file['name']), $MoveDirs); + $MoveDirsStr = str_replace('', str_replace('&','&', $file['name']), $MoveDirsStr); + $html .= $MoveDirsStr; + } + } + } + $html .= $tmp[1]; + + + // 最后清除换行 + while (strpos($html, ' + +')) $html = str_replace(' + +', ' +', $html); + } + + $html = $authinfo . $html; if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]); return output($html,$statusCode); } @@ -1374,7 +2071,7 @@ function get_refresh_token() ', getconstStr('Wait').' 1s', 201); } else { - return message('something error, try after a few seconds.', 'retry', 201); + return message('Something error, retry after a few seconds.', 'retry', 201); } } if (isset($_GET['install0'])) { @@ -1397,7 +2094,7 @@ function get_refresh_token() } if ($_POST['usesharepoint']=='on') { $tmp['usesharepoint'] = $_POST['usesharepoint']; - $tmp['sharepointname'] = $_POST['sharepointname']; + $tmp['sharepointSiteAddress'] = $_POST['sharepointSiteAddress']; } } $response = setConfigResponse( setConfig($tmp, $_COOKIE['disktag']) ); @@ -1428,7 +2125,7 @@ function get_refresh_token()


-
+



@@ -1482,8 +2179,8 @@ function get_refresh_token() } } if (t.usesharepoint.checked==true) { - if (t.sharepointname.value==\'\') { - alert(\''.getconstStr('InputSharepointName').'\'); + if (t.sharepointSiteAddress.value==\'\') { + alert(\''.getconstStr('InputSharepointSiteAddress').'\'); return false; } } @@ -1609,7 +2306,7 @@ function EnvOpt($needUpdate = 0) }*/ else $html .= ' - + '; } $html .= '