Commit d80ecf86 authored by Zot's avatar Zot

Merge branch 'master' of https://gitlab.com/macgirvin/zap

parents ea7e9549 0e7cb611
...@@ -33,7 +33,7 @@ class Cron_daily { ...@@ -33,7 +33,7 @@ class Cron_daily {
// expire any read notifications over a month old // expire any read notifications over a month old
q("delete from notify where seen = 1 and created < %s - INTERVAL %s", q("delete from notify where seen = 1 and created < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('30 DAY') db_utcnow(), db_quoteinterval('60 DAY')
); );
// expire any unread notifications over a year old // expire any unread notifications over a year old
......
...@@ -538,6 +538,19 @@ class Enotify { ...@@ -538,6 +538,19 @@ class Enotify {
} }
$e = q("select * from notify where otype = '%s' and xname = '%s' and verb = '%s' and link = '%s' and ntype = %d limit 1",
dbesc($datarray['otype']),
dbesc($datarray['xname']),
dbesc($datarray['verb']),
dbesc($datarray['link']),
intval($datarray['ntype'])
);
if($e) {
logger('duplicated notification');
pop_lang();
return;
}
$r = q("insert into notify (hash,xname,url,photo,created,msg,aid,uid,link,parent,seen,ntype,verb,otype) $r = q("insert into notify (hash,xname,url,photo,created,msg,aid,uid,link,parent,seen,ntype,verb,otype)
values('%s','%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')", values('%s','%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')",
dbesc($datarray['hash']), dbesc($datarray['hash']),
......
...@@ -1643,7 +1643,7 @@ class Libzot { ...@@ -1643,7 +1643,7 @@ class Libzot {
if($arr['mid'] !== $arr['parent_mid']) { if($arr['mid'] !== $arr['parent_mid']) {
if(perm_is_allowed($channel['channel_id'],$sender,'moderated')) { if(perm_is_allowed($channel['channel_id'],$sender,'moderated') && $relay) {
$arr['item_blocked'] = ITEM_MODERATED; $arr['item_blocked'] = ITEM_MODERATED;
} }
......
...@@ -650,6 +650,13 @@ function get_item_elements($x,$allow_code = false) { ...@@ -650,6 +650,13 @@ function get_item_elements($x,$allow_code = false) {
$arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : '');
$arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : '');
// convert AS1 namespaced elements to AS-JSONLD
$arr['verb'] = Activity::activity_mapper($arr['verb']);
$arr['obj_type'] = Activity::activity_obj_mapper($arr['obj_type']);
$arr['tgt_type'] = Activity::activity_obj_mapper($arr['tgt_type']);
$arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts'); $arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts');
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : ''); $arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
...@@ -661,10 +668,18 @@ function get_item_elements($x,$allow_code = false) { ...@@ -661,10 +668,18 @@ function get_item_elements($x,$allow_code = false) {
$arr['sig'] = 'sha256.' . $arr['sig']; $arr['sig'] = 'sha256.' . $arr['sig'];
} }
$arr['obj'] = activity_sanitise($x['object']); $arr['obj'] = activity_sanitise($x['object']);
if($arr['obj'] && is_array($arr['obj']) && array_key_exists('asld',$arr['obj'])) {
$arr['obj'] = $arr['obj']['asld'];
}
$arr['target'] = activity_sanitise($x['target']); $arr['target'] = activity_sanitise($x['target']);
if($arr['target'] && is_array($arr['target']) && array_key_exists('asld',$arr['target'])) {
$arr['target'] = $arr['target']['asld'];
}
$arr['attach'] = activity_sanitise($x['attach']); $arr['attach'] = activity_sanitise($x['attach']);
$arr['term'] = decode_tags($x['tags']); $arr['term'] = decode_tags($x['tags']);
$arr['iconfig'] = decode_item_meta($x['meta']); $arr['iconfig'] = decode_item_meta($x['meta']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment