Update index.php

pull/13/head
qkqpttgf 2020-01-08 09:03:56 +08:00 committed by GitHub
parent 20e87bfb65
commit 7835284a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 4 deletions

View File

@ -3,10 +3,6 @@ include 'vendor/autoload.php';
include 'conststr.php'; include 'conststr.php';
include 'functions.php'; include 'functions.php';
$theme = getConfig('theme');
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
include 'theme/'.$theme;
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
//echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
//if (!isset($_SERVER['REDIRECT_URL'])) $_SERVER['REDIRECT_URL'] = '/index.php'; //if (!isset($_SERVER['REDIRECT_URL'])) $_SERVER['REDIRECT_URL'] = '/index.php';
@ -644,3 +640,47 @@ function fetch_files_children($files, $path, $page, $cache)
} }
return $files; return $files;
} }
function render_list($path, $files)
{
global $exts;
global $constStr;
$path = str_replace('%20','%2520',$path);
$path = str_replace('+','%2B',$path);
$path = str_replace('&','&amp;',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('&','&amp;', $files['name']);
$n_path=$pretitle;
} else {
$pretitle = substr($path,-1)=='/'?substr($path,0,-1):$path;
$n_path=substr($pretitle,strrpos($pretitle,'/')+1);
$pretitle = substr($pretitle,1);
}
if (strrpos($path,'/')!=0) {
$p_path=substr($path,0,strrpos($path,'/'));
$p_path=substr($p_path,strrpos($p_path,'/')+1);
}
} else {
$pretitle = $constStr['Home'][$constStr['language']];
$n_path=$pretitle;
}
$n_path=str_replace('&amp;','&',$n_path);
$p_path=str_replace('&amp;','&',$p_path);
$pretitle = str_replace('%23','#',$pretitle);
$statusCode=200;
$theme = getConfig('theme');
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
date_default_timezone_set(get_timezone($_COOKIE['timezone']));
@ob_start();
include 'theme/'.$theme;
$html=ob_get_clean();
if ($_SERVER['Set-Cookie']!='') return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
return output($html,$statusCode);
}