| 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 Shortcodes controller. |
| 18 |
* |
| 19 |
* @since 1.0 |
| 20 |
* @see JControllerAdmin |
| 21 |
*/ |
| 22 |
class VikBookingControllerShortcodes extends JControllerAdmin |
| 23 |
{ |
| 24 |
public function create() |
| 25 |
{ |
| 26 |
if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking')) |
| 27 |
{ |
| 28 |
wp_die( |
| 29 |
'<h1>' . JText::translate('FATAL_ERROR') . '</h1>' . |
| 30 |
'<p>' . JText::translate('RESOURCE_AUTH_ERROR') . '</p>', |
| 31 |
403 |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
$input = JFactory::getApplication()->input; |
| 36 |
|
| 37 |
$input->set('type', 'new'); |
| 38 |
$input->set('view', 'shortcode'); |
| 39 |
|
| 40 |
parent::display(); |
| 41 |
} |
| 42 |
|
| 43 |
public function edit() |
| 44 |
{ |
| 45 |
if (!JFactory::getUser()->authorise('core.admin', 'com_vikbooking')) |
| 46 |
{ |
| 47 |
wp_die( |
| 48 |
'<h1>' . JText::translate('FATAL_ERROR') . '</h1>' . |
| 49 |
'<p>' . JText::translate('RESOURCE_AUTH_ERROR') . '</p>', |
| 50 |
403 |
| 51 |
); |
| 52 |
} |
| 53 |
|
| 54 |
$input = JFactory::getApplication()->input; |
| 55 |
|
| 56 |
$input->set('type', 'edit'); |
| 57 |
$input->set('view', 'shortcode'); |
| 58 |
|
| 59 |
parent::display(); |
| 60 |
} |
| 61 |
|
| 62 |
public function delete() |
| 63 |
{ |
| 64 |
$app = JFactory::getApplication(); |
| 65 |
$input = $app->input; |
| 66 |
|
| 67 |
$cid = $input->getUint('cid', array()); |
| 68 |
$encoded = $input->getBase64('return', ''); |
| 69 |
|
| 70 |
$this->model->delete($cid); |
| 71 |
|
| 72 |
$app->redirect('admin.php?option=com_vikbooking&view=shortcodes&return=' . $encoded); |
| 73 |
} |
| 74 |
|
| 75 |
public function cancel() |
| 76 |
{ |
| 77 |
$app = JFactory::getApplication(); |
| 78 |
|
| 79 |
$encoded = $app->input->getBase64('return', ''); |
| 80 |
|
| 81 |
$app->redirect('admin.php?option=com_vikbooking&view=shortcodes&return=' . $encoded); |
| 82 |
} |
| 83 |
|
| 84 |
public function back() |
| 85 |
{ |
| 86 |
$app = JFactory::getApplication(); |
| 87 |
|
| 88 |
$return = $app->input->getBase64('return', ''); |
| 89 |
|
| 90 |
if ($return) |
| 91 |
{ |
| 92 |
$return = base64_decode($return); |
| 93 |
} |
| 94 |
else |
| 95 |
{ |
| 96 |
$return = 'admin.php?option=com_vikbooking'; |
| 97 |
} |
| 98 |
|
| 99 |
$app->redirect($return); |
| 100 |
} |
| 101 |
} |
| 102 |
|