mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-08 02:41:10 +00:00
Update index.php
This commit is contained in:
parent
b7f9b96bc4
commit
4eea005aa0
|
@ -480,9 +480,11 @@ function relay_fetch_url($params) {
|
||||||
// from local source
|
// from local source
|
||||||
$local_prefix = "file:";
|
$local_prefix = "file:";
|
||||||
$pos = strpos($url, $local_prefix);
|
$pos = strpos($url, $local_prefix);
|
||||||
if ($pos !== false && $pos == 0) {
|
if ($pos !== false && $pos === 0) {
|
||||||
$path = substr($url, strlen($local_prefix));
|
$path = realpath(substr($url, strlen($local_prefix)));
|
||||||
|
$basedir = realpath(__DIR__);
|
||||||
|
|
||||||
|
if ($path && strpos($path, $basedir) === 0) {
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
$response = file_get_contents($path);
|
$response = file_get_contents($path);
|
||||||
return array(
|
return array(
|
||||||
|
@ -502,6 +504,16 @@ function relay_fetch_url($params) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => array(
|
||||||
|
"status" => 403,
|
||||||
|
"code" => -1,
|
||||||
|
"message" => "Access denied"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// from remote source
|
// from remote source
|
||||||
|
|
Loading…
Reference in New Issue
Block a user