]> git.mxchange.org Git - friendica.git/blob - mod/home.php
Use DBA::exists() in Photo::exists()
[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\Renderer;
10 use Friendica\Core\System;
11 use Friendica\Module\Login;
12
13 if(! function_exists('home_init')) {
14 function home_init(App $a) {
15
16         $ret = [];
17         Addon::callHooks('home_init',$ret);
18
19         if (local_user() && ($a->user['nickname'])) {
20                 $a->internalRedirect('network');
21         }
22
23         if (strlen(Config::get('system','singleuser'))) {
24                 $a->internalRedirect('profile/' . Config::get('system','singleuser'));
25         }
26
27 }}
28
29 if(! function_exists('home_content')) {
30 function home_content(App $a) {
31
32         if (!empty($_SESSION['theme'])) {
33                 unset($_SESSION['theme']);
34         }
35         if (!empty($_SESSION['mobile-theme'])) {
36                 unset($_SESSION['mobile-theme']);
37         }
38
39         $customhome = false;
40         $defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
41
42         $homefilepath = $a->getBasePath() . "/home.html";
43         $cssfilepath = $a->getBasePath() . "/home.css";
44         if (file_exists($homefilepath)) {
45                 $customhome = $homefilepath;
46                 if (file_exists($cssfilepath)) {
47                         $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
48                 }
49         }
50
51         $login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
52
53         $content = '';
54         Addon::callHooks("home_content",$content);
55
56
57         $tpl = Renderer::getMarkupTemplate('home.tpl');
58         return Renderer::replaceMacros($tpl, [
59                 '$defaultheader' => $defaultheader,
60                 '$customhome' => $customhome,
61                 '$login' => $login,
62                 '$content' => $content
63         ]);
64
65         return $o;
66
67 }}