X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fhome.php;h=b375707404a2cf52799c54649ba5a13a607fa0d0;hb=c964e193b9b476debc16e42279801372137bc3bc;hp=beda739fdb19d06b2768c5ef5fb3d46057d675f0;hpb=39ff6e9ce9251fe69b56ba05ea7bdc1896f34de2;p=friendica.git diff --git a/mod/home.php b/mod/home.php index beda739fdb..b375707404 100644 --- a/mod/home.php +++ b/mod/home.php @@ -1,7 +1,12 @@ user['nickname'])) { - goaway(System::baseUrl()."/network"); + $a->internalRedirect('network'); } if (strlen(Config::get('system','singleuser'))) { - goaway(System::baseUrl()."/profile/" . Config::get('system','singleuser')); + $a->internalRedirect('profile/' . Config::get('system','singleuser')); } }} @@ -24,8 +29,6 @@ function home_init(App $a) { if(! function_exists('home_content')) { function home_content(App $a) { - $o = ''; - if (x($_SESSION,'theme')) { unset($_SESSION['theme']); } @@ -33,21 +36,31 @@ function home_content(App $a) { unset($_SESSION['mobile-theme']); } - /// @TODO No absolute path used, maybe risky (security) - if (file_exists('home.html')) { - if (file_exists('home.css')) { + $customhome = false; + $defaultheader = '

' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '

'; + + $homefilepath = $a->getBasePath() . "/home.html"; + $cssfilepath = $a->getBasePath() . "/home.css"; + if (file_exists($homefilepath)) { + $customhome = $homefilepath; + if (file_exists($cssfilepath)) { $a->page['htmlhead'] .= ''; } - - $o .= file_get_contents('home.html'); - } else { - $o .= '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; } - $o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); + $login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1); + + $content = ''; + Addon::callHooks("home_content",$content); - call_hooks("home_content",$o); + $tpl = Renderer::getMarkupTemplate('home.tpl'); + return Renderer::replaceMacros($tpl, [ + '$defaultheader' => $defaultheader, + '$customhome' => $customhome, + '$login' => $login, + '$content' => $content + ]); return $o;