aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php2
-rw-r--r--include/deliver.php25
-rw-r--r--install/schema_mysql.sql4
-rw-r--r--install/schema_postgres.sql2
-rw-r--r--install/update.php13
-rw-r--r--mod/page.php17
-rw-r--r--mod/public.php5
-rw-r--r--version.inc2
8 files changed, 52 insertions, 18 deletions
diff --git a/boot.php b/boot.php
index 886ce3670..03f65db2f 100755
--- a/boot.php
+++ b/boot.php
@@ -49,7 +49,7 @@ define ( 'PLATFORM_NAME', 'redmatrix' );
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 8e3d5a7b4..8aca3dff4 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1266,6 +1266,7 @@ CREATE TABLE IF NOT EXISTS `site` (
`site_location` char(255) NOT NULL DEFAULT '',
`site_realm` char(255) NOT NULL DEFAULT '',
`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`),
@@ -1275,7 +1276,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;
-- --------------------------------------------------------
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index 48f3fe0fc..a68c7d12b 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -969,6 +969,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");
@@ -979,6 +980,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/page.php b/mod/page.php
index 25b4d8888..648bd81fd 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;
}
@@ -58,6 +61,8 @@ function page_init(&$a) {
require_once('include/security.php');
$sql_options = item_permissions_sql($u[0]['channel_id']);
+dbg(1);
+
$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 ) or ( service = 'PDL' and item_restrict = %d )) $sql_options $revision limit 1",
@@ -77,6 +82,8 @@ function page_init(&$a) {
dbesc($page_id),
intval(ITEM_WEBPAGE)
);
+
+dbg(0);
if($x) {
// Yes, it's there. You just aren't allowed to see it.
notice( t('Permission denied.') . EOL);
@@ -119,7 +126,7 @@ function page_content(&$a) {
return;
if($r[0]['item_restrict'] == ITEM_PDL) {
- $r[0]['body'] = t('Ipsum Lorem');
+ $r[0]['body'] = t('Lorem Ipsum');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';
diff --git a/mod/public.php b/mod/public.php
index 57c12e283..1f23a1999 100644
--- a/mod/public.php
+++ b/mod/public.php
@@ -60,17 +60,20 @@ function public_content(&$a, $update = 0, $load = false) {
}
require_once('include/identity.php');
+ require_once('include/security.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_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 " : '');
diff --git a/version.inc b/version.inc
index ad6095cb9..669f2bc59 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-06-07.1056
+2015-06-08.1057