From b821399f001cd4082707ba9fb6df9c419e0b8e5e Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 20 Feb 2012 19:50:05 -0800 Subject: email notify now redirected through mod_notify, weirdness in local deliver caused by community page changes --- include/enotify.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'include/enotify.php') 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'); -- cgit v1.2.3