]> git.mxchange.org Git - friendica.git/blob - mod/home.php
Merge pull request #4262 from fabrixxm/frio-login
[friendica.git] / mod / home.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Core\Config;
5 use Friendica\Core\System;
6 use Friendica\Module\Login;
7
8 if(! function_exists('home_init')) {
9 function home_init(App $a) {
10
11         $ret = [];
12         call_hooks('home_init',$ret);
13
14         if (local_user() && ($a->user['nickname'])) {
15                 goaway(System::baseUrl()."/network");
16         }
17
18         if (strlen(Config::get('system','singleuser'))) {
19                 goaway(System::baseUrl()."/profile/" . Config::get('system','singleuser'));
20         }
21
22 }}
23
24 if(! function_exists('home_content')) {
25 function home_content(App $a) {
26
27         if (x($_SESSION,'theme')) {
28                 unset($_SESSION['theme']);
29         }
30         if (x($_SESSION,'mobile-theme')) {
31                 unset($_SESSION['mobile-theme']);
32         }
33
34         $customhome = false;
35         $defaultheader = '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
36
37         $homefilepath = $a->basepath . "/home.html";
38         $cssfilepath = $a->basepath . "/home.css";
39         if (file_exists($homefilepath)) {
40                 $customhome = $homefilepath;
41                 if (file_exists($cssfilepath)) {
42                         $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
43                 }
44         } 
45
46         $login = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
47
48         $content = '';
49         call_hooks("home_content",$content);
50
51
52         $tpl = get_markup_template('home.tpl');
53         return replace_macros($tpl, [
54                 '$defaultheader' => $defaultheader,
55                 '$customhome' => $customhome,
56                 '$login' => $login,
57                 '$content' => $content
58         ]);
59
60         return $o;
61
62 }}