aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-12-04 23:16:16 -0800
committerFriendika <info@friendika.com>2010-12-04 23:16:16 -0800
commite9a1abd133aa3db62d17ef8bdc91e8a75f4004d3 (patch)
treed48e62fd2589c56d02844249e65168e7198f3029
parent4507a571d3bea1fd32337565d05230ed2b2119a9 (diff)
downloadvolse-hubzilla-e9a1abd133aa3db62d17ef8bdc91e8a75f4004d3.tar.gz
volse-hubzilla-e9a1abd133aa3db62d17ef8bdc91e8a75f4004d3.tar.bz2
volse-hubzilla-e9a1abd133aa3db62d17ef8bdc91e8a75f4004d3.zip
flatten conversation hierarchy to one level on import but preserve all thread info
in case somebody wants to write a plugin to display as multi-level thread
-rw-r--r--boot.php2
-rw-r--r--database.sql5
-rw-r--r--include/items.php19
-rw-r--r--update.php5
4 files changed, 25 insertions, 6 deletions
diff --git a/boot.php b/boot.php
index 545883eb9..49679c3b7 100644
--- a/boot.php
+++ b/boot.php
@@ -2,7 +2,7 @@
set_time_limit(0);
-define ( 'BUILD_ID', 1020 );
+define ( 'BUILD_ID', 1021 );
define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
define ( 'EOL', "<br />\r\n" );
diff --git a/database.sql b/database.sql
index 41d256d73..be0671bb1 100644
--- a/database.sql
+++ b/database.sql
@@ -153,14 +153,15 @@ CREATE TABLE IF NOT EXISTS `intro` (
CREATE TABLE IF NOT EXISTS `item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `uri` char(255) CHARACTER SET ascii NOT NULL,
+ `uri` char(255) NOT NULL,
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
`type` char(255) NOT NULL,
`wall` tinyint(1) NOT NULL DEFAULT '0',
`gravity` tinyint(1) NOT NULL DEFAULT '0',
`parent` int(10) unsigned NOT NULL DEFAULT '0',
- `parent-uri` char(255) CHARACTER SET ascii NOT NULL,
+ `parent-uri` char(255) NOT NULL,
+ `thr-parent` char(255) NOT NULL,
`created` datetime NOT NULL,
`edited` datetime NOT NULL,
`changed` datetime NOT NULL,
diff --git a/include/items.php b/include/items.php
index 04b86ab3f..a4d3953f9 100644
--- a/include/items.php
+++ b/include/items.php
@@ -553,9 +553,14 @@ function item_store($arr) {
// The content body has been through a lot of filtering and transport escaping by now.
// We don't want to skip any filters, however a side effect of all this filtering
- // is that ampersands will have been double encoded.
+ // is that ampersands and <> may have been double encoded, depending on which filter chain
+ // they came through.
- $arr['body'] = str_replace('&amp;amp;','&amp;',$arr['body']);
+ $arr['body'] = str_replace(
+ array('&amp;amp;','&amp;gt;','&amp;lt;'),
+ array('&amp;' ,'&gt;' ,'&lt;'),
+ $arr['body']
+ );
@@ -576,6 +581,16 @@ function item_store($arr) {
);
if(count($r)) {
+
+ // is the new message multi-level threaded?
+ // even though we don't support it now, preserve the info
+ // and re-attach to the conversation parent.
+
+ if($r[0]['uri'] != $r[0]['parent-uri']) {
+ $arr['thr-parent'] = $arr['parent-uri'];
+ $arr['parent-uri'] = $r[0]['parent-uri'];
+ }
+
$parent_id = $r[0]['id'];
$allow_cid = $r[0]['allow_cid'];
$allow_gid = $r[0]['allow_gid'];
diff --git a/update.php b/update.php
index 28e4bcf70..b1950e588 100644
--- a/update.php
+++ b/update.php
@@ -180,6 +180,9 @@ function update_1018() {
function update_1019() {
q("ALTER TABLE `mail` DROP `delivered`");
q("ALTER TABLE `profile` ADD `showwith` TINYINT(1) NOT NULL DEFAULT '0' AFTER `marital` ");
-
}
+function update_1020() {
+ q("ALTER TABLE `profile` DROP `showwith`");
+ q("ALTER TABLE `item` ADD `thr-parent` CHAR( 255 ) NOT NULL AFTER `parent-uri` ");
+}