PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.20
VikAppointments Services Booking Calendar v1.2.20
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / layouts / blocks / couponform.php
vikappointments / site / layouts / blocks Last commit date
calendar 1 month ago login 1 month ago payment 1 month ago alert.php 1 month ago carttotals.php 1 month ago checkout.php 1 month ago couponform.php 1 month ago index.html 1 month ago login.php 1 month ago options.php 1 month ago paymentmethods.php 1 month ago quickcontact.php 1 month ago reviews.php 1 month ago timeline.php 1 month ago waitlist.php 1 month ago
couponform.php
66 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 $controller = isset($displayData['controller']) ? $displayData['controller'] : 'confirmapp';
15 $itemid = isset($displayData['itemid']) ? $displayData['itemid'] : null;
16 $form = isset($displayData['form']) ? $displayData['form'] : null;
17
18 // build action URL
19 $url = JRoute::rewrite('index.php?option=com_vikappointments&task=' . $controller . '.redeemcoupon' . ($itemid ? '&Itemid=' . $itemid : ''));
20
21 // open form only if not specified
22 if (!$form)
23 {
24 ?>
25 <form action="<?php echo $url; ?>" name="couponform" method="post">
26 <?php
27 }
28 ?>
29
30 <div class="vapcouponcodediv">
31
32 <h3 class="vapheading3"><?php echo JText::translate('VAPENTERYOURCOUPON'); ?></h3>
33
34 <input class="vapcouponcodetext" type="text" name="couponkey" />
35
36 <button type="submit" class="vap-btn blue" onclick="return onBeforeSubmitCouponCode();"><?php echo JText::translate('VAPAPPLYCOUPON'); ?></button>
37
38 </div>
39
40 <?php
41 // close form only if not specified
42 if (!$form)
43 {
44 // use token to prevent brute force attacks
45 echo JHtml::fetch('form.token');
46 ?>
47 <input type="hidden" name="option" value="com_vikappointments" />
48 <input type="hidden" name="task" value="<?php echo $controller; ?>.redeemcoupon" />
49 </form>
50 <?php
51 }
52 ?>
53
54 <script>
55
56 function onBeforeSubmitCouponCode() {
57 <?php if ($form) { ?>
58 // manually update task
59 document.<?php echo $form; ?>.task.value = '<?php echo $controller; ?>.redeemcoupon';
60 <?php } ?>
61
62 return true;
63 }
64
65 </script>
66