PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
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 1.7.4 All 35 releases
vikbooking / admin / controllers / rss.php

rss.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/controllers/rss.php

142 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 core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2019 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 JLoader::import('adapter.mvc.controllers.admin');
15
16 /**
17 * VikBooking plugin RSS controller.
18 *
19 * @since 1.3.9
20 * @see JControllerAdmin
21 */
22 class VikBookingControllerRss extends JControllerAdmin
23 {
24 /**
25 * Sets the opt-in status for the RSS service of the user.
26 *
27 * @return void
28 */
29 public function optin()
30 {
31 if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking'))
32 {
33 // not authorised to view this resource
34 throw new Exception(JText::translate('RESOURCE_AUTH_ERROR'), 403);
35 }
36
37 $input = JFactory::getApplication()->input;
38
39 // get opt-in status
40 $status = $input->getBool('status', false);
41
42 // get RSS instance
43 $rss = VikBookingBuilder::setupRssReader();
44
45 // update opt-in status
46 $rss->optIn($status);
47
48 if (wp_doing_ajax())
49 {
50 wp_die();
51 }
52
53 // back to the dashboard
54 $this->setRedirect('admin.php?page=vikbooking');
55 }
56
57 /**
58 * Dismesses the specified RSS feed.
59 *
60 * @return void
61 */
62 public function dismiss()
63 {
64 if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking'))
65 {
66 // not authorised to view this resource
67 throw new Exception(JText::translate('RESOURCE_AUTH_ERROR'), 403);
68 }
69
70 $input = JFactory::getApplication()->input;
71
72 // get ID of the feed to dismiss
73 $id = $input->getString('id', '');
74
75 if (!$id)
76 {
77 // make sure the feed ID is set
78 throw new Exception('Missing feed ID', 400);
79 }
80
81 JLoader::import('adapter.rss.feed');
82
83 // get RSS feed instance
84 $feed = new JRssFeed(array('id' => $id), 'vikbooking');
85
86 // dismiss the feed for this user
87 $feed->dismiss();
88
89 if (wp_doing_ajax())
90 {
91 wp_die();
92 }
93
94 // back to the dashboard
95 $this->setRedirect('admin.php?page=vikbooking');
96 }
97
98 /**
99 * Delays the specified RSS feed.
100 *
101 * @return void
102 */
103 public function remind()
104 {
105 if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking'))
106 {
107 // not authorised to view this resource
108 throw new Exception(JText::translate('RESOURCE_AUTH_ERROR'), 403);
109 }
110
111 $input = JFactory::getApplication()->input;
112
113 // get ID of the feed to dismiss
114 $id = $input->getString('id', '');
115
116 if (!$id)
117 {
118 // make sure the feed ID is set
119 throw new Exception('Missing feed ID', 400);
120 }
121
122 // get specified delay
123 $delay = $input->getUint('delay', 60);
124
125 JLoader::import('adapter.rss.feed');
126
127 // get RSS feed instance
128 $feed = new JRssFeed(array('id' => $id), 'vikbooking');
129
130 // delay the feed for this user
131 $feed->delay($delay);
132
133 if (wp_doing_ajax())
134 {
135 wp_die();
136 }
137
138 // back to the dashboard
139 $this->setRedirect('admin.php?page=vikbooking');
140 }
141 }
142