aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-02-20 19:50:05 -0800
committerfriendica <info@friendica.com>2012-02-20 19:50:05 -0800
commitb821399f001cd4082707ba9fb6df9c419e0b8e5e (patch)
tree1e858c850055542794c3f99d21517fdf897c5881 /include
parent6edd6d8ae1e3a6b64fa11ae6a4cc79965084b0d7 (diff)
downloadvolse-hubzilla-b821399f001cd4082707ba9fb6df9c419e0b8e5e.tar.gz
volse-hubzilla-b821399f001cd4082707ba9fb6df9c419e0b8e5e.tar.bz2
volse-hubzilla-b821399f001cd4082707ba9fb6df9c419e0b8e5e.zip
email notify now redirected through mod_notify, weirdness in local deliver caused by community page changes
Diffstat (limited to 'include')
-rwxr-xr-xinclude/enotify.php28
-rwxr-xr-xinclude/items.php12
2 files changed, 35 insertions, 5 deletions
diff --git a/include/enotify.php b/include/enotify.php
index b0967cff1..c19cc3a9c 100755
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -116,10 +116,23 @@ function notification($params) {
require_once('include/html2bbcode.php');
+ do {
+ $dups = false;
+ $hash = random_string();
+ $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
+ dbesc($hash));
+ if(count($r))
+ $dups = true;
+ } while($dups == true);
+
+
+
+
// create notification entry in DB
- $r = q("insert into notify (name,url,photo,date,msg,uid,link,type,verb,otype)
- values('%s','%s','%s','%s','%s',%d,'%s',%d,'%s','%s')",
+ $r = q("insert into notify (hash,name,url,photo,date,msg,uid,link,type,verb,otype)
+ values('%s','%s','%s','%s','%s','%s',%d,'%s',%d,'%s','%s')",
+ dbesc($hash),
dbesc($params['source_name']),
dbesc($params['source_link']),
dbesc($params['source_photo']),
@@ -132,6 +145,17 @@ function notification($params) {
dbesc($params['otype'])
);
+ $r = q("select id from notify where hash = '%s' and uid = %d limit 1",
+ dbesc($hash),
+ intval($params['uid'])
+ );
+ if($r)
+ $notify_id = $r[0]['id'];
+ else
+ return;
+
+ $itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
+
// send email notification if notification preferences permit
require_once('bbcode.php');
diff --git a/include/items.php b/include/items.php
index f87a92334..5beccfbe7 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2040,7 +2040,6 @@ function local_delivery($importer,$data) {
}
if($is_reply) {
-
$community = false;
if($importer['page-flags'] == PAGE_COMMUNITY) {
@@ -2054,7 +2053,9 @@ function local_delivery($importer,$data) {
// was the top-level post for this reply written by somebody on this site?
// Specifically, the recipient?
- $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`,
+ $is_a_remote_comment = false;
+
+ $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
@@ -2065,9 +2066,13 @@ function local_delivery($importer,$data) {
dbesc($parent_uri),
intval($importer['importer_uid'])
);
+ if($r && count($r))
+ $is_a_remote_comment = true;
- if($r && count($r)) {
+ if(($community) && (! $r[0]['forum_mode']))
+ $is_a_remote_comment = false;
+ if($is_a_remote_comment) {
logger('local_delivery: received remote comment');
$is_like = false;
// remote reply to our post. Import and then notify everybody else.
@@ -2188,6 +2193,7 @@ function local_delivery($importer,$data) {
}
}
+
return 0;
// NOTREACHED
}