PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.15
VikBooking Hotel Booking Engine & PMS v1.8.15
1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 All 36 releases
vikbooking / site / controllers / apps.php

apps.php in VikBooking Hotel Booking Engine & PMS 1.8.15, at site/controllers/apps.php

91 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage com_vikbooking
5 * @author Alessio Gaggii - E4J srl
6 * @copyright Copyright (C) 2026 E4J srl. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 * @link https://vikwp.com
9 */
10
11 // No direct access to this file
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * VikBooking Apps controller for third-party applications.
16 *
17 * @since 1.18.6 (J) - 1.8.6 (WP)
18 */
19 class VikBookingControllerApps extends JControllerAdmin
20 {
21 /**
22 * OAuth endpoint that will spawn the requested environment.
23 * To be used as OAuth redirect URL for third-party Apps.
24 */
25 public function oauth()
26 {
27 $app = JFactory::getApplication();
28
29 // access the involved environment of VikBooking to spawn
30 $environment = $app->input->getString('env');
31
32 // spawn the requested environment
33 switch ($environment) {
34 case 'dac':
35 // spawn Door Access Control framework
36 try {
37 VBODooraccessFactory::getInstance()->spawnOAuthCallback();
38 } catch (Exception $e) {
39 // send error caught to output
40 VBOHttpDocument::getInstance($app)->close($e->getCode(), $e->getMessage());
41 }
42 break;
43
44 default:
45 // spawn nothing
46 break;
47 }
48
49 // trigger event to allow third-party plugins to spawn
50 VBOFactory::getPlatform()->getDispatcher()->trigger('onAppsOauthSpawn', [$environment]);
51
52 // close the request if unhandled
53 VBOHttpDocument::getInstance($app)->close(200, 'OAuth link was reached.');
54 }
55
56 /**
57 * Webhook endpoint that will spawn the requested environment.
58 * To be used as Webhook endpoint URL for third-party Apps.
59 */
60 public function webhook()
61 {
62 $app = JFactory::getApplication();
63
64 // access the involved environment of VikBooking to spawn
65 $environment = $app->input->getString('env');
66
67 // spawn the requested environment
68 switch ($environment) {
69 case 'dac':
70 // spawn Door Access Control framework
71 try {
72 VBODooraccessFactory::getInstance()->spawnWebhookCallback();
73 } catch (Exception $e) {
74 // send error caught to output
75 VBOHttpDocument::getInstance($app)->close($e->getCode(), $e->getMessage());
76 }
77 break;
78
79 default:
80 // spawn nothing
81 break;
82 }
83
84 // trigger event to allow third-party plugins to spawn
85 VBOFactory::getPlatform()->getDispatcher()->trigger('onAppsWebhookSpawn', [$environment]);
86
87 // close the request if unhandled
88 VBOHttpDocument::getInstance($app)->close(200, 'Webhook endpoint URL was reached.');
89 }
90 }
91