streams/mod/home.php

84 lines
2 KiB
PHP
Raw Normal View History

2010-07-01 23:48:07 +00:00
<?php
require_once('include/items.php');
require_once('include/conversation.php');
2010-07-01 23:48:07 +00:00
function home_init(&$a) {
2011-12-15 09:09:38 +00:00
$ret = array();
2011-12-15 09:09:38 +00:00
call_hooks('home_init',$ret);
2011-12-15 09:08:19 +00:00
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
$channel = $a->get_channel();
2015-01-29 04:56:04 +00:00
if(local_channel() && $channel && $channel['xchan_url'] && ! $splash) {
2014-05-22 04:33:31 +00:00
$dest = $channel['channel_startpage'];
if(! $dest)
2015-01-29 04:56:04 +00:00
$dest = get_pconfig(local_channel(),'system','startpage');
if(! $dest)
$dest = get_config('system','startpage');
2014-05-22 04:33:31 +00:00
if(! $dest)
2015-06-07 23:19:59 +00:00
$dest = z_root() . '/network';
2013-05-18 09:03:59 +00:00
goaway($dest);
}
2010-09-17 12:19:56 +00:00
if(get_account_id() && ! $splash) {
goaway(z_root() . '/new_channel');
}
}
2010-07-01 23:48:07 +00:00
2014-11-21 01:38:41 +00:00
function home_content(&$a, $update = 0, $load = false) {
2013-05-31 02:38:37 +00:00
2010-10-31 23:38:22 +00:00
$o = '';
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
if(x($_SESSION,'mobile_theme'))
unset($_SESSION['mobile_theme']);
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
2015-06-07 23:19:59 +00:00
call_hooks('home_content',$o);
if($o)
return $o;
2015-06-08 01:15:26 +00:00
$frontpage = get_config('system','frontpage');
if($frontpage) {
if(strpos($frontpage,'include:') !== false) {
$file = trim(str_replace('include:' , '', $frontpage));
2015-06-07 23:19:59 +00:00
if(file_exists($file)) {
2015-06-08 01:15:26 +00:00
$a->page['template'] = 'full';
$a->page['title'] = t('$Projectname');
2015-06-07 23:19:59 +00:00
$o .= file_get_contents($file);
return $o;
}
}
if(strpos($frontpage,'http') !== 0)
$frontpage = z_root() . '/' . $frontpage;
if(intval(get_config('system','mirror_frontpage'))) {
$o = '<html><head><title>' . t('$Projectname') . '</title></head><body style="margin: 0; padding: 0; border: none;" ><iframe src="' . $frontpage . '" width="100%" height="100%" style="margin: 0; padding: 0; border: none;" ></iframe></body></html>';
echo $o;
killme();
2014-11-21 01:38:41 +00:00
}
goaway($frontpage);
}
2014-11-21 01:38:41 +00:00
2015-06-07 23:19:59 +00:00
$sitename = get_config('system','sitename');
if($sitename)
$o .= '<h1>' . sprintf( t("Welcome to %s") ,$sitename) . '</h1>';
2014-11-21 01:38:41 +00:00
$loginbox = get_config('system','login_on_homepage');
if(intval($loginbox) || $loginbox === false)
$o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
2014-11-21 01:38:41 +00:00
2014-11-23 22:51:04 +00:00
return $o;
}