Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/webhooks/assets/testscript.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@

$db->insert("logs",["logtype"=>"script test","lognote"=>"Did it work?"]);
dnd($data);

//If you set $return_object as an object or string then this will be returned
//instead of {msg:"success"}
10 changes: 8 additions & 2 deletions src/webhooks/webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@
}

$action = performWebhookAction($webhook->id,$webhook->action_type,$webhook->action,$data);
$msg['msg'] = $action;
if (is_string($action)) {
$msg['msg'] = $action;
} else {
$msg=$action;
$action=json_encode($msg);
}
$fields = [
'hook'=>$webhook->id,
'ip'=>$ip,
Expand Down Expand Up @@ -175,7 +180,8 @@ function performWebhookAction($id,$action_type,$action,$data){
}elseif($action_type == "php"){
if(file_exists($abs_us_root.$us_url_root."usersc/plugins/webhooks/assets/".$action)){
require_once($abs_us_root.$us_url_root."usersc/plugins/webhooks/assets/".$action);
return "success";
if(empty($return_object)) return "success";
else return $return_object;
}else{
return "File not found";
}
Expand Down