aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-09 16:52:00 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-09 16:52:00 -0700
commit03357481f73d506ae36be9858dc757842408c6a9 (patch)
treea69772d6caf71f4986a26eb80d00ac4e8750b995
parentec1dcb8f2eccfd1a0dfc9c7eccea788a4b385e41 (diff)
parent805e2a28ee81febee2742587a1640b5fae1387a2 (diff)
downloadvolse-hubzilla-03357481f73d506ae36be9858dc757842408c6a9.tar.gz
volse-hubzilla-03357481f73d506ae36be9858dc757842408c6a9.tar.bz2
volse-hubzilla-03357481f73d506ae36be9858dc757842408c6a9.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts: install/schema_mysql.sql mod/home.php mod/page.php view/nl/messages.po view/nl/strings.php
-rwxr-xr-xboot.php2
-rw-r--r--include/deliver.php25
-rw-r--r--install/schema_mysql.sql6
-rw-r--r--install/schema_postgres.sql2
-rw-r--r--install/update.php13
-rw-r--r--mod/admin.php12
-rw-r--r--mod/home.php254
-rw-r--r--mod/magic.php2
-rw-r--r--mod/page.php12
-rw-r--r--mod/post.php7
-rw-r--r--mod/public.php155
-rw-r--r--mod/update_public.php37
-rw-r--r--mod/wfinger.php11
-rw-r--r--version.inc2
-rw-r--r--view/js/main.js2
-rw-r--r--view/theme/redbasic/css/style.css12
-rwxr-xr-xview/tpl/admin_site.tpl3
17 files changed, 303 insertions, 254 deletions
diff --git a/boot.php b/boot.php
index ed84f3ab8..863ad5520 100755
--- a/boot.php
+++ b/boot.php
@@ -49,7 +49,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1142 );
+define ( 'DB_UPDATE_VERSION', 1143 );
/**
* @brief Constant with a HTML line break.
diff --git a/include/deliver.php b/include/deliver.php
index 0fb7a4aeb..5ab44a620 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -30,16 +30,25 @@ function deliver_run($argv, $argc) {
if($h) {
$base = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
if($base !== z_root()) {
- $y = q("select site_update from site where site_url = '%s' ",
+ $y = q("select site_update, site_dead from site where site_url = '%s' ",
dbesc($base)
);
- if($y && $y[0]['site_update'] < datetime_convert('UTC','UTC','now - 1 month')) {
- q("update outq set outq_priority = %d where outq_hash = '%s'",
- intval($r[0]['outq_priority'] + 10),
- dbesc($r[0]['outq_hash'])
- );
- logger('immediate delivery deferred for site ' . $base);
- continue;
+ if($y) {
+ if(intval($y[0]['site_dead'])) {
+ q("delete from outq where outq_posturl = '%s'",
+ dbesc($r[0]['outq_posturl'])
+ );
+ logger('dead site ignored ' . $base);
+ continue;
+ }
+ if($y[0]['site_update'] < datetime_convert('UTC','UTC','now - 1 month')) {
+ q("update outq set outq_priority = %d where outq_hash = '%s'",
+ intval($r[0]['outq_priority'] + 10),
+ dbesc($r[0]['outq_hash'])
+ );
+ logger('immediate delivery deferred for site ' . $base);
+ continue;
+ }
}
}
}
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 407565f79..c1344e6df 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1067,7 +1067,8 @@ CREATE TABLE IF NOT EXISTS `site` (
`site_sellpage` char(255) NOT NULL DEFAULT '',
`site_location` char(255) NOT NULL DEFAULT '',
`site_realm` char(255) NOT NULL DEFAULT '',
- `site_valid` smallint(6) NOT NULL DEFAULT '0',
+ `site_valid` smallint NOT NULL DEFAULT '0',
+ `site_dead` smallint NOT NULL DEFAULT '0',
PRIMARY KEY (`site_url`),
KEY `site_flags` (`site_flags`),
KEY `site_update` (`site_update`),
@@ -1077,7 +1078,8 @@ CREATE TABLE IF NOT EXISTS `site` (
KEY `site_sellpage` (`site_sellpage`),
KEY `site_pull` (`site_pull`),
KEY `site_realm` (`site_realm`),
- KEY `site_valid` (`site_valid`)
+ KEY `site_valid` (`site_valid`),
+ KEY `site_dead` (`site_dead`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `source` (
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index 0db9e341f..7c8d74ae5 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -972,6 +972,7 @@ CREATE TABLE "site" (
"site_location" text NOT NULL DEFAULT '',
"site_realm" text NOT NULL DEFAULT '',
"site_valid" smallint NOT NULL DEFAULT '0',
+ "site_dead" smallint NOT NULL DEFAULT '0',
PRIMARY KEY ("site_url")
);
create index "site_flags" on site ("site_flags");
@@ -982,6 +983,7 @@ create index "site_access" on site ("site_access");
create index "site_sellpage" on site ("site_sellpage");
create index "site_realm" on site ("site_realm");
create index "site_valid" on site ("site_valid");
+create index "site_dead" on site ("site_dead");
CREATE TABLE "source" (
"src_id" serial NOT NULL,
diff --git a/install/update.php b/install/update.php
index 13a45d301..62c976218 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1142 );
+define( 'UPDATE_VERSION' , 1143 );
/**
*
@@ -1645,4 +1645,15 @@ function update_r1141() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
+}
+
+function update_r1142() {
+
+ $r1 = q("alter table site add site_dead smallint not null default '0' ");
+ $r2 = q("create index site_dead on site ( site_dead ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
} \ No newline at end of file
diff --git a/mod/admin.php b/mod/admin.php
index d3bbd8d01..0141f655f 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -279,6 +279,7 @@ function admin_page_site_post(&$a){
$abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
+ $frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
@@ -286,7 +287,7 @@ function admin_page_site_post(&$a){
$block_public = ((x($_POST,'block_public')) ? True : False);
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? True : False);
- $no_login_on_homepage = ((x($_POST,'no_login_on_homepage')) ? True : False);
+ $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
$default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0);
@@ -307,8 +308,9 @@ function admin_page_site_post(&$a){
set_config('system', 'delivery_interval', $delivery_interval);
set_config('system', 'poll_interval', $poll_interval);
set_config('system', 'maxloadavg', $maxloadavg);
+ set_config('system', 'frontpage', $frontpage);
set_config('system', 'sitename', $sitename);
- set_config('system', 'no_login_on_homepage', $no_login_on_homepage);
+ set_config('system', 'login_on_homepage', $login_on_homepage);
set_config('system', 'verify_email', $verify_email);
set_config('system', 'default_expire_days', $default_expire_days);
@@ -441,6 +443,9 @@ function admin_page_site(&$a) {
// SSL_POLICY_FULL => t("Force all links to use SSL")
// );
+
+ $homelogin = get_config('system','login_on_homepage');
+
$t = get_markup_template("admin_site.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
@@ -466,6 +471,7 @@ function admin_page_site(&$a) {
'$register_policy' => array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices),
'$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices),
'$register_text' => array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")),
+ '$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
'$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
'$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
'$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")),
@@ -474,7 +480,7 @@ function admin_page_site(&$a) {
'$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$disable_discover_tab' => array('disable_discover_tab', t("Disable discovery tab"), get_config('system','disable_discover_tab'), t("Remove the tab in the network view with public content pulled from sources chosen for this site.")),
- '$no_login_on_homepage' => array('no_login_on_homepage', t("No login on Homepage"), get_config('system','no_login_on_homepage'), t("Check to hide the login form from your sites homepage when visitors arrive who are not logged in (e.g. when you put the content of the homepage in via the site channel).")),
+ '$login_on_homepage' => array('login_on_homepage', t("login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
diff --git a/mod/home.php b/mod/home.php
index 202a4d2d7..b2779051d 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -20,7 +20,7 @@ function home_init(&$a) {
if(! $dest)
$dest = get_config('system','startpage');
if(! $dest)
- $dest = z_root() . '/apps';
+ $dest = z_root() . '/network';
goaway($dest);
}
@@ -37,9 +37,6 @@ function home_content(&$a, $update = 0, $load = false) {
$o = '';
- if($load)
- $_SESSION['loadtime'] = datetime_convert();
-
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
if(x($_SESSION,'mobile_theme'))
@@ -47,238 +44,39 @@ function home_content(&$a, $update = 0, $load = false) {
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
- if(get_config('system','projecthome')) {
- $o .= file_get_contents('assets/home.html');
- $a->page['template'] = 'full';
- $a->page['title'] = t('$Projectname');
+ call_hooks('home_content',$o);
+ if($o)
return $o;
- }
-
-
- // Deprecated
- $channel_address = get_config("system", "site_channel" );
-
- // See if the sys channel set a homepage
- if (! $channel_address) {
- require_once('include/identity.php');
- $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';
- $randpage_id = 'home-%';
- $u = q("select channel_id from channel where channel_address = '%s' limit 1",
- dbesc($channel_address)
- );
-
- $randfunc = db_getfunc('RAND');
-
- $r = q("select item.* from item left join item_id on item.id = item_id.iid
- where item.uid = %d and ( sid = '%s' or sid like '%s' ) and service = 'WEBPAGE' and
- item_type = %d ORDER BY $randfunc limit 1",
- intval($u[0]['channel_id']),
- dbesc($page_id),
- dbesc($randpage_id),
- intval(ITEM_WEBPAGE)
- );
-
- if($r) {
- xchan_query($r);
- $r = fetch_post_tags($r,true);
-
- if($r[0]['layout_mid']) {
- $l = q("select body from item where mid = '%s' and uid = %d limit 1",
- dbesc($r[0]['layout_mid']),
- intval($u[0]['channel_id'])
- );
-
- if($l) {
- require_once('include/comanche.php');
- comanche_parser($a,$l[0]['body']);
- $a->pdl = $l[0]['body'];
- }
+ $frontpage = get_config('system','frontpage');
+ if($frontpage) {
+ if(strpos($frontpage,'include:') !== false) {
+ $file = trim(str_replace('include:' , '', $frontpage));
+ if(file_exists($file)) {
+ $a->page['template'] = 'full';
+ $a->page['title'] = t('$Projectname');
+ $o .= file_get_contents($file);
+ return $o;
}
-
- $a->profile = array('profile_uid' => $u[0]['channel_id']);
- $a->profile_uid = $u[0]['channel_id'];
- $o .= prepare_page($r[0]);
- 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 {
- $sitename = get_config('system','sitename');
- if($sitename)
- $o .= '<h1>' . sprintf( t("Welcome to %s") ,$sitename) . '</h1>';
-
- if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
- // If there's nothing special happening, just spit out a login box
-
- if (! $a->config['system']['no_login_on_homepage'])
- $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
- return $o;
+ 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="' . z_root() . '/' . $frontpage . '" width="100%" height="100%" style="margin: 0; padding: 0; border: none;" ></iframe></body></html>';
+ echo $o;
+ killme();
}
- else {
-
- if(get_config('system','disable_discover_tab')) {
- call_hooks('home_content',$o);
- return $o;
- }
-
- if(! $update) {
-
- $maxheight = get_config('system','home_divmore_height');
- if(! $maxheight)
- $maxheight = 75;
-
- $o .= '<div id="live-home"></div>' . "\r\n";
- $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
- . "; var profile_page = " . $a->pager['page']
- . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
-
- $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
- '$baseurl' => z_root(),
- '$pgtype' => 'home',
- '$uid' => ((local_channel()) ? local_channel() : '0'),
- '$gid' => '0',
- '$cid' => '0',
- '$cmin' => '0',
- '$cmax' => '99',
- '$star' => '0',
- '$liked' => '0',
- '$conv' => '0',
- '$spam' => '0',
- '$fh' => '1',
- '$nouveau' => '0',
- '$wall' => '0',
- '$list' => '0',
- '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1),
- '$search' => '',
- '$order' => 'comment',
- '$file' => '',
- '$cats' => '',
- '$tags' => '',
- '$dend' => '',
- '$mid' => '',
- '$verb' => '',
- '$dbegin' => ''
- ));
- }
-
- if($update && ! $load) {
- // only setup pagination on initial page view
- $pager_sql = '';
- }
- else {
- $a->set_pager_itemspage(20);
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
- }
-
- require_once('include/identity.php');
-
- if(get_config('system','site_firehose')) {
- require_once('include/security.php');
- $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
- }
- else {
- $sys = get_sys_channel();
- $uids = " and item.uid = " . intval($sys['channel_id']) . " ";
- $a->data['firehose'] = intval($sys['channel_id']);
- }
-
- $page_mode = 'list';
-
- $simple_update = (($update) ? " and item.item_unseen = 1 " : '');
-
- if($update && $_SESSION['loadtime'])
- $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
- if($load)
- $simple_update = '';
-
- //logger('update: ' . $update . ' load: ' . $load);
-
- if($update) {
-
- $ordering = "commented";
-
- if($load) {
-
- // Fetch a page full of parent items for this page
-
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
- left join abook on item.author_xchan = abook.abook_xchan
- WHERE true $uids AND item.item_restrict = 0
- AND item.parent = item.id
- and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets
- ORDER BY $ordering DESC $pager_sql ",
- intval(ABOOK_FLAG_BLOCKED)
- );
-
-
- }
- elseif($update) {
-
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
- left join abook on item.author_xchan = abook.abook_xchan
- WHERE true $uids AND item.item_restrict = 0
- AND item.parent = item.id $simple_update
- and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets",
- intval(ABOOK_FLAG_BLOCKED)
- );
- $_SESSION['loadtime'] = datetime_convert();
- }
- // Then fetch all the children of the parents that are on this page
- $parents_str = '';
- $update_unseen = '';
-
- if($r) {
-
- $parents_str = ids_to_querystr($r,'item_id');
-
- $items = q("SELECT item.*, item.id AS item_id FROM item
- WHERE true $uids AND item.item_restrict = 0
- AND item.parent IN ( %s )
- $sql_extra ",
- dbesc($parents_str)
- );
-
- xchan_query($items,true,(-1));
- $items = fetch_post_tags($items,true);
- $items = conv_sort($items,$ordering);
- }
- else {
- $items = array();
- }
-
- }
-
- // fake it
- $mode = ('network');
-
- $o .= conversation($a,$items,$mode,$update,$page_mode);
+ goaway(z_root() . '/' . $frontpage);
+ }
- if(($items) && (! $update))
- $o .= alt_pager($a,count($items));
- return $o;
+ $sitename = get_config('system','sitename');
+ if($sitename)
+ $o .= '<h1>' . sprintf( t("Welcome to %s") ,$sitename) . '</h1>';
- }
- call_hooks('home_content',$o);
- return $o;
+ if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
+ // If there's nothing special happening, just spit out a login box
+ $loginbox = get_config('system','login_on_homepage');
+ if(intval($loginbox) || $loginbox === false)
+ $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
}
return $o;
diff --git a/mod/magic.php b/mod/magic.php
index df8ac39a8..2fee87241 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -133,7 +133,6 @@ function magic_init(&$a) {
$channel['token'] = $token;
$channel['token_sig'] = $token_sig;
-
$r = q("insert into verify ( type, channel, token, meta, created) values ('%s','%d','%s','%s','%s')",
dbesc('auth'),
intval($channel['channel_id']),
@@ -141,7 +140,6 @@ function magic_init(&$a) {
dbesc($x[0]['hubloc_url']),
dbesc(datetime_convert())
);
-
$target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . $a->get_hostname())
. '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION;
diff --git a/mod/page.php b/mod/page.php
index c37dc7d0b..b635a60f2 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -11,10 +11,11 @@ function page_init(&$a) {
$profile = 0;
profile_load($a,$which,$profile);
- if($a->profile['profile_uid'])
- head_set_icon($a->profile['thumb']);
+ if($a->profile['profile_uid'])
+ head_set_icon($a->profile['thumb']);
+
// load the item here in the init function because we need to extract
// the page layout and initialise the correct theme.
@@ -22,9 +23,11 @@ function page_init(&$a) {
$observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
- $perms = get_all_perms($a->profile['profile_uid'],$ob_hash);
- if(! $perms['view_pages']) {
+ // perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'.
+ // This bypasses that restriction for sys channel (public) content
+
+ if((! perm_is_allowed($a->profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel($a->profile['profile_uid']))) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -77,6 +80,7 @@ function page_init(&$a) {
dbesc($page_id),
intval(ITEM_TYPE_WEBPAGE)
);
+
if($x) {
// Yes, it's there. You just aren't allowed to see it.
notice( t('Permission denied.') . EOL);
diff --git a/mod/post.php b/mod/post.php
index fe0860cc6..66a354ead 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -745,8 +745,13 @@ function post_post(&$a) {
$sender_hash = make_xchan_hash($arr['guid'],$arr['guid_sig']);
// garbage collect any old unused notifications
+
+ // This was and should be 10 minutes but my hosting provider has time lag between the DB and
+ // the web server. We should probably convert this to webserver time rather than DB time so
+ // that the different clocks won't affect it and allow us to keep the time short.
+
q("delete from verify where type = 'auth' and created < %s - INTERVAL %s",
- db_utcnow(), db_quoteinterval('10 MINUTE')
+ db_utcnow(), db_quoteinterval('30 MINUTE')
);
$y = q("select xchan_pubkey from xchan where xchan_hash = '%s' limit 1",
diff --git a/mod/public.php b/mod/public.php
new file mode 100644
index 000000000..1f23a1999
--- /dev/null
+++ b/mod/public.php
@@ -0,0 +1,155 @@
+<?php
+
+require_once('include/conversation.php');
+
+function public_content(&$a, $update = 0, $load = false) {
+
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
+ if(get_config('system','disable_discover_tab'))
+ return;
+
+ if(! $update) {
+
+ $maxheight = get_config('system','home_divmore_height');
+ if(! $maxheight)
+ $maxheight = 75;
+
+ $o .= '<div id="live-public"></div>' . "\r\n";
+ $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
+ . "; var profile_page = " . $a->pager['page']
+ . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
+
+ $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
+ '$baseurl' => z_root(),
+ '$pgtype' => 'public',
+ '$uid' => ((local_channel()) ? local_channel() : '0'),
+ '$gid' => '0',
+ '$cid' => '0',
+ '$cmin' => '0',
+ '$cmax' => '99',
+ '$star' => '0',
+ '$liked' => '0',
+ '$conv' => '0',
+ '$spam' => '0',
+ '$fh' => '1',
+ '$nouveau' => '0',
+ '$wall' => '0',
+ '$list' => '0',
+ '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1),
+ '$search' => '',
+ '$order' => 'comment',
+ '$file' => '',
+ '$cats' => '',
+ '$tags' => '',
+ '$dend' => '',
+ '$mid' => '',
+ '$verb' => '',
+ '$dbegin' => ''
+ ));
+ }
+
+ if($update && ! $load) {
+ // only setup pagination on initial page view
+ $pager_sql = '';
+ }
+ else {
+ $a->set_pager_itemspage(20);
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
+ }
+
+ require_once('include/identity.php');
+ require_once('include/security.php');
+
+ if(get_config('system','site_firehose')) {
+ $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and (item_flags & " . intval(ITEM_WALL) . " ) > 0 ";
+ }
+ else {
+ $sys = get_sys_channel();
+ $uids = " and item.uid = " . intval($sys['channel_id']) . " ";
+ $sql_extra = item_permissions_sql($sys['channel_id']);
+ $a->data['firehose'] = intval($sys['channel_id']);
+ }
+
+
+
+ $page_mode = 'list';
+
+ $simple_update = (($update) ? " and item.item_unseen = 1 " : '');
+
+ if($update && $_SESSION['loadtime'])
+ $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
+ if($load)
+ $simple_update = '';
+
+ //logger('update: ' . $update . ' load: ' . $load);
+
+ if($update) {
+
+ $ordering = "commented";
+
+ if($load) {
+
+ // Fetch a page full of parent items for this page
+
+ $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ left join abook on item.author_xchan = abook.abook_xchan
+ WHERE true $uids AND item.item_restrict = 0
+ AND item.parent = item.id
+ and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
+ $sql_extra3 $sql_extra $sql_nets
+ ORDER BY $ordering DESC $pager_sql ",
+ intval(ABOOK_FLAG_BLOCKED)
+ );
+
+
+ }
+ elseif($update) {
+
+ $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ left join abook on item.author_xchan = abook.abook_xchan
+ WHERE true $uids AND item.item_restrict = 0
+ AND item.parent = item.id $simple_update
+ and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
+ $sql_extra3 $sql_extra $sql_nets",
+ intval(ABOOK_FLAG_BLOCKED)
+ );
+ $_SESSION['loadtime'] = datetime_convert();
+ }
+ // Then fetch all the children of the parents that are on this page
+ $parents_str = '';
+ $update_unseen = '';
+
+ if($r) {
+
+ $parents_str = ids_to_querystr($r,'item_id');
+
+ $items = q("SELECT item.*, item.id AS item_id FROM item
+ WHERE true $uids AND item.item_restrict = 0
+ AND item.parent IN ( %s )
+ $sql_extra ",
+ dbesc($parents_str)
+ );
+
+ xchan_query($items,true,(-1));
+ $items = fetch_post_tags($items,true);
+ $items = conv_sort($items,$ordering);
+ }
+ else {
+ $items = array();
+ }
+
+ }
+
+ // fake it
+ $mode = ('network');
+
+ $o .= conversation($a,$items,$mode,$update,$page_mode);
+
+ if(($items) && (! $update))
+ $o .= alt_pager($a,count($items));
+
+ return $o;
+
+} \ No newline at end of file
diff --git a/mod/update_public.php b/mod/update_public.php
new file mode 100644
index 000000000..d0a08e0e6
--- /dev/null
+++ b/mod/update_public.php
@@ -0,0 +1,37 @@
+<?php
+
+// See update_profile.php for documentation
+
+require_once('mod/public.php');
+
+function update_public_content(&$a) {
+
+ $profile_uid = ((intval($_GET['p'])) ? intval($_GET['p']) : (-1));
+ $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
+ header("Content-type: text/html");
+ echo "<!DOCTYPE html><html><body>\r\n";
+ echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '<div>' : '<section>');
+
+ $text = public_content($a,$profile_uid, $load);
+ $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
+ $replace = "<img\${1} dst=\"\${2}\"";
+ $text = preg_replace($pattern, $replace, $text);
+
+ if(! $load) {
+ $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
+ $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ }
+
+ echo str_replace("\t",' ',$text);
+ echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
+ echo "</body></html>\r\n";
+ killme();
+
+} \ No newline at end of file
diff --git a/mod/wfinger.php b/mod/wfinger.php
index eba17de51..1493dd6ba 100644
--- a/mod/wfinger.php
+++ b/mod/wfinger.php
@@ -55,14 +55,23 @@ function wfinger_init(&$a) {
if($resource && $r) {
+ $h = q("select hubloc_addr from hubloc where hubloc_hash = '%s'",
+ dbesc($r[0]['channel_hash'])
+ );
+
$result['subject'] = $resource;
$aliases = array(
- 'acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(),
z_root() . '/channel/' . $r[0]['channel_address'],
z_root() . '/~' . $r[0]['channel_address']
);
+ if($h) {
+ foreach($h as $hh) {
+ $aliases[] = 'acct:' . $hh['hubloc_addr'];
+ }
+ }
+
$result['aliases'] = array();
$result['properties'] = array('http://webfinger.net/ns/name' => $r[0]['channel_name']);
diff --git a/version.inc b/version.inc
index 06a776b25..154027d3a 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-06-06.1055
+2015-06-09.1058
diff --git a/view/js/main.js b/view/js/main.js
index 35944e13f..625ac5b01 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -372,7 +372,7 @@ function NavUpdate() {
if($('#live-network').length) { src = 'network'; liveUpdate(); }
if($('#live-channel').length) { src = 'channel'; liveUpdate(); }
- if($('#live-home').length) { src = 'home'; liveUpdate(); }
+ if($('#live-public').length) { src = 'public'; liveUpdate(); }
if($('#live-display').length) { src = 'display'; liveUpdate(); }
if($('#live-search').length) { src = 'search'; liveUpdate(); }
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index f391c84e3..a671a6671 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -2053,6 +2053,18 @@ nav .badge.mail-update:hover {
padding: 7px 10px;
}
+.nav-tabs.nav-justified > .active > a,
+.nav-tabs.nav-justified > .active > a:hover,
+.nav-tabs.nav-justified > .active > a:focus {
+ border-bottom-color: transparent;
+}
+
+.nav-tabs > li.active > a,
+.nav-tabs > li.active > a:hover,
+.nav-tabs > li.active > a:focus {
+ background-color: transparent;
+}
+
#tabs-collapse-1 {
padding: 0px;
margin-bottom: 25px;
diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl
index 225b281cc..eabb6f067 100755
--- a/view/tpl/admin_site.tpl
+++ b/view/tpl/admin_site.tpl
@@ -46,7 +46,8 @@
{{include file="field_select.tpl" field=$language}}
{{include file="field_select.tpl" field=$theme}}
{{include file="field_select.tpl" field=$theme_mobile}}
- {{include file="field_checkbox.tpl" field=$no_login_on_homepage}}
+ {{include file="field_input.tpl" field=$frontpage}}
+ {{include file="field_checkbox.tpl" field=$login_on_homepage}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>