aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-04-06 02:57:33 -0700
committerfriendica <info@friendica.com>2014-04-06 02:57:33 -0700
commitad60e2c566930409d853517ca9392f169fc8e747 (patch)
tree120630a3c0dbf43de66ab5f46714a7f75072e2c5
parenta2b949f3393206ffe2e1195d6abaa883f299b471 (diff)
downloadvolse-hubzilla-ad60e2c566930409d853517ca9392f169fc8e747.tar.gz
volse-hubzilla-ad60e2c566930409d853517ca9392f169fc8e747.tar.bz2
volse-hubzilla-ad60e2c566930409d853517ca9392f169fc8e747.zip
use parent_mid in the parent query for enotify instead of of the parent id. This should fix the issue with encrypted content in the notification messages (for locally posted replies). The fix was a bit harder than anticipated because we store the parent id as an int in the notify table so this had to be modified to char storage as well.
-rwxr-xr-xboot.php2
-rw-r--r--include/enotify.php17
-rw-r--r--install/database.sql2
-rw-r--r--install/update.php9
-rw-r--r--mod/notify.php2
-rw-r--r--version.inc2
6 files changed, 21 insertions, 13 deletions
diff --git a/boot.php b/boot.php
index 643e860c8..48b3156fb 100755
--- a/boot.php
+++ b/boot.php
@@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1106 );
+define ( 'DB_UPDATE_VERSION', 1107 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/include/enotify.php b/include/enotify.php
index 96a152d31..5be21f180 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -102,7 +102,7 @@ function notification($params) {
if(array_key_exists('item',$params) && (! visible_activity($params['item'])))
return;
- $parent_id = $params['parent'];
+ $parent_mid = $params['parent_mid'];
// Check to see if there was already a notify for this post.
// If so don't create a second notification
@@ -123,9 +123,9 @@ function notification($params) {
$p = null;
- if($params['otype'] === 'item' && $parent_id) {
- $p = q("select * from item where id = %d and uid = %d limit 1",
- intval($parent_id),
+ if($params['otype'] === 'item' && $parent_mid) {
+ $p = q("select * from item where mid = '%s' and uid = %d limit 1",
+ dbesc($parent_mid),
intval($recip['channel_id'])
);
}
@@ -135,6 +135,7 @@ function notification($params) {
$item_post_type = item_post_type($p[0]);
$private = $p[0]['item_private'];
+ $parent_id = $p[0]['id'];
//$possess_desc = str_replace('<!item_type!>',$possess_desc);
@@ -338,7 +339,7 @@ function notification($params) {
$datarray['aid'] = $recip['channel_account_id'];
$datarray['uid'] = $recip['channel_id'];
$datarray['link'] = $itemlink;
- $datarray['parent'] = $parent_id;
+ $datarray['parent'] = $parent_mid;
$datarray['type'] = $params['type'];
$datarray['verb'] = $params['verb'];
$datarray['otype'] = $params['otype'];
@@ -355,7 +356,7 @@ function notification($params) {
// create notification entry in DB
$r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,type,verb,otype)
- values('%s','%s','%s','%s','%s',%d,%d,'%s',%d,%d,'%s','%s')",
+ values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,'%s','%s')",
dbesc($datarray['hash']),
dbesc($datarray['name']),
dbesc($datarray['url']),
@@ -364,7 +365,7 @@ function notification($params) {
intval($datarray['aid']),
intval($datarray['uid']),
dbesc($datarray['link']),
- intval($datarray['parent']),
+ dbesc($datarray['parent']),
intval($datarray['type']),
dbesc($datarray['verb']),
dbesc($datarray['otype'])
@@ -432,7 +433,7 @@ function notification($params) {
$datarray['sitename'] = $sitename;
$datarray['siteurl'] = $siteurl;
$datarray['type'] = $params['type'];
- $datarray['parent'] = $params['parent'];
+ $datarray['parent'] = $params['parent_mid'];
$datarray['source_name'] = $sender['xchan_name'];
$datarray['source_link'] = $sender['xchan_url'];
$datarray['source_photo'] = $sender['xchan_photo_s'];
diff --git a/install/database.sql b/install/database.sql
index f9562ae09..a5094b8e1 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -622,7 +622,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
`aid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`link` char(255) NOT NULL,
- `parent` int(11) NOT NULL,
+ `parent` char(255) NOT NULL DEFAULT '',
`seen` tinyint(1) NOT NULL DEFAULT '0',
`type` int(11) NOT NULL,
`verb` char(255) NOT NULL,
diff --git a/install/update.php b/install/update.php
index d7a87fad4..d497cda70 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1106 );
+define( 'UPDATE_VERSION' , 1107 );
/**
*
@@ -1182,3 +1182,10 @@ CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
return UPDATE_FAILED;
}
+function update_r1106() {
+ $r = q("ALTER TABLE `notify` CHANGE `parent` `parent` CHAR( 255 ) NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
diff --git a/mod/notify.php b/mod/notify.php
index 23ba098b7..6ee4260ce 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -11,7 +11,7 @@ function notify_init(&$a) {
intval(local_user())
);
if($r) {
- q("update notify set seen = 1 where ( link = '%s' or ( parent != 0 and parent = %d and otype = '%s' )) and uid = %d",
+ q("update notify set seen = 1 where ( link = '%s' or ( parent != '' and parent = '%s' and otype = '%s' )) and uid = %d",
dbesc($r[0]['link']),
intval($r[0]['parent']),
dbesc($r[0]['otype']),
diff --git a/version.inc b/version.inc
index ca09188f7..e2e021e8b 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-04-05.638
+2014-04-06.639