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/views/prices/view.html.php +18 -17 1.6.4 → 1.8.16 View file →
@@ -12,18 +12,18 @@
12 12
13 13 // import Joomla view library
14 14 jimport('joomla.application.component.view');
15 15
16 -class VikBookingViewPrices extends JViewVikBooking {
17 -
18 - function display($tpl = null) {
16 +class VikBookingViewPrices extends JViewVikBooking
17 +{
18 + public function display($tpl = null)
19 + {
19 20 // Set the toolbar
20 21 $this->addToolBar();
21 22
22 - $rows = "";
23 23 $navbut = "";
24 + $app = JFactory::getApplication();
24 25 $dbo = JFactory::getDbo();
25 - $mainframe = JFactory::getApplication();
26 26
27 27 // wizard
28 28 $wizard = VikRequest::getInt('wizard', 0, 'request');
29 29 $rplanpub1 = VikRequest::getInt('rplanpub1', 0, 'request');
@@ -30,8 +30,11 @@
30 30 $rplanpub2 = VikRequest::getInt('rplanpub2', 0, 'request');
31 31 $rplanbk1 = VikRequest::getInt('rplanbk1', 0, 'request');
32 32 $rplanbk2 = VikRequest::getInt('rplanbk2', 0, 'request');
33 33 if ($wizard) {
34 + if (!JSession::checkToken()) {
35 + throw new Exception(JText::translate('JINVALID_TOKEN'), 403);
36 + }
34 37 if ($rplanpub1) {
35 38 $q = "INSERT INTO `#__vikbooking_prices` (`name`, `idiva`, `breakfast_included`, `free_cancellation`, `minlos`) VALUES (" . $dbo->quote(JText::translate('VBOSTANDARDRATE')) . ", 0, $rplanbk1, 1, 0);";
36 39 $dbo->setQuery($q);
37 40 $dbo->execute();
@@ -40,30 +43,28 @@
40 43 $q = "INSERT INTO `#__vikbooking_prices` (`name`, `idiva`, `breakfast_included`, `free_cancellation`, `canc_deadline`, `minlos`) VALUES (" . $dbo->quote(JText::translate('VBONONREFRATE')) . ", 0, $rplanbk2, 0, 7, 0);";
41 44 $dbo->setQuery($q);
42 45 $dbo->execute();
43 46 }
44 - $mainframe->redirect('index.php?option=com_vikbooking&wizard=1');
47 + $app->redirect('index.php?option=com_vikbooking&wizard=1');
45 48 exit;
46 49 }
47 - //
48 -
49 - $lim = $mainframe->getUserStateFromRequest("com_vikbooking.limit", 'limit', $mainframe->get('list_limit'), 'int');
50 +
51 + $lim = $app->getUserStateFromRequest("com_vikbooking.limit", 'limit', $app->get('list_limit'), 'int');
50 52 $lim0 = VikRequest::getVar('limitstart', 0, '', 'int');
51 - $q = "SELECT SQL_CALC_FOUND_ROWS * FROM `#__vikbooking_prices`";
53 + $q = "SELECT SQL_CALC_FOUND_ROWS * FROM `#__vikbooking_prices` ORDER BY `derived_id` ASC, `id` ASC";
52 54 $dbo->setQuery($q, $lim0, $lim);
53 - $dbo->execute();
54 - if ($dbo->getNumRows() > 0) {
55 - $rows = $dbo->loadAssocList();
55 + $rows = $dbo->loadAssocList();
56 + if ($rows) {
56 57 $dbo->setQuery('SELECT FOUND_ROWS();');
57 58 jimport('joomla.html.pagination');
58 59 $pageNav = new JPagination( $dbo->loadResult(), $lim0, $lim );
59 60 $navbut="<table align=\"center\"><tr><td>".$pageNav->getListFooter()."</td></tr></table>";
60 61 }
61 -
62 +
62 63 $this->rows = $rows;
63 64 $this->lim0 = $lim0;
64 65 $this->navbut = $navbut;
65 -
66 +
66 67 // Display the template
67 68 parent::display($tpl);
68 69 }
69 70
@@ -69,9 +70,10 @@
69 70
70 71 /**
71 72 * Sets the toolbar
72 73 */
73 - protected function addToolBar() {
74 + protected function addToolBar()
75 + {
74 76 JToolBarHelper::title(JText::translate('VBMAINPRICETITLE'), 'vikbooking');
75 77 if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) {
76 78 JToolBarHelper::addNew('newprice', JText::translate('VBMAINPRICENEW'));
77 79 JToolBarHelper::spacer();
@@ -84,6 +86,5 @@
84 86 JToolBarHelper::deleteList(JText::translate('VBDELCONFIRM'), 'removeprice', JText::translate('VBMAINPRICEDEL'));
85 87 JToolBarHelper::spacer();
86 88 }
87 89 }
88 -
89 90 }