mirror of https://github.com/Rudloff/alltube.git
Merge branch 'Rudloff:master' into master
This commit is contained in:
commit
61e21dbdaa
|
@ -0,0 +1,16 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Only the latest major release is supported.
|
||||
|
||||
| Version | Supported |
|
||||
|---------|-----------|
|
||||
| 3.x | Yes |
|
||||
| 2.x | No |
|
||||
| 1.x | No |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you need to report a vulnerability, you can send an e-mail to
|
||||
[contact@rudloff.pro](mailto:contact@rudloff.pro).
|
|
@ -37,6 +37,34 @@ class ViewFactory
|
|||
->withScheme('https');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Uri $uri
|
||||
* @return Uri
|
||||
*/
|
||||
private static function cleanBasePath(Uri $uri): Uri
|
||||
{
|
||||
$basePath = $uri->getBasePath();
|
||||
if (str_ends_with($basePath, 'index.php')) {
|
||||
$basePath = dirname($basePath);
|
||||
if ($basePath == '/') {
|
||||
/*
|
||||
* Calling withBasePath('/') does nothing,
|
||||
* we have to use an empty string instead.
|
||||
*/
|
||||
$basePath = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* When the base path ends with index.php,
|
||||
* routing works correctly, but it breaks the URL of static assets using {base_url}.
|
||||
* So we alter the base path but only in the URI used by SmartyPlugins.
|
||||
*/
|
||||
$uri = $uri->withBasePath($basePath);
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Smarty view object.
|
||||
*
|
||||
|
@ -76,6 +104,8 @@ class ViewFactory
|
|||
/** @var LocaleManager $localeManager */
|
||||
$localeManager = $container->get('locale');
|
||||
|
||||
$uri = self::cleanBasePath($uri);
|
||||
|
||||
$smartyPlugins = new SmartyPlugins($container->get('router'), $uri->withUserInfo(''));
|
||||
$view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']);
|
||||
$view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']);
|
||||
|
|
|
@ -1346,16 +1346,16 @@
|
|||
},
|
||||
{
|
||||
"name": "smarty/smarty",
|
||||
"version": "v3.1.39",
|
||||
"version": "v3.1.43",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/smarty-php/smarty.git",
|
||||
"reference": "e27da524f7bcd7361e3ea5cdfa99c4378a7b5419"
|
||||
"reference": "273f7e00fec034f6d61112552e9caf08d19565b7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/smarty-php/smarty/zipball/e27da524f7bcd7361e3ea5cdfa99c4378a7b5419",
|
||||
"reference": "e27da524f7bcd7361e3ea5cdfa99c4378a7b5419",
|
||||
"url": "https://api.github.com/repos/smarty-php/smarty/zipball/273f7e00fec034f6d61112552e9caf08d19565b7",
|
||||
"reference": "273f7e00fec034f6d61112552e9caf08d19565b7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1399,7 +1399,13 @@
|
|||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2021-02-17T21:57:51+00:00"
|
||||
"support": {
|
||||
"forum": "http://www.smarty.net/forums/",
|
||||
"irc": "irc://irc.freenode.org/smarty",
|
||||
"issues": "https://github.com/smarty-php/smarty/issues",
|
||||
"source": "https://github.com/smarty-php/smarty/tree/v3.1.43"
|
||||
},
|
||||
"time": "2022-01-10T09:52:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
|
@ -7132,5 +7138,6 @@
|
|||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "7.3.11"
|
||||
}
|
||||
},
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
|
|
@ -5,11 +5,6 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||
use Alltube\App;
|
||||
use Alltube\ErrorHandler;
|
||||
|
||||
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
|
||||
header('Location: ' . str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI']));
|
||||
die;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create app.
|
||||
$app = new App();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h1 class="logobis">
|
||||
<a class="logocompatible" href="{base_url}">
|
||||
<a class="logocompatible" href="{path_for name="index"}">
|
||||
<span class="logocompatiblemask"><img src="{base_url}/img/logocompatiblemask.png" width="447" height="107"
|
||||
alt="{$config->appName}"/></span>
|
||||
</a></h1>
|
||||
|
|
Loading…
Reference in New Issue