PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / libraries / mvc / admin / controllers / acl.php
vikappointments / libraries / mvc / admin / controllers Last commit date
acl.php 2 days ago feedback.php 2 days ago license.php 2 days ago override.php 2 days ago rss.php 2 days ago shortcode.php 2 days ago shortcodes.php 2 days ago
acl.php
99 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 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 VAPLoader::import('libraries.mvc.controllers.admin');
15
16 /**
17 * VikAppointments plugin ACL controller.
18 *
19 * @since 1.0
20 */
21 class VikAppointmentsControllerAcl extends VAPControllerAdmin
22 {
23 /**
24 * Save and close task.
25 *
26 * @return void
27 */
28 public function saveclose()
29 {
30 if ($this->save())
31 {
32 $this->cancel();
33 }
34 }
35
36 /**
37 * Save (and stay) task.
38 *
39 * @return boolean
40 */
41 public function save($close = 0)
42 {
43 $app = JFactory::getApplication();
44 $input = $app->input;
45
46 /**
47 * Added token validation.
48 *
49 * @since 1.2.18
50 */
51 if (!JSession::checkToken())
52 {
53 // back to main list, missing CSRF-proof token
54 $app->enqueueMessage(JText::translate('JINVALID_TOKEN'), 'error');
55 $this->cancel();
56 return false;
57 }
58
59 // make sure the user is authorised to change ACL
60 if (!JFactory::getUser()->authorise('core.admin', 'com_vikappointments'))
61 {
62 // back to main list, not authorised to create/edit records
63 $app->enqueueMessage(JText::translate('JERROR_ALERTNOAUTHOR'), 'error');
64 $this->cancel();
65 return false;
66 }
67
68 $data = $input->get('acl', array(), 'array');
69
70 if ($this->model->save($data))
71 {
72 $app->enqueueMessage(JText::translate('ACL_SAVE_SUCCESS'));
73 }
74 else
75 {
76 $app->enqueueMessage(JText::translate('ACL_SAVE_ERROR'), 'error');
77 }
78
79 $this->setRedirect('admin.php?page=vikappointments&view=acl&activerole=' . $active . '&return=' . $input->getBase64('return', ''));
80 }
81
82 /**
83 * Shortcodes back to list task.
84 *
85 * @return void
86 */
87 public function cancel()
88 {
89 $return = JFactory::getApplication()->input->getBase64('return', '');
90
91 if ($return)
92 {
93 $return = base64_decode($return);
94 }
95
96 $this->setRedirect($return);
97 }
98 }
99