]> git.mxchange.org Git - friendica.git/blob - mod/home.php
Merge pull request #3418 from gerhard6380/develop
[friendica.git] / mod / home.php
1 <?php
2
3 use Friendica\App;
4
5 if(! function_exists('home_init')) {
6 function home_init(App $a) {
7
8         $ret = array();
9         call_hooks('home_init',$ret);
10
11         if (local_user() && ($a->user['nickname'])) {
12                 goaway(App::get_baseurl()."/network");
13         }
14
15         if (strlen(get_config('system','singleuser'))) {
16                 goaway(App::get_baseurl()."/profile/" . get_config('system','singleuser'));
17         }
18
19 }}
20
21 if(! function_exists('home_content')) {
22 function home_content(App $a) {
23
24         $o = '';
25
26         if (x($_SESSION,'theme')) {
27                 unset($_SESSION['theme']);
28         }
29         if (x($_SESSION,'mobile-theme')) {
30                 unset($_SESSION['mobile-theme']);
31         }
32
33         /// @TODO No absolute path used, maybe risky (security)
34         if (file_exists('home.html')) {
35                 if (file_exists('home.css')) {
36                         $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.App::get_baseurl().'/home.css'.'" media="all" />';
37                 }
38
39                 $o .= file_get_contents('home.html');
40         } else {
41                 $o .= '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
42         }
43
44
45         $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
46
47         call_hooks("home_content",$o);
48
49         return $o;
50
51 }}