aboutsummaryrefslogtreecommitdiffstats
path: root/mod/home.php
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2013-12-22 14:31:27 +0100
committerChristian Vogeley <christian.vogeley@hotmail.de>2013-12-22 14:31:27 +0100
commit870df76463a1cc9823b364db0bfb387f3f46664f (patch)
treea8c7391bfe799703aa0a8f26b9ee788f1204e8be /mod/home.php
parent25a533bd72c34e9775af71c010a39db6caf7b633 (diff)
parent7e7b5bfa4930493a8feae10b0550e29797956c70 (diff)
downloadvolse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.tar.gz
volse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.tar.bz2
volse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.zip
Merge remote-tracking branch 'upstream/master' into bootstrap
Conflicts: view/php/theme_init.php
Diffstat (limited to 'mod/home.php')
-rw-r--r--mod/home.php99
1 files changed, 54 insertions, 45 deletions
diff --git a/mod/home.php b/mod/home.php
index d17d477c8..05626dcb5 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -1,6 +1,9 @@
<?php
-if(! function_exists('home_init')) {
+require_once('include/items.php');
+require_once('include/conversation.php');
+
+
function home_init(&$a) {
$ret = array();
@@ -20,10 +23,9 @@ function home_init(&$a) {
goaway(z_root() . '/new_channel');
}
-}}
+}
-if(! function_exists('home_content')) {
function home_content(&$a) {
$o = '';
@@ -33,55 +35,62 @@ function home_content(&$a) {
if(x($_SESSION,'mobile_theme'))
unset($_SESSION['mobile_theme']);
-$channel_address = get_config("system", "site_channel" );
+ $channel_address = get_config("system", "site_channel" );
if ($channel_address){
-require_once('include/items.php');
-require_once('include/conversation.php');
-
-
-//We can do better, but until we figure out auto-linkification, let's keep things simple
- $page_id = 'home';
-
- $u = q("select channel_id from channel where channel_address = '%s' limit 1",
- dbesc($channel_address)
- );
+ // We can do better, but until we figure out auto-linkification, let's keep things simple
+
+ $page_id = 'home';
+
+ $u = q("select channel_id from channel where channel_address = '%s' limit 1",
+ dbesc($channel_address)
+ );
+
+ if(! $u) {
+ notice( t('Channel not found.') . EOL);
+ return;
+ }
+
+ $r = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
+ item_restrict = %d limit 1",
+ intval($u[0]['channel_id']),
+ dbesc($page_id),
+ intval(ITEM_WEBPAGE)
+ );
+
+ if(! $r) {
+ notice( t('Item not found.') . EOL);
+ return;
+ }
+
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+ $a->profile = array('profile_uid' => $u[0]['channel_id']);
+ $o .= prepare_page($r[0]);
+ return $o;
+ }
- if(! $u) {
- notice( t('Channel not found.') . EOL);
- return;
+ if(get_config('system','projecthome')) {
+ $o .= file_get_contents('assets/home.html');
+ $a->page['template'] = 'full';
+ return $o;
}
- $r = q("select item.* from item left join item_id on item.id = item_id.iid
- where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
- item_restrict = %d limit 1",
- intval($u[0]['channel_id']),
- dbesc($page_id),
- intval(ITEM_WEBPAGE)
- );
-
- if(! $r) {
- notice( t('Item not found.') . EOL);
- return;
+ if(file_exists('home.html')) {
+ $o .= file_get_contents('home.html');
}
+ else {
- xchan_query($r);
- $r = fetch_post_tags($r,true);
- $a->profile = array('profile_uid' => $u[0]['channel_id']);
- $o .= prepare_page($r[0]);
+ // If there's no site channel or home contents configured, fallback to the old behaviour
-}
-
-// If there's no site channel specified, fallback to the old behaviour
- else { $o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
- if(file_exists('home.html'))
- $o .= file_get_contents('home.html');
-}
-
- $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
-
- call_hooks("home_content",$o);
- return $o;
-}
+ $sitename = get_config('system','sitename');
+ if($sitename)
+ $o .= '<h1>' . sprintf( t("Welcome to %s") ,$sitename) . '</h1>';
+ if (! $a->config['system']['no_login_on_homepage'])
+ $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
+ }
+ call_hooks('home_content',$o);
+ return $o;
}