diff options
-rwxr-xr-x | boot.php | 2 | ||||
-rwxr-xr-x | include/items.php | 5 | ||||
-rw-r--r-- | include/zot.php | 12 | ||||
-rw-r--r-- | install/database.sql | 2 | ||||
-rw-r--r-- | install/update.php | 9 | ||||
-rw-r--r-- | mod/item.php | 3 |
6 files changed, 30 insertions, 3 deletions
@@ -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' ); 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 @@ <?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; +} diff --git a/mod/item.php b/mod/item.php index 1a27cbe57..0509d8fab 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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'); |