Merge branch 'qkqpttgf:master' into master
						commit
						0ec12633a2
					
				
							
								
								
									
										105
									
								
								common.php
								
								
								
								
							
							
						
						
									
										105
									
								
								common.php
								
								
								
								
							| 
						 | 
					@ -174,6 +174,17 @@ function main($path)
 | 
				
			||||||
    $_SERVER['sitename'] = getConfig('sitename');
 | 
					    $_SERVER['sitename'] = getConfig('sitename');
 | 
				
			||||||
    if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
 | 
					    if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (isset($_GET['jsFile'])) {
 | 
				
			||||||
 | 
					        if (substr($_GET['jsFile'], -3)!='.js') return output('', 403);
 | 
				
			||||||
 | 
					        if (!($path==''||$path=='/')) return output('', 308, [ 'Location' => path_format($_SERVER['base_path'] . '/?jsFile=' . $_GET['jsFile']) ]);
 | 
				
			||||||
 | 
					        if (strpos($_GET['jsFile'], '/')>-1) $_GET['jsFile'] = splitlast($_GET['jsFile'], '/')[1];
 | 
				
			||||||
 | 
					        $jsFile = file_get_contents('js/' . $_GET['jsFile']);
 | 
				
			||||||
 | 
					        if (!!$jsFile) {
 | 
				
			||||||
 | 
					            return output( base64_encode($jsFile), 200, [ 'Content-Type' => 'text/javascript; charset=utf-8', 'Cache-Control' => 'max-age=' . 3*24*60*60 ], true );
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return output('', 404);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (isset($_GET['WaitFunction'])) {
 | 
					    if (isset($_GET['WaitFunction'])) {
 | 
				
			||||||
        $response = WaitFunction($_GET['WaitFunction']);
 | 
					        $response = WaitFunction($_GET['WaitFunction']);
 | 
				
			||||||
        //var_dump($response);
 | 
					        //var_dump($response);
 | 
				
			||||||
| 
						 | 
					@ -609,6 +620,14 @@ function proxy_replace_domain($url, $domainforproxy, &$header)
 | 
				
			||||||
    return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
 | 
					    return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function bchexdec($hex) {
 | 
				
			||||||
 | 
					    $len = strlen($hex);
 | 
				
			||||||
 | 
					    for ($i = 1; $i <= $len; $i++)
 | 
				
			||||||
 | 
					        $dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $dec;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function isHideFile($name)
 | 
					function isHideFile($name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $FunctionalityFile = [
 | 
					    $FunctionalityFile = [
 | 
				
			||||||
| 
						 | 
					@ -717,6 +736,20 @@ function sortConfig(&$arr)
 | 
				
			||||||
    return $arr;
 | 
					    return $arr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function chkTxtCode($str) {
 | 
				
			||||||
 | 
					    $code = array(
 | 
				
			||||||
 | 
					        'ASCII',
 | 
				
			||||||
 | 
					        'GBK',
 | 
				
			||||||
 | 
					        'GB18030',
 | 
				
			||||||
 | 
					        'UTF-8',
 | 
				
			||||||
 | 
					        'UTF-16',
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    foreach ($code as $c) {
 | 
				
			||||||
 | 
					        if ($str === iconv('UTF-8', $c, iconv($c, 'UTF-8', $str))) return $c;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getconstStr($str)
 | 
					function getconstStr($str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    global $constStr;
 | 
					    global $constStr;
 | 
				
			||||||
| 
						 | 
					@ -985,7 +1018,7 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
 | 
				
			||||||
                            //setTimeout(function() { getStatus() }, 1000);
 | 
					                            //setTimeout(function() { getStatus() }, 1000);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else if (xhr.status==206) {
 | 
					                    } else if (xhr.status==206) {
 | 
				
			||||||
                        errordiv.innerHTML = "' . getconstStr('Wait') . '" + x + "<br>" + min;
 | 
					                        errordiv.innerHTML = "' . getconstStr('Wait') . ' " + min + "<br>" + x;
 | 
				
			||||||
                        setTimeout(function() { getStatus() }, 1000);
 | 
					                        setTimeout(function() { getStatus() }, 1000);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
 | 
					                        errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
 | 
				
			||||||
| 
						 | 
					@ -1146,12 +1179,28 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
 | 
				
			||||||
            f.password1.value = sha1(timestamp + "" + f.password1.value);
 | 
					            f.password1.value = sha1(timestamp + "" + f.password1.value);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        } catch {
 | 
					        } catch {
 | 
				
			||||||
            alert("sha1.js not loaded.");
 | 
					            //alert("sha1.js not loaded.");
 | 
				
			||||||
 | 
					            if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    function loadjs(url) {
 | 
				
			||||||
 | 
					        var xhr = new XMLHttpRequest;
 | 
				
			||||||
 | 
					        xhr.open("GET", url);
 | 
				
			||||||
 | 
					        xhr.onload = function(e) {
 | 
				
			||||||
 | 
					            if (xhr.status==200) {
 | 
				
			||||||
 | 
					                var script = document.createElement("script");
 | 
				
			||||||
 | 
					                script.type = "text/javascript";
 | 
				
			||||||
 | 
					                script.text = xhr.responseText;
 | 
				
			||||||
 | 
					                document.body.appendChild(script);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                console.log(xhr.response);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        xhr.send(null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>';
 | 
					<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script>';
 | 
				
			||||||
    $html .= '</html>';
 | 
					    $html .= '</html>';
 | 
				
			||||||
    return output($html, $statusCode);
 | 
					    return output($html, $statusCode);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1675,7 +1724,7 @@ output:
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        if (count($disktags)>1) {
 | 
					        if (count($disktags)>1) {
 | 
				
			||||||
            $frame .= '
 | 
					            $frame .= '
 | 
				
			||||||
<script src="https://sortablejs.github.io/Sortable/Sortable.js"></script>
 | 
					<script src="https://www.unpkg.com/sortablejs@1.14.0/Sortable.min.js"></script>
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
    .sortable-ghost {
 | 
					    .sortable-ghost {
 | 
				
			||||||
        opacity: 0.4;
 | 
					        opacity: 0.4;
 | 
				
			||||||
| 
						 | 
					@ -1909,7 +1958,7 @@ output:
 | 
				
			||||||
            $frame .= getconstStr('NotNeedUpdate');
 | 
					            $frame .= getconstStr('NotNeedUpdate');
 | 
				
			||||||
        }*/
 | 
					        }*/
 | 
				
			||||||
        $frame .= '<br><br>
 | 
					        $frame .= '<br><br>
 | 
				
			||||||
<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>
 | 
					<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script>
 | 
				
			||||||
<table>
 | 
					<table>
 | 
				
			||||||
    <form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
 | 
					    <form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
 | 
				
			||||||
        <input name="_admin" type="hidden" value="">
 | 
					        <input name="_admin" type="hidden" value="">
 | 
				
			||||||
| 
						 | 
					@ -1950,7 +1999,7 @@ output:
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            sha1(1);
 | 
					            sha1(1);
 | 
				
			||||||
        } catch {
 | 
					        } catch {
 | 
				
			||||||
            alert("sha1.js not loaded.");
 | 
					            if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var timestamp = new Date().getTime();
 | 
					        var timestamp = new Date().getTime();
 | 
				
			||||||
| 
						 | 
					@ -1993,7 +2042,7 @@ output:
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            sha1(1);
 | 
					            sha1(1);
 | 
				
			||||||
        } catch {
 | 
					        } catch {
 | 
				
			||||||
            alert("sha1.js not loaded.");
 | 
					            if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var timestamp = new Date().getTime();
 | 
					        var timestamp = new Date().getTime();
 | 
				
			||||||
| 
						 | 
					@ -2030,7 +2079,7 @@ output:
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            sha1(1);
 | 
					            sha1(1);
 | 
				
			||||||
        } catch {
 | 
					        } catch {
 | 
				
			||||||
            alert("sha1.js not loaded.");
 | 
					            if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var timestamp = new Date().getTime();
 | 
					        var timestamp = new Date().getTime();
 | 
				
			||||||
| 
						 | 
					@ -2038,6 +2087,21 @@ output:
 | 
				
			||||||
        f.oldPass.value = sha1(f.oldPass.value + "" + timestamp);
 | 
					        f.oldPass.value = sha1(f.oldPass.value + "" + timestamp);
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    function loadjs(url) {
 | 
				
			||||||
 | 
					        var xhr = new XMLHttpRequest;
 | 
				
			||||||
 | 
					        xhr.open("GET", url);
 | 
				
			||||||
 | 
					        xhr.onload = function(e) {
 | 
				
			||||||
 | 
					            if (xhr.status==200) {
 | 
				
			||||||
 | 
					                var script = document.createElement("script");
 | 
				
			||||||
 | 
					                script.type = "text/javascript";
 | 
				
			||||||
 | 
					                script.text = xhr.responseText;
 | 
				
			||||||
 | 
					                document.body.appendChild(script);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                console.log(xhr.response);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        xhr.send(null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
</script>';
 | 
					</script>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $html .= '
 | 
					    $html .= '
 | 
				
			||||||
| 
						 | 
					@ -2406,12 +2470,21 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&$files['type']=='folder'&&$_SERVER['ishidden']<4 )) {
 | 
					        if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&$files['type']=='folder'&&$_SERVER['ishidden']<4 )) {
 | 
				
			||||||
            while (strpos($html, '<!--UploadJsStart-->')) $html = str_replace('<!--UploadJsStart-->', '', $html);
 | 
					 | 
				
			||||||
            while (strpos($html, '<!--UploadJsEnd-->')) $html = str_replace('<!--UploadJsEnd-->', '', $html);
 | 
					 | 
				
			||||||
            $now_driver = baseclassofdrive();
 | 
					            $now_driver = baseclassofdrive();
 | 
				
			||||||
            unset($Driver_arr[$now_driver]);
 | 
					            if ($now_driver) {
 | 
				
			||||||
            while (strpos($html, '<!--' . $now_driver . 'UploadJsStart-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsStart-->', '', $html);
 | 
					                while (strpos($html, '<!--UploadJsStart-->')) $html = str_replace('<!--UploadJsStart-->', '', $html);
 | 
				
			||||||
            while (strpos($html, '<!--' . $now_driver . 'UploadJsEnd-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsEnd-->', '', $html);
 | 
					                while (strpos($html, '<!--UploadJsEnd-->')) $html = str_replace('<!--UploadJsEnd-->', '', $html);
 | 
				
			||||||
 | 
					                unset($Driver_arr[$now_driver]);
 | 
				
			||||||
 | 
					                while (strpos($html, '<!--' . $now_driver . 'UploadJsStart-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsStart-->', '', $html);
 | 
				
			||||||
 | 
					                while (strpos($html, '<!--' . $now_driver . 'UploadJsEnd-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsEnd-->', '', $html);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                while (strpos($html, '<!--UploadJsStart-->')) {
 | 
				
			||||||
 | 
					                    $tmp = splitfirst($html, '<!--UploadJsStart-->');
 | 
				
			||||||
 | 
					                    $html = $tmp[0];
 | 
				
			||||||
 | 
					                    $tmp = splitfirst($tmp[1], '<!--UploadJsEnd-->');
 | 
				
			||||||
 | 
					                    $html .= $tmp[1];
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            foreach ($Driver_arr as $driver) {
 | 
					            foreach ($Driver_arr as $driver) {
 | 
				
			||||||
                while (strpos($html, '<!--' . $driver . 'UploadJsStart-->')) {
 | 
					                while (strpos($html, '<!--' . $driver . 'UploadJsStart-->')) {
 | 
				
			||||||
                    $tmp = splitfirst($html, '<!--' . $driver . 'UploadJsStart-->');
 | 
					                    $tmp = splitfirst($html, '<!--' . $driver . 'UploadJsStart-->');
 | 
				
			||||||
| 
						 | 
					@ -2505,8 +2578,9 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
            if (strpos($html, '<!--TxtContent-->')) {
 | 
					            if (strpos($html, '<!--TxtContent-->')) {
 | 
				
			||||||
                //$tmp_content = get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body'];
 | 
					                //$tmp_content = get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body'];
 | 
				
			||||||
                $tmp_content = $files['content']['body'];
 | 
					                $tmp_content = $files['content']['body'];
 | 
				
			||||||
                if (strlen($tmp_content)==$files['size']) $html = str_replace('<!--TxtContent-->', htmlspecialchars($tmp_content), $html);
 | 
					                //if (strlen($tmp_content)==$files['size'])
 | 
				
			||||||
                else $html = str_replace('<!--TxtContent-->', $files['size']<1024*1024?htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']):"File too large: " . $files['size'] . " B.", $html);
 | 
					                $html = str_replace('<!--TxtContent-->', htmlspecialchars($tmp_content), $html);
 | 
				
			||||||
 | 
					                //else $html = str_replace('<!--TxtContent-->', $files['size']<1024*1024?htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']):"File too large: " . $files['size'] . " B.", $html);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
 | 
					            $html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2989,7 +3063,6 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $html .= $Footomf . $tmp[1];
 | 
					        $html .= $Footomf . $tmp[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        $tmp = splitfirst($html, '<!--MdRequireStart-->');
 | 
					        $tmp = splitfirst($html, '<!--MdRequireStart-->');
 | 
				
			||||||
        $html = $tmp[0];
 | 
					        $html = $tmp[0];
 | 
				
			||||||
        $tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
 | 
					        $tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@ global $constStr;
 | 
				
			||||||
$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
 | 
					$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
 | 
				
			||||||
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
 | 
					$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
 | 
				
			||||||
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
 | 
					$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
 | 
				
			||||||
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
 | 
					$exts['txt'] = ['txt', 'log', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
 | 
				
			||||||
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
 | 
					$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
 | 
				
			||||||
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
 | 
					$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,9 +93,10 @@ class Aliyundrive {
 | 
				
			||||||
        if (!($files = getcache('path_' . $path, $this->disktag))) {
 | 
					        if (!($files = getcache('path_' . $path, $this->disktag))) {
 | 
				
			||||||
            if ($path == '/' || $path == '') {
 | 
					            if ($path == '/' || $path == '') {
 | 
				
			||||||
                $files = $this->fileList('root');
 | 
					                $files = $this->fileList('root');
 | 
				
			||||||
                //error_log1('root_id' . $files['id']);
 | 
					                //error_log1('root_id' . $files['file_id']);
 | 
				
			||||||
                $files['file_id'] = 'root';
 | 
					                $files['file_id'] = 'root';
 | 
				
			||||||
                $files['type'] = 'folder';
 | 
					                $files['type'] = 'folder';
 | 
				
			||||||
 | 
					                //error_log1(json_encode($files, JSON_PRETTY_PRINT));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                $tmp = splitlast($path, '/');
 | 
					                $tmp = splitlast($path, '/');
 | 
				
			||||||
                $parent_path = $tmp[0];
 | 
					                $parent_path = $tmp[0];
 | 
				
			||||||
| 
						 | 
					@ -490,6 +491,31 @@ class Aliyundrive {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return curl('POST', $url, json_encode($data), $header);
 | 
					        return curl('POST', $url, json_encode($data), $header);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    protected function fileCreate1($parentId, $fileName, $sha1, $proof_code, $size, $part_number) {
 | 
				
			||||||
 | 
					        //$url = $this->api_url . '/file/create';
 | 
				
			||||||
 | 
					        $url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $header["content-type"] = "application/json; charset=utf-8";
 | 
				
			||||||
 | 
					        $header['authorization'] = 'Bearer ' . $this->access_token;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        $data['check_name_mode'] = 'refuse'; // ignore, auto_rename, refuse.
 | 
				
			||||||
 | 
					        $data['content_hash'] = $sha1;
 | 
				
			||||||
 | 
					        $data['content_hash_name'] = 'sha1';
 | 
				
			||||||
 | 
					        //$data['content_type'] = '';
 | 
				
			||||||
 | 
					        $data['drive_id'] = $this->driveId;
 | 
				
			||||||
 | 
					        //$data['ignoreError'] = false;
 | 
				
			||||||
 | 
					        $data['name'] = $fileName;
 | 
				
			||||||
 | 
					        $data['parent_file_id'] = $parentId;
 | 
				
			||||||
 | 
					        for ($i=0;$i<$part_number;$i++) {
 | 
				
			||||||
 | 
					            $data['part_info_list'][$i]['part_number'] = $i+1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $data['proof_code'] = $proof_code;
 | 
				
			||||||
 | 
					        $data['proof_version'] = 'v1';
 | 
				
			||||||
 | 
					        $data['size'] = (int)$size;
 | 
				
			||||||
 | 
					        $data['type'] = 'file';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return curl('POST', $url, json_encode($data), $header);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
 | 
					    protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
 | 
				
			||||||
        $sha1 = sha1_file($tmpFilePath);
 | 
					        $sha1 = sha1_file($tmpFilePath);
 | 
				
			||||||
        if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
 | 
					        if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
 | 
				
			||||||
| 
						 | 
					@ -545,6 +571,21 @@ class Aliyundrive {
 | 
				
			||||||
            $result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true));
 | 
					            $result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true));
 | 
				
			||||||
            return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
 | 
					            return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
					            if (isset($_POST['CalcProof'])) {
 | 
				
			||||||
 | 
					                return output(substr(md5($this->access_token), 0, 16), 200);
 | 
				
			||||||
 | 
					                // Calc proof code
 | 
				
			||||||
 | 
					                /*if (!function_exists('bcadd')) {
 | 
				
			||||||
 | 
					                    // no php-bcmath
 | 
				
			||||||
 | 
					                    return output(0, 200);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $r = bchexdec( substr(md5($this->access_token), 0, 16) );
 | 
				
			||||||
 | 
					                    $i = $_POST['filesize'];
 | 
				
			||||||
 | 
					                    //$o = $i ? bcmod($r, $i) : 0;
 | 
				
			||||||
 | 
					                    $o = bcmod($r, $i);
 | 
				
			||||||
 | 
					                    //return output(hexdec( substr(md5($this->access_token), 0, 16) ) . ' , ' . $r . ' / ' . $i . ' = ' . $o, 200);
 | 
				
			||||||
 | 
					                    return output($o, 200);
 | 
				
			||||||
 | 
					                }*/
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
 | 
					            if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
 | 
				
			||||||
            if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
 | 
					            if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
 | 
				
			||||||
            if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
 | 
					            if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
 | 
				
			||||||
| 
						 | 
					@ -574,7 +615,11 @@ class Aliyundrive {
 | 
				
			||||||
                //error_log1($res['body']);
 | 
					                //error_log1($res['body']);
 | 
				
			||||||
                $parent_file_id = json_decode($res['body'], true)['file_id'];
 | 
					                $parent_file_id = json_decode($res['body'], true)['file_id'];
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
 | 
					            //if (!function_exists('bcadd')) {
 | 
				
			||||||
 | 
					            //    $response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
 | 
				
			||||||
 | 
					            //} else {
 | 
				
			||||||
 | 
					                $response = $this->fileCreate1($parent_file_id, $filename, $_POST['filesha1'], $_POST['proof_code'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
 | 
				
			||||||
 | 
					            //}
 | 
				
			||||||
            $res = json_decode($response['body'], true);
 | 
					            $res = json_decode($response['body'], true);
 | 
				
			||||||
            if (isset($res['exist'])) {
 | 
					            if (isset($res['exist'])) {
 | 
				
			||||||
                // 已经有
 | 
					                // 已经有
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,9 +57,27 @@ class Onedrive {
 | 
				
			||||||
                if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
 | 
					                if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
 | 
				
			||||||
                    if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
 | 
					                    if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
 | 
				
			||||||
                        if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
 | 
					                        if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
 | 
				
			||||||
                            $content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
 | 
					                            //$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
 | 
				
			||||||
                            $parentfiles['children'][$filename]['content'] = $content1;
 | 
					                            //$parentfiles['children'][$filename]['content'] = $content1;
 | 
				
			||||||
                            savecache('path_' . $parentpath, $parentfiles, $this->disktag);
 | 
					                            //savecache('path_' . $parentpath, $parentfiles, $this->disktag);
 | 
				
			||||||
 | 
					                            if ($parentfiles['children'][$filename]['size']<1024*1024) {
 | 
				
			||||||
 | 
					                                if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
 | 
				
			||||||
 | 
					                                    $content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
 | 
				
			||||||
 | 
					                                    $tmp = null;
 | 
				
			||||||
 | 
					                                    $tmp = json_decode(json_encode($content1), true);
 | 
				
			||||||
 | 
					                                    if ($tmp['body']===null) {
 | 
				
			||||||
 | 
					                                        $txtcode = chkTxtCode($content1['body']);
 | 
				
			||||||
 | 
					                                        if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
 | 
				
			||||||
 | 
					                                        $tmp = json_decode(json_encode($tmp), true);
 | 
				
			||||||
 | 
					                                        if ($tmp['body']) $content1['body'] = $tmp['body'];
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
 | 
					                                    $parentfiles['children'][$filename]['content'] = $content1;
 | 
				
			||||||
 | 
					                                    savecache('path_' . $path, $parentfiles['children'][$filename], $this->disktag);
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                $parentfiles['children'][$filename]['content']['stat'] = 202;
 | 
				
			||||||
 | 
					                                $parentfiles['children'][$filename]['content']['body'] = 'File too large.';
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    return $this->files_format($parentfiles['children'][$filename]);
 | 
					                    return $this->files_format($parentfiles['children'][$filename]);
 | 
				
			||||||
| 
						 | 
					@ -107,9 +125,10 @@ class Onedrive {
 | 
				
			||||||
                                $tmp = null;
 | 
					                                $tmp = null;
 | 
				
			||||||
                                $tmp = json_decode(json_encode($content1), true);
 | 
					                                $tmp = json_decode(json_encode($content1), true);
 | 
				
			||||||
                                if ($tmp['body']===null) {
 | 
					                                if ($tmp['body']===null) {
 | 
				
			||||||
                                    $tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
 | 
					                                    $txtcode = chkTxtCode($content1['body']);
 | 
				
			||||||
 | 
					                                    if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
 | 
				
			||||||
                                    $tmp = json_decode(json_encode($tmp), true);
 | 
					                                    $tmp = json_decode(json_encode($tmp), true);
 | 
				
			||||||
                                    if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
 | 
					                                    if ($tmp['body']) $content1['body'] = $tmp['body'];
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                $files['content'] = $content1;
 | 
					                                $files['content'] = $content1;
 | 
				
			||||||
                                savecache('path_' . $path, $files, $this->disktag);
 | 
					                                savecache('path_' . $path, $files, $this->disktag);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -5,12 +5,13 @@ function getpath()
 | 
				
			||||||
    $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
 | 
					    $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
 | 
				
			||||||
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
 | 
					    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
 | 
				
			||||||
    if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
 | 
					    if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
 | 
				
			||||||
 | 
					    if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
 | 
				
			||||||
 | 
					    if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
 | 
				
			||||||
 | 
					        $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
 | 
				
			||||||
 | 
					        if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
 | 
					    if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
 | 
				
			||||||
        if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
 | 
					        $_SERVER['REQUEST_SCHEME'] = 'http';
 | 
				
			||||||
            $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
 | 
					 | 
				
			||||||
            if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
 | 
					    $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
 | 
				
			||||||
| 
						 | 
					@ -22,8 +23,6 @@ function getpath()
 | 
				
			||||||
    else $path = $_SERVER['REQUEST_URI'];
 | 
					    else $path = $_SERVER['REQUEST_URI'];
 | 
				
			||||||
    $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
 | 
					    $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
    //return substr($path, 1);
 | 
					 | 
				
			||||||
    //return spurlencode($path, '/');
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getGET()
 | 
					function getGET()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -483,12 +483,13 @@
 | 
				
			||||||
    <div style="color: rgba(247,247,249,0);"><!--FootStr--></div>
 | 
					    <div style="color: rgba(247,247,249,0);"><!--FootStr--></div>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
 | 
				
			||||||
 | 
					<script type="text/javascript" src="https://unpkg.com/marked@0.6.2/lib/marked.js"></script><!--MdRequireEnd-->
 | 
				
			||||||
<!--ListStart-->
 | 
					<!--ListStart-->
 | 
				
			||||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
 | 
					 | 
				
			||||||
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
 | 
					 | 
				
			||||||
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
 | 
					<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
 | 
				
			||||||
<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
 | 
					<!--AliyundriveUploadJsStart--><script src="https://unpkg.com/bignumber.js@9.0.2/bignumber.js"></script>
 | 
				
			||||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
 | 
					<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--AliyundriveUploadJsEnd-->
 | 
				
			||||||
 | 
					<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
 | 
				
			||||||
<!--ListEnd-->
 | 
					<!--ListEnd-->
 | 
				
			||||||
<script type="text/javascript">
 | 
					<script type="text/javascript">
 | 
				
			||||||
    function changelanguage(str)
 | 
					    function changelanguage(str)
 | 
				
			||||||
| 
						 | 
					@ -519,13 +520,53 @@
 | 
				
			||||||
            f.password1.value = sha1(timestamp + "" + f.password1.value);
 | 
					            f.password1.value = sha1(timestamp + "" + f.password1.value);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        } catch {
 | 
					        } catch {
 | 
				
			||||||
            alert("sha1.js not loaded.");
 | 
					            //alert("sha1.js not loaded.");
 | 
				
			||||||
 | 
					            if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    function loadjs(url) {
 | 
				
			||||||
 | 
					        var xhr = new XMLHttpRequest;
 | 
				
			||||||
 | 
					        xhr.open("GET", url);
 | 
				
			||||||
 | 
					        xhr.onload = function(e) {
 | 
				
			||||||
 | 
					            if (xhr.status==200) {
 | 
				
			||||||
 | 
					                var script = document.createElement("script");
 | 
				
			||||||
 | 
					                script.type = "text/javascript";
 | 
				
			||||||
 | 
					                script.text = xhr.responseText;
 | 
				
			||||||
 | 
					                document.body.appendChild(script);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                console.log(xhr.response);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        xhr.send(null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
<!--LoginEnd-->
 | 
					<!--LoginEnd-->
 | 
				
			||||||
 | 
					<!--WriteTimezoneStart-->
 | 
				
			||||||
 | 
					    var nowtime= new Date();
 | 
				
			||||||
 | 
					    var timezone = 0-nowtime.getTimezoneOffset()/60;
 | 
				
			||||||
 | 
					    var expd = new Date();
 | 
				
			||||||
 | 
					    expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					    var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					    document.cookie="timezone="+timezone+"; path=/; "+expires;
 | 
				
			||||||
 | 
					    if (timezone!=<!--timezone-->) {
 | 
				
			||||||
 | 
					        //alert('Your timezone is '+timezone+', reload local timezone.');
 | 
				
			||||||
 | 
					        location.href=location.href;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					<!--WriteTimezoneEnd-->
 | 
				
			||||||
 | 
					<!--HeadmdStart-->
 | 
				
			||||||
 | 
					    var $head = document.getElementById('head');
 | 
				
			||||||
 | 
					    if ($head) {
 | 
				
			||||||
 | 
					        //document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
 | 
				
			||||||
 | 
					        $head.innerHTML = marked(document.getElementById('head-md').innerText);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					<!--HeadmdEnd-->
 | 
				
			||||||
 | 
					<!--ReadmemdStart-->
 | 
				
			||||||
 | 
					    var $readme = document.getElementById('readme');
 | 
				
			||||||
 | 
					    if ($readme) {
 | 
				
			||||||
 | 
					        $readme.innerHTML = marked(document.getElementById('readme-md').innerText);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					<!--ReadmemdEnd-->
 | 
				
			||||||
<!--ListStart-->
 | 
					<!--ListStart-->
 | 
				
			||||||
 | 
					 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
| 
						 | 
					@ -614,26 +655,50 @@
 | 
				
			||||||
    addVideos(["<!--FileEncodeUrl-->"]);
 | 
					    addVideos(["<!--FileEncodeUrl-->"]);
 | 
				
			||||||
<!--IsvideoFileEnd-->
 | 
					<!--IsvideoFileEnd-->
 | 
				
			||||||
<!--IspdfFileStart-->
 | 
					<!--IspdfFileStart-->
 | 
				
			||||||
    pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
 | 
					    //cdn.bootcss.com/pdf.js/2.4.456/pdf.worker.min.js
 | 
				
			||||||
 | 
					    pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
 | 
				
			||||||
    var loadingTask = pdfjsLib.getDocument({
 | 
					    var loadingTask = pdfjsLib.getDocument({
 | 
				
			||||||
        url: "<!--FileDownUrl-->",
 | 
					        url: "<!--FileDownUrl-->",
 | 
				
			||||||
        cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
 | 
					        cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
 | 
				
			||||||
        cMapPacked: true,
 | 
					        cMapPacked: true,
 | 
				
			||||||
 | 
					        disableStream: true,
 | 
				
			||||||
 | 
					        disableAutoFetch: true,
 | 
				
			||||||
        rangeChunkSize: 65535
 | 
					        rangeChunkSize: 65535
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    loadingTask.promise.then(function(pdf) {
 | 
					    loadingTask.promise.then(function(pdf) {
 | 
				
			||||||
        var pagenum =  pdf.numPages;
 | 
					        var pagenum =  pdf.numPages;
 | 
				
			||||||
        var pdfContainer = document.getElementById('pdf-d');
 | 
					        var pdfContainer = document.getElementById('pdf-d');
 | 
				
			||||||
        pdfContainer.innerHTML = '';
 | 
					        pdfContainer.innerHTML = '';
 | 
				
			||||||
        for (var i=1;i<=pagenum;i++) {
 | 
					        var pagepos = 1;
 | 
				
			||||||
            var canvasNew = document.createElement('canvas');
 | 
					        var pdfnextpagebutton = document.createElement('button');
 | 
				
			||||||
            canvasNew.id = 'pdf-c'+i;
 | 
					        pdfnextpagebutton.id = 'pdfnextpagebutton';
 | 
				
			||||||
            pdfContainer.appendChild(canvasNew);
 | 
					        pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
 | 
				
			||||||
            renderpage(pdf,i);
 | 
					        pdfnextpagebutton.setAttribute('onclick', "this.style.display = 'none';");
 | 
				
			||||||
        }
 | 
					        pdfnextpagebutton.style.display = 'none';
 | 
				
			||||||
 | 
					        pdfContainer.appendChild(pdfnextpagebutton);
 | 
				
			||||||
 | 
					        var pdfWaitNextPage = setInterval(function(){
 | 
				
			||||||
 | 
					            //console.log(document.documentElement.scrollTop + ", " + document.body.scrollHeight);
 | 
				
			||||||
 | 
					            console.log("next page: " + pagepos + " / " + pagenum);
 | 
				
			||||||
 | 
					            if (pdfnextpagebutton.style.display=='none') {
 | 
				
			||||||
 | 
					                for (var i=pagepos;i<=(pagepos+4<pagenum?pagepos+4:pagenum);i++) {
 | 
				
			||||||
 | 
					                    var canvasNew = document.createElement('canvas');
 | 
				
			||||||
 | 
					                    canvasNew.id = 'pdf-c'+i;
 | 
				
			||||||
 | 
					                    pdfContainer.appendChild(canvasNew);
 | 
				
			||||||
 | 
					                    renderpage(pdf,i);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                pagepos = i;
 | 
				
			||||||
 | 
					                if (pagepos<pagenum) {
 | 
				
			||||||
 | 
					                    pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
 | 
				
			||||||
 | 
					                    pdfnextpagebutton.style.display ='';
 | 
				
			||||||
 | 
					                    pdfContainer.appendChild(pdfnextpagebutton);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    console.log("end of pdf");
 | 
				
			||||||
 | 
					                    clearInterval(pdfWaitNextPage);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    function renderpage(pdf,i)
 | 
					    function renderpage(pdf,i) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        pdf.getPage(i).then(function(page) { 
 | 
					        pdf.getPage(i).then(function(page) { 
 | 
				
			||||||
            var scale = 1.5;
 | 
					            var scale = 1.5;
 | 
				
			||||||
            var viewport = page.getViewport({ scale: scale, });
 | 
					            var viewport = page.getViewport({ scale: scale, });
 | 
				
			||||||
| 
						 | 
					@ -650,19 +715,6 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IspdfFileEnd-->
 | 
					<!--IspdfFileEnd-->
 | 
				
			||||||
<!--IsFileEnd-->
 | 
					<!--IsFileEnd-->
 | 
				
			||||||
<!--HeadmdStart-->
 | 
					 | 
				
			||||||
    var $head = document.getElementById('head');
 | 
					 | 
				
			||||||
    if ($head) {
 | 
					 | 
				
			||||||
        //document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
 | 
					 | 
				
			||||||
        $head.innerHTML = marked(document.getElementById('head-md').innerText);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
<!--HeadmdEnd-->
 | 
					 | 
				
			||||||
<!--ReadmemdStart-->
 | 
					 | 
				
			||||||
    var $readme = document.getElementById('readme');
 | 
					 | 
				
			||||||
    if ($readme) {
 | 
					 | 
				
			||||||
        $readme.innerHTML = marked(document.getElementById('readme-md').innerText);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
<!--ReadmemdEnd-->
 | 
					 | 
				
			||||||
<!--IsFolderStart-->
 | 
					<!--IsFolderStart-->
 | 
				
			||||||
<!--ShowThumbnailsStart-->
 | 
					<!--ShowThumbnailsStart-->
 | 
				
			||||||
    function showthumbnails(obj) {
 | 
					    function showthumbnails(obj) {
 | 
				
			||||||
| 
						 | 
					@ -794,18 +846,6 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsNotHiddenEnd-->
 | 
					<!--IsNotHiddenEnd-->
 | 
				
			||||||
<!--IsFolderEnd-->
 | 
					<!--IsFolderEnd-->
 | 
				
			||||||
<!--WriteTimezoneStart-->
 | 
					 | 
				
			||||||
    var nowtime= new Date();
 | 
					 | 
				
			||||||
    var timezone = 0-nowtime.getTimezoneOffset()/60;
 | 
					 | 
				
			||||||
    var expd = new Date();
 | 
					 | 
				
			||||||
    expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
					 | 
				
			||||||
    var expires = "expires="+expd.toGMTString();
 | 
					 | 
				
			||||||
    document.cookie="timezone="+timezone+"; path=/; "+expires;
 | 
					 | 
				
			||||||
    if (timezone!=<!--timezone-->) {
 | 
					 | 
				
			||||||
        alert('Your timezone is '+timezone+', reload local timezone.');
 | 
					 | 
				
			||||||
        location.href=location.href;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
<!--WriteTimezoneEnd-->
 | 
					 | 
				
			||||||
    function CopyAllDownloadUrl(str) {
 | 
					    function CopyAllDownloadUrl(str) {
 | 
				
			||||||
        var tmptextarea=document.createElement('textarea');
 | 
					        var tmptextarea=document.createElement('textarea');
 | 
				
			||||||
        document.body.appendChild(tmptextarea);
 | 
					        document.body.appendChild(tmptextarea);
 | 
				
			||||||
| 
						 | 
					@ -1145,7 +1185,39 @@
 | 
				
			||||||
                }// else console.log(Object.keys(uploading).length);
 | 
					                }// else console.log(Object.keys(uploading).length);
 | 
				
			||||||
            } else clearInterval(uploadList);
 | 
					            } else clearInterval(uploadList);
 | 
				
			||||||
        }, 1000);
 | 
					        }, 1000);
 | 
				
			||||||
        //getuplink(i);
 | 
					        function CalcProof(file) {
 | 
				
			||||||
 | 
					            return new Promise(function(resolve, reject){
 | 
				
			||||||
 | 
					                var xhr = new XMLHttpRequest();
 | 
				
			||||||
 | 
					                xhr.open("POST", '?action=upbigfile');
 | 
				
			||||||
 | 
					                xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
 | 
				
			||||||
 | 
					                xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
 | 
				
			||||||
 | 
					                xhr.onload = function(e){
 | 
				
			||||||
 | 
					                    var html;
 | 
				
			||||||
 | 
					                    if (xhr.status==200) {
 | 
				
			||||||
 | 
					                        //console.log(xhr.responseText);
 | 
				
			||||||
 | 
					                        var r = new BigNumber("0x".concat(xhr.responseText));
 | 
				
			||||||
 | 
					                        var i = new BigNumber(file.size);
 | 
				
			||||||
 | 
					                        var o = i ? r.mod(i) : 0;
 | 
				
			||||||
 | 
					                        var reader1 = new FileReader();
 | 
				
			||||||
 | 
					                        var start = o.toNumber();
 | 
				
			||||||
 | 
					                        var end = start + 8;
 | 
				
			||||||
 | 
					                        //if (file.size<end) end = file.size;
 | 
				
			||||||
 | 
					                        console.log(start + " ~ " + end);
 | 
				
			||||||
 | 
					                        //reader1.readAsBinaryString(file.slice(start,end));
 | 
				
			||||||
 | 
					                        reader1.readAsDataURL(file.slice(start,end));
 | 
				
			||||||
 | 
					                        reader1.onload = function(e) {
 | 
				
			||||||
 | 
					                            var proof = this.result;
 | 
				
			||||||
 | 
					                            proof = proof.substr(proof.indexOf('base64,')+7);
 | 
				
			||||||
 | 
					                            resolve(proof);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        //console.log(xhr.status+'calc proof code\n'+xhr.responseText);
 | 
				
			||||||
 | 
					                        reject(xhr.status+"\ncalc proof code\n"+xhr.responseText);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                xhr.send('CalcProof=1');
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        function getuplink(i, r=0) {
 | 
					        function getuplink(i, r=0) {
 | 
				
			||||||
            var file=files[i];
 | 
					            var file=files[i];
 | 
				
			||||||
            var td1;
 | 
					            var td1;
 | 
				
			||||||
| 
						 | 
					@ -1173,6 +1245,7 @@
 | 
				
			||||||
                uploadbuttonshow();
 | 
					                uploadbuttonshow();
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }*/
 | 
					            }*/
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
 | 
					            var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
 | 
				
			||||||
            uploading[upbigfilename] = [i];
 | 
					            uploading[upbigfilename] = [i];
 | 
				
			||||||
            var spark = sha1.create();
 | 
					            var spark = sha1.create();
 | 
				
			||||||
| 
						 | 
					@ -1184,7 +1257,14 @@
 | 
				
			||||||
                var blob = file.slice(start,end);
 | 
					                var blob = file.slice(start,end);
 | 
				
			||||||
                reader.readAsArrayBuffer(blob);
 | 
					                reader.readAsArrayBuffer(blob);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            readblob(asize);
 | 
					            var proof_code = '';
 | 
				
			||||||
 | 
					            CalcProof(file).then(a => {
 | 
				
			||||||
 | 
					                proof_code = a;
 | 
				
			||||||
 | 
					                console.log('proof: ' + proof_code);
 | 
				
			||||||
 | 
					                readblob(asize);
 | 
				
			||||||
 | 
					            }, e => {
 | 
				
			||||||
 | 
					                td2.innerHTML = e;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            reader.onload = function(e){
 | 
					            reader.onload = function(e){
 | 
				
			||||||
                td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
 | 
					                td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
 | 
				
			||||||
| 
						 | 
					@ -1252,7 +1332,7 @@
 | 
				
			||||||
                                getuplink(i);
 | 
					                                getuplink(i);
 | 
				
			||||||
                            }*/
 | 
					                            }*/
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
 | 
					                        xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&proof_code=' + proof_code + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -1650,7 +1730,7 @@
 | 
				
			||||||
    document.getElementById('password1').focus();
 | 
					    document.getElementById('password1').focus();
 | 
				
			||||||
<!--EncryptedEnd-->
 | 
					<!--EncryptedEnd-->
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
 | 
					<script src="https://www.unpkg.com/ionicons@6.0.1/dist/ionicons.js"></script>
 | 
				
			||||||
<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--LoginEnd-->
 | 
					<!--LoginStart--><script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--LoginEnd-->
 | 
				
			||||||
<!--customScript-->
 | 
					<!--customScript-->
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue