aboutsummaryrefslogtreecommitdiffstats
path: root/mod/home.php
diff options
context:
space:
mode:
authorThomas Willingham <beardyunixer@beardyunixer.com>2014-09-15 01:38:55 +0100
committerThomas Willingham <beardyunixer@beardyunixer.com>2014-09-15 01:38:55 +0100
commit6416a61c41d604f88625f583c8b5052eb1b3f512 (patch)
tree77f851782ba1715ceb9fa2e03c94ea11106dddce /mod/home.php
parentb5241c610fe3eeaebedebc94e43edb802565123a (diff)
downloadvolse-hubzilla-6416a61c41d604f88625f583c8b5052eb1b3f512.tar.gz
volse-hubzilla-6416a61c41d604f88625f583c8b5052eb1b3f512.tar.bz2
volse-hubzilla-6416a61c41d604f88625f583c8b5052eb1b3f512.zip
A bit of mod/home refactoring. This is a transient state, so it's still
messy, but it'll be much nicer after the move is finished.
Diffstat (limited to 'mod/home.php')
-rw-r--r--mod/home.php47
1 files changed, 27 insertions, 20 deletions
diff --git a/mod/home.php b/mod/home.php
index bc352976d..576213e06 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -39,10 +39,29 @@ function home_content(&$a) {
if(x($_SESSION,'mobile_theme'))
unset($_SESSION['mobile_theme']);
- $channel_address = get_config("system", "site_channel" );
- if ($channel_address){
- // We can do better, but until we figure out auto-linkification, let's keep things simple
+ if(get_config('system','projecthome')) {
+ $o .= file_get_contents('assets/home.html');
+ $a->page['template'] = 'full';
+ $a->page['title'] = t('Red Matrix - &quot;The Network&quot;');
+ return $o;
+ }
+
+
+// Deprecated
+ $channel_address = get_config("system", "site_channel" );
+
+// See if the sys channel set a homepage
+ if (! $channel_address) {
+ $u = get_sys_channel();
+ if ($u) {
+ $u = array($u);
+ // change to channel_id when below deprecated and skip the $u=...
+ $channel_address = $u[0]['channel_address'];
+ }
+ }
+
+ if ($channel_address){
$page_id = 'home';
@@ -50,11 +69,6 @@ function home_content(&$a) {
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",
@@ -63,31 +77,24 @@ function home_content(&$a) {
intval(ITEM_WEBPAGE)
);
- if(! $r) {
- notice( t('Item not found.') . EOL);
- return;
- }
-
+ if($r) {
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(get_config('system','projecthome')) {
- $o .= file_get_contents('assets/home.html');
- $a->page['template'] = 'full';
- $a->page['title'] = t('Red Matrix - &quot;The Network&quot;');
- return $o;
}
+// Nope, we didn't find an item. Let's see if there's any html
+
if(file_exists('home.html')) {
$o .= file_get_contents('home.html');
}
else {
- // If there's no site channel or home contents configured, fallback to the old behaviour
+ // If there's nothing special happening, just spit out a login box
$sitename = get_config('system','sitename');
if($sitename)