Explorar o código

Fix for extensions on Windows (#2348)

https://github.com/FreshRSS/FreshRSS/issues/994
https://github.com/FreshRSS/FreshRSS/issues/2287
Alexandre Alapetite %!s(int64=7) %!d(string=hai) anos
pai
achega
74f92658b7
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      p/ext.php

+ 5 - 0
p/ext.php

@@ -20,6 +20,11 @@ require(__DIR__ . '/../constants.php');
 function is_valid_path($path) {
 function is_valid_path($path) {
 	// It must be under the extension path.
 	// It must be under the extension path.
 	$real_ext_path = realpath(EXTENSIONS_PATH);
 	$real_ext_path = realpath(EXTENSIONS_PATH);
+
+	//Windows compatibility
+	$real_ext_path = str_replace('\\', '/', $real_ext_path);
+	$path = str_replace('\\', '/', $path);
+
 	$in_ext_path = (substr($path, 0, strlen($real_ext_path)) === $real_ext_path);
 	$in_ext_path = (substr($path, 0, strlen($real_ext_path)) === $real_ext_path);
 	if (!$in_ext_path) {
 	if (!$in_ext_path) {
 		return false;
 		return false;