]> git.mxchange.org Git - friendica.git/blob - mod/home.php
Merge pull request #4167 from MrPetovan/bug/4155-remove-proxy-oembed
[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 = array();
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         $o = '';
28
29         if (x($_SESSION,'theme')) {
30                 unset($_SESSION['theme']);
31         }
32         if (x($_SESSION,'mobile-theme')) {
33                 unset($_SESSION['mobile-theme']);
34         }
35
36         /// @TODO No absolute path used, maybe risky (security)
37         if (file_exists('home.html')) {
38                 if (file_exists('home.css')) {
39                         $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
40                 }
41
42                 $o .= file_get_contents('home.html');
43         } else {
44                 $o .= '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
45         }
46
47         $o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
48
49
50         call_hooks("home_content",$o);
51
52         return $o;
53
54 }}