PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 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 All 37 releases
← All changes | admin/controllers/acl.php +103 -0 1.6.3 → 1.8.16 View file →
@@ -1,0 +1,103 @@
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 ACL controller.
18 + *
19 + * @since 1.0
20 + * @see JControllerAdmin
21 + */
22 +class VikBookingControllerAcl extends JControllerAdmin
23 +{
24 + public function saveclose()
25 + {
26 + $this->save(1);
27 + }
28 +
29 + public function save($close = 0)
30 + {
31 + $app = JFactory::getApplication();
32 + $input = $app->input;
33 + $dbo = JFactory::getDbo();
34 +
35 + // get return URL
36 + $encoded = $input->getBase64('return', '');
37 + $active = $input->get('activerole', '');
38 +
39 + if ($encoded)
40 + {
41 + $return = base64_decode($encoded);
42 + }
43 + else
44 + {
45 + $return = '';
46 + }
47 +
48 + /**
49 + * Added token validation.
50 + *
51 + * @since 1.7.3
52 + */
53 + if (!JSession::checkToken())
54 + {
55 + // back to main list, missing CSRF-proof token
56 + $app->enqueueMessage(JText::translate('JINVALID_TOKEN'), 'error');
57 + $this->cancel();
58 +
59 + return false;
60 + }
61 +
62 + // make sure the user is authorised to change ACL
63 + if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking'))
64 + {
65 + $app->enqueueMessage(JText::translate('JERROR_ALERTNOAUTHOR'), 'error');
66 + $this->cancel();
67 +
68 + return false;
69 + }
70 +
71 + $data = $input->get('acl', array(), 'array');
72 +
73 + if ($this->model->save($data))
74 + {
75 + $app->enqueueMessage(JText::translate('ACL_SAVE_SUCCESS'));
76 + }
77 + else
78 + {
79 + $app->enqueueMessage(JText::translate('ACL_SAVE_ERROR'), 'error');
80 + }
81 +
82 + if (!$close)
83 + {
84 + $return = 'admin.php?option=com_vikbooking&view=acl&activerole=' . $active . '&return=' . $encoded;
85 + }
86 +
87 + $this->setRedirect($return);
88 + }
89 +
90 + public function cancel()
91 + {
92 + $app = JFactory::getApplication();
93 +
94 + $return = $app->input->getBase64('return', '');
95 +
96 + if ($return)
97 + {
98 + $return = base64_decode($return);
99 + }
100 +
101 + $this->setRedirect($return);
102 + }
103 +}