| 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 |
$prices = $this->prices; |
| 14 |
$rooms = $this->rooms; |
| 15 |
$days = $this->days; |
| 16 |
$checkin = $this->checkin; |
| 17 |
$checkout = $this->checkout; |
| 18 |
$selopt = $this->selopt; |
| 19 |
$roomsnum = $this->roomsnum; |
| 20 |
$adults = $this->adults; |
| 21 |
$children = $this->children; |
| 22 |
$arrpeople = $this->arrpeople; |
| 23 |
$ppkg_id = VikRequest::getInt('pkg_id', '', 'request'); |
| 24 |
|
| 25 |
$strpriceid = ""; |
| 26 |
foreach ($prices as $num => $pid) { |
| 27 |
$strpriceid .= "&priceid".$num."=".$pid; |
| 28 |
} |
| 29 |
$stroptid = ""; |
| 30 |
for ($ir = 1; $ir <= $roomsnum; $ir++) { |
| 31 |
if (isset($selopt[$ir]) && is_array($selopt[$ir])) { |
| 32 |
foreach ($selopt[$ir] as $opt) { |
| 33 |
$stroptid .= "&optid".$ir.$opt['id']."=".$opt['quan']; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
$strroomid = ""; |
| 38 |
foreach ($rooms as $num => $r) { |
| 39 |
$strroomid .= "&roomid[]=".$r['id']; |
| 40 |
} |
| 41 |
$straduchild = ""; |
| 42 |
foreach ($arrpeople as $indroom => $aduch) { |
| 43 |
$straduchild .= "&adults[]=".$aduch['adults']; |
| 44 |
$straduchild .= "&children[]=".$aduch['children']; |
| 45 |
} |
| 46 |
|
| 47 |
$action = 'index.php?option=com_user&task=login'; |
| 48 |
|
| 49 |
$pitemid = VikRequest::getString('Itemid', '', 'request'); |
| 50 |
|
| 51 |
if (count($rooms) > 0 && !empty($checkin) && !empty($checkout)) { |
| 52 |
$goto = "index.php?option=com_vikbooking&task=oconfirm".$strpriceid.$stroptid.$strroomid.$straduchild."&roomsnum=".$roomsnum."&days=".$days."&checkin=".$checkin."&checkout=".$checkout.($ppkg_id > 0 ? '&pkg_id='.$ppkg_id : '').(!empty($pitemid) ? "&Itemid=".$pitemid : ""); |
| 53 |
$goto = JRoute::rewrite($goto, false); |
| 54 |
} else { |
| 55 |
// The Joomla! home page |
| 56 |
$menu = JSite::getMenu(); |
| 57 |
$default = $menu->getDefault(); |
| 58 |
$uri = JFactory::getURI($default->link . '&Itemid=' . $default->id); |
| 59 |
$goto = $uri->toString(array ( |
| 60 |
'path', |
| 61 |
'query', |
| 62 |
'fragment' |
| 63 |
)); |
| 64 |
} |
| 65 |
$return_url = base64_encode($goto); |
| 66 |
|
| 67 |
?> |
| 68 |
|
| 69 |
<script language="JavaScript" type="text/javascript"> |
| 70 |
function checkVrcReg() { |
| 71 |
var vbvar = document.vbreg; |
| 72 |
if (!vbvar.name.value.match(/\S/)) { |
| 73 |
document.getElementById('vbfname').style.color='#ff0000'; |
| 74 |
return false; |
| 75 |
} else { |
| 76 |
document.getElementById('vbfname').style.color=''; |
| 77 |
} |
| 78 |
if (!vbvar.lname.value.match(/\S/)) { |
| 79 |
document.getElementById('vbflname').style.color='#ff0000'; |
| 80 |
return false; |
| 81 |
} else { |
| 82 |
document.getElementById('vbflname').style.color=''; |
| 83 |
} |
| 84 |
if (!vbvar.email.value.match(/\S/)) { |
| 85 |
document.getElementById('vbfemail').style.color='#ff0000'; |
| 86 |
return false; |
| 87 |
} else { |
| 88 |
document.getElementById('vbfemail').style.color=''; |
| 89 |
} |
| 90 |
if (!vbvar.username.value.match(/\S/)) { |
| 91 |
document.getElementById('vbfusername').style.color='#ff0000'; |
| 92 |
return false; |
| 93 |
} else { |
| 94 |
document.getElementById('vbfusername').style.color=''; |
| 95 |
} |
| 96 |
if (!vbvar.password.value.match(/\S/)) { |
| 97 |
document.getElementById('vbfpassword').style.color='#ff0000'; |
| 98 |
return false; |
| 99 |
} else { |
| 100 |
document.getElementById('vbfpassword').style.color=''; |
| 101 |
} |
| 102 |
if (!vbvar.confpassword.value.match(/\S/)) { |
| 103 |
document.getElementById('vbfconfpassword').style.color='#ff0000'; |
| 104 |
return false; |
| 105 |
} else { |
| 106 |
document.getElementById('vbfconfpassword').style.color=''; |
| 107 |
} |
| 108 |
return true; |
| 109 |
} |
| 110 |
</script> |
| 111 |
|
| 112 |
<div class="loginregistercont"> |
| 113 |
|
| 114 |
<div class="loginregister-block registerblock"> |
| 115 |
<form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>" method="post" name="vbreg" onsubmit="return checkVrcReg();"> |
| 116 |
<h3><?php echo JText::translate('VBREGSIGNUP'); ?></h3> |
| 117 |
<div class="loginregister-inner-block"> |
| 118 |
<div class="loginregister-row"> |
| 119 |
<div class="loginregister-lbl"><span id="vbfname"><?php echo JText::translate('VBREGNAME'); ?></span></div> |
| 120 |
<div class="loginregister-val"><input type="text" name="fname" value="" size="20" class="vbinput"/></div> |
| 121 |
</div> |
| 122 |
<div class="loginregister-row"> |
| 123 |
<div class="loginregister-lbl"><span id="vbflname"><?php echo JText::translate('VBREGLNAME'); ?></span></div> |
| 124 |
<div class="loginregister-val"><input type="text" name="lname" value="" size="20" class="vbinput"/></div> |
| 125 |
</div> |
| 126 |
<div class="loginregister-row"> |
| 127 |
<div class="loginregister-lbl"><span id="vbfemail"><?php echo JText::translate('VBREGEMAIL'); ?></span></div> |
| 128 |
<div class="loginregister-val"><input type="text" name="email" value="" size="20" class="vbinput"/></div> |
| 129 |
</div> |
| 130 |
<div class="loginregister-row"> |
| 131 |
<div class="loginregister-lbl"><span id="vbfusername"><?php echo JText::translate('VBREGUNAME'); ?></span></div> |
| 132 |
<div class="loginregister-val"><input type="text" name="username" value="" size="20" class="vbinput"/></div> |
| 133 |
</div> |
| 134 |
<div class="loginregister-row"> |
| 135 |
<div class="loginregister-lbl"><span id="vbfpassword"><?php echo JText::translate('VBREGPWD'); ?></span></div> |
| 136 |
<div class="loginregister-val"><input type="password" name="password" value="" size="20" class="vbinput"/></div> |
| 137 |
</div> |
| 138 |
<div class="loginregister-row"> |
| 139 |
<div class="loginregister-lbl"><span id="vbfconfpassword"><?php echo JText::translate('VBREGCONFIRMPWD'); ?></span></div> |
| 140 |
<div class="loginregister-val"><input type="password" name="confpassword" value="" size="20" class="vbinput"/></div> |
| 141 |
</div> |
| 142 |
<div class="loginregister-row loginregister-submit"> |
| 143 |
<input type="submit" value="<?php echo JText::translate('VBREGSIGNUPBTN'); ?>" class="btn booknow vbo-pref-color-btn" name="submit" /> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
<?php |
| 147 |
foreach ($prices as $num => $pid) { |
| 148 |
?> |
| 149 |
<input type="hidden" name="priceid<?php echo $num; ?>" value="<?php echo $pid; ?>" /> |
| 150 |
<?php |
| 151 |
} |
| 152 |
for ($ir = 1; $ir <= $roomsnum; $ir++) { |
| 153 |
if (isset($selopt[$ir]) && is_array($selopt[$ir])) { |
| 154 |
foreach ($selopt[$ir] as $opt) { |
| 155 |
?> |
| 156 |
<input type="hidden" name="optid<?php echo $ir.$opt['id']; ?>" value="<?php echo $opt['quan']; ?>" /> |
| 157 |
<?php |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
foreach ($rooms as $num => $r) { |
| 162 |
?> |
| 163 |
<input type="hidden" name="roomid[]" value="<?php echo $r['id']; ?>" /> |
| 164 |
<?php |
| 165 |
} |
| 166 |
foreach ($arrpeople as $indroom => $aduch) { |
| 167 |
?> |
| 168 |
<input type="hidden" name="adults[]" value="<?php echo $aduch['adults']; ?>" /> |
| 169 |
<input type="hidden" name="children[]" value="<?php echo $aduch['children']; ?>" /> |
| 170 |
<?php |
| 171 |
} |
| 172 |
for ($ir = 1; $ir <= $roomsnum; $ir++) { |
| 173 |
if (isset($selopt[$ir]) && is_array($selopt[$ir])) { |
| 174 |
foreach ($selopt[$ir] as $opt) { |
| 175 |
?> |
| 176 |
<input type="hidden" name="optid<?php echo $ir.$opt['id']; ?>" value="<?php echo $opt['quan']; ?>" /> |
| 177 |
<?php |
| 178 |
} |
| 179 |
} |
| 180 |
} |
| 181 |
?> |
| 182 |
<input type="hidden" name="roomsnum" value="<?php echo $roomsnum; ?>" /> |
| 183 |
<input type="hidden" name="days" value="<?php echo $days; ?>" /> |
| 184 |
<input type="hidden" name="checkin" value="<?php echo $checkin; ?>" /> |
| 185 |
<input type="hidden" name="checkout" value="<?php echo $checkout; ?>" /> |
| 186 |
<input type="hidden" name="Itemid" value="<?php echo $pitemid; ?>" /> |
| 187 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 188 |
<input type="hidden" name="task" value="register" /> |
| 189 |
</form> |
| 190 |
</div> |
| 191 |
<?php |
| 192 |
|
| 193 |
/** |
| 194 |
* @wponly use WP login form (change login and password names: "log" and "pwd") |
| 195 |
*/ |
| 196 |
$url = wp_login_url(base64_decode($return_url)); |
| 197 |
$url .= (strpos($url, '?') !== false ? '&' : '?') . 'action=login'; |
| 198 |
|
| 199 |
?> |
| 200 |
|
| 201 |
<div class="loginregister-block loginblock"> |
| 202 |
<form action="<?php echo $url; ?>" method="post"> |
| 203 |
<h3><?php echo JText::translate('VBREGSIGNIN'); ?></h3> |
| 204 |
<div class="loginregister-inner-block"> |
| 205 |
<div class="loginregister-row"> |
| 206 |
<div class="loginregister-lbl"><?php echo JText::translate('VBREGUNAME'); ?></div> |
| 207 |
<div class="loginregister-val"><input type="text" name="log" value="" size="20" class="vbinput"/></div> |
| 208 |
</div> |
| 209 |
<div class="loginregister-row"> |
| 210 |
<div class="loginregister-lbl"><?php echo JText::translate('VBREGPWD'); ?></div> |
| 211 |
<div class="loginregister-val"><input type="password" name="pwd" value="" size="20" class="vbinput"/></div> |
| 212 |
</div> |
| 213 |
<div class="loginregister-row loginregister-submit"> |
| 214 |
<input type="submit" value="<?php echo JText::translate('VBREGSIGNINBTN'); ?>" class="btn booknow vbo-pref-color-btn" name="Login" /> |
| 215 |
</div> |
| 216 |
</div> |
| 217 |
<input type="hidden" name="remember" id="remember" value="yes" /> |
| 218 |
<?php echo JHtml::fetch('form.token'); ?> |
| 219 |
</form> |
| 220 |
</div> |
| 221 |
|
| 222 |
</div> |
| 223 |
|