From 8ad24ca3e8919060cf650f526ddce155f1b3bb77 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Fri, 14 Sep 2018 17:35:12 -0400 Subject: Catch errors in template rendering. Output a generic error and log problem. --- include/text.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 8a07dc113..4b5442985 100644 --- a/include/text.php +++ b/include/text.php @@ -37,7 +37,13 @@ function replace_macros($s, $r) { call_hooks('replace_macros', $arr); $t = App::template_engine(); - $output = $t->replace_macros($arr['template'], $arr['params']); + + try { + $output = $t->replace_macros($arr['template'], $arr['params']); + } catch (Exception $e) { + logger("Unable to render template: ",$e->getMessage()); + $output = "

ERROR: there was an error creating the output.

"; + } return $output; } -- cgit v1.2.3 From abe35817cd4f81c2d9c8305573c5fa5cbe154095 Mon Sep 17 00:00:00 2001 From: "M.Dent (DM42.Net)" Date: Sat, 15 Sep 2018 23:09:16 -0400 Subject: Add attach_delete hook --- include/attach.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/attach.php b/include/attach.php index 202412263..4db5bc435 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1428,6 +1428,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { if(! $r) { attach_drop_photo($channel_id,$resource); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); return; } @@ -1486,6 +1488,9 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { intval($channel_id) ); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); + file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', true); return; -- cgit v1.2.3 From a0cf2b53e03098f459edec6ac395df9750efe333 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sun, 16 Sep 2018 23:01:17 -0400 Subject: Add hook to allow addons to filter the list returned by app_list --- Zotlabs/Lib/Apps.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 6b87ac6cb..aa7e2282d 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -722,6 +722,9 @@ class Apps { ); if($r) { + $hookinfo = Array('uid'=>$uid,'deleted'=>$deleted,'cats'=>$cats,'apps'=>$r); + call_hooks('app_list',$hookinfo); + $r = $hookinfo['apps']; for($x = 0; $x < count($r); $x ++) { if(! $r[$x]['app_system']) $r[$x]['type'] = 'personal'; -- cgit v1.2.3