finish up the source route storage so we can prevent messages from flowing upstream in complicated delivery chains
This commit is contained in:
parent
1108eaaed0
commit
ced6d82633
2
boot.php
2
boot.php
@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
|
|||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1104 );
|
define ( 'DB_UPDATE_VERSION', 1105 );
|
||||||
|
|
||||||
define ( 'EOL', '<br />' . "\r\n" );
|
define ( 'EOL', '<br />' . "\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
@ -81,12 +81,8 @@ function collect_recipients($item,&$private) {
|
|||||||
|
|
||||||
$recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
|
$recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
|
||||||
|
|
||||||
$routes = q("select * from route where iid = %d",
|
if($item['route']) {
|
||||||
intval($item['id'])
|
$route = explode(',',$item['route']);
|
||||||
);
|
|
||||||
|
|
||||||
if($routes) {
|
|
||||||
$route = explode(',',$routes[0]['route']);
|
|
||||||
if(count($route)) {
|
if(count($route)) {
|
||||||
$route = array_unique($route);
|
$route = array_unique($route);
|
||||||
$recipients = array_diff($recipients,$route);
|
$recipients = array_diff($recipients,$route);
|
||||||
@ -156,21 +152,16 @@ function can_comment_on_post($observer_xchan,$item) {
|
|||||||
function add_source_route($iid,$hash) {
|
function add_source_route($iid,$hash) {
|
||||||
if((! $iid) || (! $route))
|
if((! $iid) || (! $route))
|
||||||
return;
|
return;
|
||||||
$r = q("select * from route where iid = %d limit 1",
|
$r = q("select route from item where id = %d limit 1",
|
||||||
intval($iid)
|
intval($iid)
|
||||||
);
|
);
|
||||||
if($r && $r[0]['route']) {
|
if($r) {
|
||||||
q("update route set route = '%s' where iid = %d limit 1",
|
$new_route = (($r[0]['route']) ? $r[0]['route'] . ',' : '') . $hash;
|
||||||
dbesc(',' . $hash),
|
q("update item set route = '%s' where id = %d limit 1",
|
||||||
|
(dbesc($new_route)),
|
||||||
intval($iid)
|
intval($iid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
q("insert into route ( iid, route ) values ( %d, '%s') ",
|
|
||||||
intval($iid),
|
|
||||||
dbesc($route)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -670,6 +661,7 @@ function get_item_elements($x) {
|
|||||||
|
|
||||||
|
|
||||||
$arr['app'] = (($x['app']) ? htmlspecialchars($x['app'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['app'] = (($x['app']) ? htmlspecialchars($x['app'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
|
$arr['route'] = (($x['route']) ? htmlspecialchars($x['route'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['mid'] = (($x['message_id']) ? htmlspecialchars($x['message_id'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['mid'] = (($x['message_id']) ? htmlspecialchars($x['message_id'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['parent_mid'] = (($x['message_top']) ? htmlspecialchars($x['message_top'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['parent_mid'] = (($x['message_top']) ? htmlspecialchars($x['message_top'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['thr_parent'] = (($x['message_parent']) ? htmlspecialchars($x['message_parent'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['thr_parent'] = (($x['message_parent']) ? htmlspecialchars($x['message_parent'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
@ -681,7 +673,7 @@ function get_item_elements($x) {
|
|||||||
$arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
$arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts');
|
$arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts');
|
||||||
|
|
||||||
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
|
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
|
||||||
|
|
||||||
@ -870,6 +862,7 @@ function encode_item($item) {
|
|||||||
$x['location'] = $item['location'];
|
$x['location'] = $item['location'];
|
||||||
$x['longlat'] = $item['coord'];
|
$x['longlat'] = $item['coord'];
|
||||||
$x['signature'] = $item['sig'];
|
$x['signature'] = $item['sig'];
|
||||||
|
$x['route'] = $item['route'];
|
||||||
|
|
||||||
$x['owner'] = encode_item_xchan($item['owner']);
|
$x['owner'] = encode_item_xchan($item['owner']);
|
||||||
$x['author'] = encode_item_xchan($item['author']);
|
$x['author'] = encode_item_xchan($item['author']);
|
||||||
|
@ -470,31 +470,32 @@ CREATE TABLE IF NOT EXISTS `item` (
|
|||||||
`author_xchan` char(255) NOT NULL DEFAULT '',
|
`author_xchan` char(255) NOT NULL DEFAULT '',
|
||||||
`source_xchan` char(255) NOT NULL DEFAULT '',
|
`source_xchan` char(255) NOT NULL DEFAULT '',
|
||||||
`mimetype` char(255) NOT NULL DEFAULT '',
|
`mimetype` char(255) NOT NULL DEFAULT '',
|
||||||
`title` text NOT NULL,
|
`title` text NOT NULL DEFAULT '',
|
||||||
`body` mediumtext NOT NULL,
|
`body` mediumtext NOT NULL DEFAULT '',
|
||||||
`app` char(255) NOT NULL DEFAULT '',
|
`app` char(255) NOT NULL DEFAULT '',
|
||||||
`lang` char(64) NOT NULL DEFAULT '',
|
`lang` char(64) NOT NULL DEFAULT '',
|
||||||
`revision` int(10) unsigned NOT NULL DEFAULT '0',
|
`revision` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`verb` char(255) NOT NULL DEFAULT '',
|
`verb` char(255) NOT NULL DEFAULT '',
|
||||||
`obj_type` char(255) NOT NULL DEFAULT '',
|
`obj_type` char(255) NOT NULL DEFAULT '',
|
||||||
`object` text NOT NULL,
|
`object` text NOT NULL DEFAULT '',
|
||||||
`tgt_type` char(255) NOT NULL DEFAULT '',
|
`tgt_type` char(255) NOT NULL DEFAULT '',
|
||||||
`target` text NOT NULL,
|
`target` text NOT NULL DEFAULT '',
|
||||||
`layout_mid` char(255) NOT NULL DEFAULT '',
|
`layout_mid` char(255) NOT NULL DEFAULT '',
|
||||||
`postopts` text NOT NULL,
|
`postopts` text NOT NULL DEFAULT '',
|
||||||
|
`route` text NOT NULL DEFAULT '',
|
||||||
`llink` char(255) NOT NULL DEFAULT '',
|
`llink` char(255) NOT NULL DEFAULT '',
|
||||||
`plink` char(255) NOT NULL DEFAULT '',
|
`plink` char(255) NOT NULL DEFAULT '',
|
||||||
`resource_id` char(255) NOT NULL DEFAULT '',
|
`resource_id` char(255) NOT NULL DEFAULT '',
|
||||||
`resource_type` char(16) NOT NULL DEFAULT '',
|
`resource_type` char(16) NOT NULL DEFAULT '',
|
||||||
`attach` mediumtext NOT NULL,
|
`attach` mediumtext NOT NULL DEFAULT '',
|
||||||
`sig` text NOT NULL,
|
`sig` text NOT NULL DEFAULT '',
|
||||||
`location` char(255) NOT NULL DEFAULT '',
|
`location` char(255) NOT NULL DEFAULT '',
|
||||||
`coord` char(255) NOT NULL DEFAULT '',
|
`coord` char(255) NOT NULL DEFAULT '',
|
||||||
`comment_policy` char(255) NOT NULL DEFAULT '',
|
`comment_policy` char(255) NOT NULL DEFAULT '',
|
||||||
`allow_cid` mediumtext NOT NULL,
|
`allow_cid` mediumtext NOT NULL DEFAULT '',
|
||||||
`allow_gid` mediumtext NOT NULL,
|
`allow_gid` mediumtext NOT NULL DEFAULT '',
|
||||||
`deny_cid` mediumtext NOT NULL,
|
`deny_cid` mediumtext NOT NULL DEFAULT '',
|
||||||
`deny_gid` mediumtext NOT NULL,
|
`deny_gid` mediumtext NOT NULL DEFAULT '',
|
||||||
`item_restrict` int(11) NOT NULL DEFAULT '0',
|
`item_restrict` int(11) NOT NULL DEFAULT '0',
|
||||||
`item_flags` int(11) NOT NULL DEFAULT '0',
|
`item_flags` int(11) NOT NULL DEFAULT '0',
|
||||||
`item_private` tinyint(4) NOT NULL DEFAULT '0',
|
`item_private` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1104 );
|
define( 'UPDATE_VERSION' , 1105 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1166,3 +1166,10 @@ function update_r1103() {
|
|||||||
set_config('system','curl_ssl_ciphers','ALL:!eNULL');
|
set_config('system','curl_ssl_ciphers','ALL:!eNULL');
|
||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1104() {
|
||||||
|
$r = q("ALTER TABLE `item` ADD `route` TEXT NOT NULL DEFAULT '' AFTER `postopts` ");
|
||||||
|
if($r)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user