6 use Friendica\Core\Config;
7 use Friendica\Core\Hook;
8 use Friendica\Core\L10n;
9 use Friendica\Core\Renderer;
10 use Friendica\Core\System;
11 use Friendica\Module\Login;
13 if(! function_exists('home_init')) {
14 function home_init(App $a) {
17 Hook::callAll('home_init',$ret);
19 if (local_user() && ($a->user['nickname'])) {
20 $a->internalRedirect('network');
23 if (strlen(Config::get('system','singleuser'))) {
24 $a->internalRedirect('profile/' . Config::get('system','singleuser'));
29 if(! function_exists('home_content')) {
30 function home_content(App $a) {
32 if (!empty($_SESSION['theme'])) {
33 unset($_SESSION['theme']);
35 if (!empty($_SESSION['mobile-theme'])) {
36 unset($_SESSION['mobile-theme']);
40 $defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
42 $homefilepath = $a->getBasePath() . "/home.html";
43 $cssfilepath = $a->getBasePath() . "/home.css";
44 if (file_exists($homefilepath)) {
45 $customhome = $homefilepath;
46 if (file_exists($cssfilepath)) {
47 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
51 $login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
54 Hook::callAll("home_content",$content);
57 $tpl = Renderer::getMarkupTemplate('home.tpl');
58 return Renderer::replaceMacros($tpl, [
59 '$defaultheader' => $defaultheader,
60 '$customhome' => $customhome,
62 '$content' => $content