From 7b3c29ebe69726f7d42c9327bebb2ea7251bccb4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 29 Jul 2013 17:30:46 -0700 Subject: fix bug #84, make imported messages from your clones show up on your wall --- boot.php | 2 +- include/items.php | 5 +++++ include/zot.php | 12 ++++++++++++ install/database.sql | 2 +- install/update.php | 9 ++++++++- mod/item.php | 3 +++ 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index c901d4d90..e108b000c 100755 --- a/boot.php +++ b/boot.php @@ -43,7 +43,7 @@ require_once('include/taxonomy.php'); define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1054 ); +define ( 'DB_UPDATE_VERSION', 1055 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/items.php b/include/items.php index bb4bd42e3..b22c02955 100755 --- a/include/items.php +++ b/include/items.php @@ -506,6 +506,11 @@ function get_item_elements($x) { $arr['edited'] = datetime_convert(); $arr['title'] = (($x['title']) ? htmlentities($x['title'], ENT_COMPAT,'UTF-8',false) : ''); + + if(mb_strlen($arr['title']) > 255) + $arr['title'] = mb_substr($arr['title'],0,255); + + $arr['app'] = (($x['app']) ? htmlentities($x['app'], ENT_COMPAT,'UTF-8',false) : ''); $arr['mid'] = (($x['message_id']) ? htmlentities($x['message_id'], ENT_COMPAT,'UTF-8',false) : ''); $arr['parent_mid'] = (($x['message_top']) ? htmlentities($x['message_top'], ENT_COMPAT,'UTF-8',false) : ''); diff --git a/include/zot.php b/include/zot.php index d2bb0842c..c53e6c267 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1033,6 +1033,18 @@ function process_delivery($sender,$arr,$deliveries,$relay) { $perm = (($arr['mid'] == $arr['parent_mid']) ? 'send_stream' : 'post_comments'); + // This is our own post, possibly coming from a channel clone + + if($arr['owner_xchan'] == $d['hash']) { + $arr['item_flags'] = $arr['item_flags'] | ITEM_WALL; + } + else { + // clear the wall flag if it is set + if($arr['item_flags'] & ITEM_WALL) { + $arr['item_flags'] = ($arr['item_flags'] ^ ITEM_WALL); + } + } + if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery)) { logger("permission denied for delivery {$channel['channel_id']}"); $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); diff --git a/install/database.sql b/install/database.sql index e8b01d066..29ee19a2d 100644 --- a/install/database.sql +++ b/install/database.sql @@ -443,7 +443,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `owner_xchan` char(255) NOT NULL DEFAULT '', `author_xchan` char(255) NOT NULL DEFAULT '', `mimetype` char(255) NOT NULL DEFAULT '', - `title` char(255) NOT NULL DEFAULT '', + `title` text NOT NULL DEFAULT '', `body` mediumtext NOT NULL, `app` char(255) NOT NULL DEFAULT '', `lang` char(64) NOT NULL DEFAULT '', diff --git a/install/update.php b/install/update.php index ba9e9e430..1ea9aa377 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ 255) + $datarray['title'] = mb_substr($datarray['title'],0,255); + if(array_key_exists('item_private',$datarray) && $datarray['item_private']) { logger('Encrypting local storage'); $key = get_config('system','pubkey'); -- cgit v1.2.3