fix bug #84, make imported messages from your clones show up on your wall

This commit is contained in:
friendica 2013-07-29 17:30:46 -07:00
parent 092ef64ac7
commit 7b3c29ebe6
6 changed files with 30 additions and 3 deletions

View File

@ -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', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -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) : '');

View File

@ -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() . '>');

View File

@ -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 '',

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1054 );
define( 'UPDATE_VERSION' , 1055 );
/**
*
@ -641,3 +641,10 @@ function update_r1053() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1054() {
$r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -580,6 +580,9 @@ function item_post(&$a) {
}
if(mb_strlen($datarray['title']) > 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');