You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1008 B

<?php
/**
* @package tikiwiki
*/
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once("tiki-setup.php");
if ($prefs['auth_webhooks'] !== 'y') {
http_response_code(403);
echo tr("Feature not enabled");
exit;
}
$whlib = TikiLib::lib('webhook');
$webhooks = $whlib->getWebhooks();
$webhook = null;
foreach ($webhooks as $candidate) {
if ($whlib->verify($candidate)) {
$webhook = $candidate;
break;
}
}
if (! $webhook) {
http_response_code(403);
echo tr("Webhook not authorized.");
exit;
}
$user = $webhook['user'];
$_SESSION[$user_cookie_site] = $user;
require('lib/setup/perms.php');
require('lib/setup/user_prefs.php');
TikiLib::events()->trigger('tiki.webhook.received', [
'webhook' => $webhook
]);
http_response_code(200);
echo "ok";