aboutsummaryrefslogtreecommitdiffstats
path: root/mod/home.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-07-10 16:39:32 -0700
committerfriendica <info@friendica.com>2013-07-10 16:39:32 -0700
commitdf23bc9ad4511c1faab2efcf9a3558d81a8c2058 (patch)
tree33f4bb457a14c94ab8d48ec144538918f2b47c96 /mod/home.php
parent72d737cc82f5987791c9ceba0c8b99a505886274 (diff)
parent40a444f01b2d3e7cc9b9c8822a2e36c47e6a25f6 (diff)
downloadvolse-hubzilla-df23bc9ad4511c1faab2efcf9a3558d81a8c2058.tar.gz
volse-hubzilla-df23bc9ad4511c1faab2efcf9a3558d81a8c2058.tar.bz2
volse-hubzilla-df23bc9ad4511c1faab2efcf9a3558d81a8c2058.zip
Merge pull request #73 from beardy-unixer/master
Webpages
Diffstat (limited to 'mod/home.php')
-rw-r--r--mod/home.php50
1 files changed, 45 insertions, 5 deletions
diff --git a/mod/home.php b/mod/home.php
index f05daf3c7..86d489853 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -33,15 +33,55 @@ function home_content(&$a) {
if(x($_SESSION,'mobile-theme'))
unset($_SESSION['mobile-theme']);
- $o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
+$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)
+ );
+
+ 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]);
+
+}
+
+// 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);
+ $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
call_hooks("home_content",$o);
-
return $o;
-
+}
-}}
+}