2010-07-02 01:48:07 +02:00
|
|
|
<?php
|
2018-01-22 20:17:36 +01:00
|
|
|
/**
|
|
|
|
* @file mod/home.php
|
|
|
|
*/
|
2017-04-30 06:07:00 +02:00
|
|
|
use Friendica\App;
|
2018-01-17 19:42:40 +01:00
|
|
|
use Friendica\Core\Addon;
|
2017-11-07 03:22:52 +01:00
|
|
|
use Friendica\Core\Config;
|
2018-01-22 20:17:36 +01:00
|
|
|
use Friendica\Core\L10n;
|
2017-08-26 08:04:21 +02:00
|
|
|
use Friendica\Core\System;
|
2017-12-17 17:40:59 +01:00
|
|
|
use Friendica\Module\Login;
|
2017-04-30 06:07:00 +02:00
|
|
|
|
2017-03-21 17:02:59 +01:00
|
|
|
if(! function_exists('home_init')) {
|
2017-01-09 13:12:54 +01:00
|
|
|
function home_init(App $a) {
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2018-01-15 14:05:12 +01:00
|
|
|
$ret = [];
|
2018-01-17 19:42:40 +01:00
|
|
|
Addon::callHooks('home_init',$ret);
|
2011-12-15 10:08:19 +01:00
|
|
|
|
2016-12-20 11:14:30 +01:00
|
|
|
if (local_user() && ($a->user['nickname'])) {
|
2017-08-26 09:32:10 +02:00
|
|
|
goaway(System::baseUrl()."/network");
|
2016-12-20 11:14:30 +01:00
|
|
|
}
|
2011-03-01 04:44:47 +01:00
|
|
|
|
2017-11-07 03:22:52 +01:00
|
|
|
if (strlen(Config::get('system','singleuser'))) {
|
|
|
|
goaway(System::baseUrl()."/profile/" . Config::get('system','singleuser'));
|
2016-12-20 11:14:30 +01:00
|
|
|
}
|
2010-09-17 14:19:56 +02:00
|
|
|
|
2010-07-02 01:48:07 +02:00
|
|
|
}}
|
|
|
|
|
2017-03-21 17:02:59 +01:00
|
|
|
if(! function_exists('home_content')) {
|
2017-01-09 13:12:54 +01:00
|
|
|
function home_content(App $a) {
|
2010-09-17 14:19:56 +02:00
|
|
|
|
2016-12-20 11:14:30 +01:00
|
|
|
if (x($_SESSION,'theme')) {
|
2011-01-07 13:33:34 +01:00
|
|
|
unset($_SESSION['theme']);
|
2016-12-20 11:14:30 +01:00
|
|
|
}
|
|
|
|
if (x($_SESSION,'mobile-theme')) {
|
2012-09-07 01:24:34 +02:00
|
|
|
unset($_SESSION['mobile-theme']);
|
2016-12-20 11:14:30 +01:00
|
|
|
}
|
2011-01-07 13:33:34 +01:00
|
|
|
|
2018-01-17 17:27:27 +01:00
|
|
|
$customhome = false;
|
2018-07-07 23:46:30 +02:00
|
|
|
$defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
|
2018-01-17 13:27:41 +01:00
|
|
|
|
2018-01-17 16:33:27 +01:00
|
|
|
$homefilepath = $a->basepath . "/home.html";
|
|
|
|
$cssfilepath = $a->basepath . "/home.css";
|
2018-01-17 13:27:41 +01:00
|
|
|
if (file_exists($homefilepath)) {
|
|
|
|
$customhome = $homefilepath;
|
|
|
|
if (file_exists($cssfilepath)) {
|
2017-08-26 09:32:10 +02:00
|
|
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
|
2016-12-20 11:14:30 +01:00
|
|
|
}
|
2018-07-07 23:46:30 +02:00
|
|
|
}
|
2014-08-25 23:34:29 +02:00
|
|
|
|
2018-07-15 21:04:48 +02:00
|
|
|
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
2012-11-04 20:58:59 +01:00
|
|
|
|
2018-01-17 13:27:41 +01:00
|
|
|
$content = '';
|
2018-01-17 19:42:40 +01:00
|
|
|
Addon::callHooks("home_content",$content);
|
2010-11-19 00:06:33 +01:00
|
|
|
|
2014-08-25 23:34:29 +02:00
|
|
|
|
2018-01-17 13:27:41 +01:00
|
|
|
$tpl = get_markup_template('home.tpl');
|
|
|
|
return replace_macros($tpl, [
|
|
|
|
'$defaultheader' => $defaultheader,
|
|
|
|
'$customhome' => $customhome,
|
|
|
|
'$login' => $login,
|
|
|
|
'$content' => $content
|
|
|
|
]);
|
2014-08-25 23:34:29 +02:00
|
|
|
|
2010-07-02 01:48:07 +02:00
|
|
|
return $o;
|
|
|
|
|
2014-08-25 23:34:29 +02:00
|
|
|
}}
|