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