2010-07-01 23:48:07 +00:00
|
|
|
<?php
|
|
|
|
|
2013-12-15 23:37:51 +00:00
|
|
|
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();
|
2015-03-21 23:46:28 +00:00
|
|
|
|
2011-12-15 09:09:38 +00:00
|
|
|
call_hooks('home_init',$ret);
|
2011-12-15 09:08:19 +00:00
|
|
|
|
2014-11-17 06:46:52 +00:00
|
|
|
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
|
2012-09-26 00:57:20 +00:00
|
|
|
|
2014-11-17 06:46:52 +00:00
|
|
|
$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'];
|
2013-05-18 08:42:04 +00:00
|
|
|
if(! $dest)
|
2015-01-29 04:56:04 +00:00
|
|
|
$dest = get_pconfig(local_channel(),'system','startpage');
|
2014-06-26 04:30:21 +00:00
|
|
|
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
|
|
|
|
2013-05-18 08:42:04 +00:00
|
|
|
goaway($dest);
|
|
|
|
}
|
2010-09-17 12:19:56 +00:00
|
|
|
|
2014-11-17 06:46:52 +00:00
|
|
|
if(get_account_id() && ! $splash) {
|
2013-05-27 12:27:35 +00:00
|
|
|
goaway(z_root() . '/new_channel');
|
2013-01-27 09:19:24 +00:00
|
|
|
}
|
|
|
|
|
2013-12-15 23:37:51 +00:00
|
|
|
}
|
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 = '';
|
2011-01-07 12:33:34 +00:00
|
|
|
|
2015-03-21 23:46:28 +00:00
|
|
|
|
2011-01-07 12:33:34 +00:00
|
|
|
if(x($_SESSION,'theme'))
|
|
|
|
unset($_SESSION['theme']);
|
2013-08-16 05:52:19 +00:00
|
|
|
if(x($_SESSION,'mobile_theme'))
|
|
|
|
unset($_SESSION['mobile_theme']);
|
2011-01-07 12:33:34 +00:00
|
|
|
|
2014-11-17 06:46:52 +00:00
|
|
|
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
|
2013-05-31 02:25:44 +00:00
|
|
|
|
2015-06-07 23:19:59 +00:00
|
|
|
call_hooks('home_content',$o);
|
|
|
|
if($o)
|
2014-09-15 00:38:55 +00:00
|
|
|
return $o;
|
2013-05-31 02:25:44 +00:00
|
|
|
|
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;
|
2015-04-01 00:52:03 +00:00
|
|
|
}
|
2014-09-15 00:38:55 +00:00
|
|
|
}
|
2015-06-09 04:19:05 +00:00
|
|
|
if(intval(get_config('system','mirror_frontpage'))) {
|
2015-06-09 23:52:00 +00:00
|
|
|
$o = '<html><head><title>' . t('$Projectname') . '</title></head><body style="margin: 0; padding: 0; border: none;" ><iframe src="' . z_root() . '/' . $frontpage . '" width="100%" height="100%" style="margin: 0; padding: 0; border: none;" ></iframe></body></html>';
|
2015-06-09 04:19:05 +00:00
|
|
|
echo $o;
|
|
|
|
killme();
|
2014-11-21 01:38:41 +00:00
|
|
|
}
|
2015-06-08 01:15:26 +00:00
|
|
|
goaway(z_root() . '/' . $frontpage);
|
2013-05-31 02:25:44 +00:00
|
|
|
}
|
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
|
|
|
|
2015-06-10 11:24:16 +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;
|
|
|
|
|
2015-06-10 09:58:45 +00:00
|
|
|
}
|