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