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