diff --git a/inc/SP/Http/Request.class.php b/inc/SP/Http/Request.class.php index 58eb1256..57006180 100644 --- a/inc/SP/Http/Request.class.php +++ b/inc/SP/Http/Request.class.php @@ -35,6 +35,8 @@ use SP\Html\Html; */ class Request { + private static $secureDirs = ['css', 'js']; + /** * Comprobar el método utilizado para enviar un formulario. * @@ -55,6 +57,48 @@ class Request } } + /** + * Devolver las cabeceras enviadas desde el cliente. + * + * @param string $header nombre de la cabecera a devolver + * @return array|string + */ + public static function getRequestHeaders($header = '') + { + if (!empty($header)) { + $header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header; + + return isset($_SERVER[$header]) ? $_SERVER[$header] : ''; + } + + return self::getApacheHeaders(); + } + + /** + * Función que sustituye a apache_request_headers + * + * @return array + */ + private static function getApacheHeaders() + { + if (function_exists('\apache_request_headers')) { + return apache_request_headers(); + } + + $headers = []; + + foreach ($_SERVER as $key => $value) { + if (strpos($key, 'HTTP_') === 0) { + $key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-'); + $headers[$key] = $value; + } else { + $headers[$key] = $value; + } + } + + return $headers; + } + /** * Analizar un valor encriptado y devolverlo desencriptado * @@ -142,48 +186,6 @@ class Request return (self::getRequestHeaders('Cache-Control') === 'max-age=0'); } - /** - * Devolver las cabeceras enviadas desde el cliente. - * - * @param string $header nombre de la cabecera a devolver - * @return array|string - */ - public static function getRequestHeaders($header = '') - { - if (!empty($header)) { - $header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header; - - return isset($_SERVER[$header]) ? $_SERVER[$header] : ''; - } - - return self::getApacheHeaders(); - } - - /** - * Función que sustituye a apache_request_headers - * - * @return array - */ - private static function getApacheHeaders() - { - if (function_exists('\apache_request_headers')) { - return apache_request_headers(); - } - - $headers = []; - - foreach ($_SERVER as $key => $value) { - if (strpos($key, 'HTTP_') === 0) { - $key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-'); - $headers[$key] = $value; - } else { - $headers[$key] = $value; - } - } - - return $headers; - } - /** * Comprobar si existen parámetros pasados por POST para enviarlos por GET */ @@ -218,22 +220,26 @@ class Request /** * Devolver una ruta segura para * - * @param $path - * @param null $base + * @param $path + * @param string $base * @return string */ public static function getSecureAppPath($path, $base = null) { if ($base === null) { $base = Init::$SERVERROOT; + } elseif (!in_array(basename($base), self::$secureDirs, true)) { + return ''; } $realPath = realpath($base . DIRECTORY_SEPARATOR . $path); - if ($realPath === false || strpos($realPath, $base) !== 0) { + if ($realPath === false + || strpos($realPath, $base) !== 0 + ) { return ''; - } else { - return $realPath; } + + return $realPath; } } \ No newline at end of file diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index b7c7d740..0ce3d7ee 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17042501; + $build = 17042901; $version = [2, 1, 8]; if ($normalized === true) { diff --git a/js/app-main.min.js b/js/app-main.min.js index 133349bf..9578d107 100644 --- a/js/app-main.min.js +++ b/js/app-main.min.js @@ -1,4 +1,4 @@ -var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[f]=g.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; +var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[f]=g.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+$jscomp.symbolCounter_++}; $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(b){var f=0;return $jscomp.iteratorPrototype(function(){return f