Skip to content

Commit

Permalink
Merge pull request #622 from IlchCMS/fix-install-get-on-null
Browse files Browse the repository at this point in the history
Fix get on null in install
  • Loading branch information
hhunderter authored Jan 10, 2023
2 parents 7e54e1e + e0bd291 commit 95cdbf6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions application/libraries/Ilch/Design/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,11 @@ public function getUrl($url = [], ?string $route = null, bool $secure = false):
{
$locale = '';
$config = \Ilch\Registry::get('config');
if ($config->get('multilingual_acp') && $this->layout->getTranslator()->getLocale() != $config->get('content_language')) {
if ($config !== null && $config->get('multilingual_acp') && $this->layout->getTranslator()->getLocale() != $config->get('content_language')) {
$locale = $this->layout->getTranslator()->getLocale();
}

if ($this->modRewrite === null) {
$config = \Ilch\Registry::get('config');
if ($config !== null) {
$this->modRewrite = (bool) $config->get('mod_rewrite');
} else {
Expand Down
13 changes: 8 additions & 5 deletions application/libraries/Ilch/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,16 @@ protected function perform(string $destination = '/', int $status = 302, array $
public function getUrl($url = [], ?string $route = null): string
{
$config = Registry::get('config');

$locale = '';
if ($config->get('multilingual_acp') && $this->translator->getLocale() != $config->get('content_language')) {
$locale = $this->translator->getLocale();
}
$modRewrite = false;

if ($config !== null) {
$modRewrite = (bool)$config->get('mod_rewrite');

$modRewrite = (bool)$config->get('mod_rewrite');
if ($config->get('multilingual_acp') && $this->translator->getLocale() != $config->get('content_language')) {
$locale = $this->translator->getLocale();
}
}

if (empty($url)) {
return BASE_URL;
Expand Down
4 changes: 2 additions & 2 deletions application/modules/admin/plugins/AfterDatabaseLoad.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function __construct(array $pluginData)
$request->setParam('locale', $permas[$urlParts[0]]['locale']);
}
unset($urlParts[0]);
if ($urlParts[1] === 'locale') {
unset($urlParts[1]);
if (isset($urlParts[0]) && $urlParts[0] === 'locale') {
unset($urlParts[0]);
}

$result = $router->convertParamStringIntoArray(implode('/', $urlParts));
Expand Down
4 changes: 2 additions & 2 deletions application/modules/article/plugins/AfterDatabaseLoad.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function __construct(array $pluginData)
$request->setParam('locale', $permas[$urlParts[0]]['locale']);
}
unset($urlParts[0]);
if ($urlParts[1] === 'locale') {
unset($urlParts[1]);
if (isset($urlParts[0]) && $urlParts[0] === 'locale') {
unset($urlParts[0]);
}

$result = $router->convertParamStringIntoArray(implode('/', $urlParts));
Expand Down

0 comments on commit 95cdbf6

Please sign in to comment.