| @@ -1,0 +1,89 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikBooking | |
| 4 | + * @subpackage com_vikbooking | |
| 5 | + * @author Alessio Gaggii - e4j - Extensionsforjoomla.com | |
| 6 | + * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. | |
| 7 | + * @license GNU General Public License version 2 or later; see LICENSE | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 12 | + | |
| 13 | +// import Joomla view library | |
| 14 | +jimport('joomla.application.component.view'); | |
| 15 | + | |
| 16 | +class VikBookingViewConfig extends JViewVikBooking | |
| 17 | +{ | |
| 18 | + public function display($tpl = null) | |
| 19 | + { | |
| 20 | + // Set the toolbar | |
| 21 | + $this->addToolBar(); | |
| 22 | + | |
| 23 | + if (!JFactory::getUser()->authorise('core.vbo.global', 'com_vikbooking')) { | |
| 24 | + VBOHttpDocument::getInstance()->close(403, JText::translate('JERROR_ALERTNOAUTHOR')); | |
| 25 | + } | |
| 26 | + | |
| 27 | + if (VBOPlatformDetection::isWordPress()) { | |
| 28 | + /** | |
| 29 | + * @wponly - trigger back up of extendable files | |
| 30 | + */ | |
| 31 | + VikBookingLoader::import('update.manager'); | |
| 32 | + VikBookingUpdateManager::triggerExtendableClassesBackup('smsapi'); | |
| 33 | + } | |
| 34 | + | |
| 35 | + $dbo = JFactory::getDbo(); | |
| 36 | + $preset_tags = VikRequest::getInt('reset_tags', '', 'request'); | |
| 37 | + if ($preset_tags > 0) { | |
| 38 | + $q = "UPDATE `#__vikbooking_orders` SET `colortag`=NULL;"; | |
| 39 | + $dbo->setQuery($q); | |
| 40 | + $dbo->execute(); | |
| 41 | + $q = "UPDATE `#__vikbooking_config` SET `setting`='' WHERE `param`='bookingsctags';"; | |
| 42 | + $dbo->setQuery($q); | |
| 43 | + $dbo->execute(); | |
| 44 | + $mainframe = JFactory::getApplication(); | |
| 45 | + $mainframe->redirect("index.php?option=com_vikbooking&task=config"); | |
| 46 | + exit; | |
| 47 | + } | |
| 48 | + | |
| 49 | + $cookie = JFactory::getApplication()->input->cookie; | |
| 50 | + $curtabid = $cookie->get('vbConfPt', '', 'string'); | |
| 51 | + $curtabid = empty($curtabid) ? 1 : (int)$curtabid; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Pre-select one specific tab via query string. | |
| 55 | + * | |
| 56 | + * @since 1.14 (J) - 1.4.0 (WP) | |
| 57 | + */ | |
| 58 | + $tab = VikRequest::getInt('tab', 0, 'request'); | |
| 59 | + if (!empty($tab)) { | |
| 60 | + $curtabid = $tab; | |
| 61 | + } | |
| 62 | + | |
| 63 | + $this->curtabid = $curtabid; | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * Fetch all the supported backup export types. | |
| 67 | + * | |
| 68 | + * @since 1.15 (J) - 1.5 (WP) | |
| 69 | + */ | |
| 70 | + $this->backupExportTypes = VBOBackupManager::getExportTypes(); | |
| 71 | + | |
| 72 | + // Display the template | |
| 73 | + parent::display($tpl); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Sets the toolbar | |
| 78 | + */ | |
| 79 | + protected function addToolBar() | |
| 80 | + { | |
| 81 | + JToolBarHelper::title(JText::translate('VBMAINCONFIGTITLE'), 'vikbookingconfig'); | |
| 82 | + if (JFactory::getUser()->authorise('core.edit', 'com_vikbooking')) { | |
| 83 | + JToolBarHelper::apply( 'saveconfig', JText::translate('VBSAVE')); | |
| 84 | + JToolBarHelper::spacer(); | |
| 85 | + } | |
| 86 | + JToolBarHelper::cancel( 'cancel', JText::translate('VBANNULLA')); | |
| 87 | + JToolBarHelper::spacer(); | |
| 88 | + } | |
| 89 | +} | |