/** * Equivalent to Joomla's josSpoofValue function * * @param boolean $alt * @return string Validation Hash */ function vmSpoofValue($alt = NULL) { global $auth, $mainframe, $_VERSION; if ($alt) { if ($alt == 1) { $random = date('Ymd'); } else { $random = $alt . date('Ymd'); } } else { $random = date('dmY'); } $validate = vmCreateHash($mainframe->getCfg('db') . $random . $auth['user_id']); if ($_VERSION->DEV_LEVEL >= 11) { // Joomla 1.0.11 compatibility workaround // the prefix ensures that the hash is non-numeric // otherwise it will be intercepted by globals.php $validate = 'j' . $validate; } return $validate; }
function showRecommendForm($product_id) { global $VM_LANG, $vendor_store_name, $sess, $my; $sender_name = shopMakeHtmlSafe(vmGet($_REQUEST, 'sender_name', null)); $sender_mail = shopMakeHtmlSafe(vmGet($_REQUEST, 'sender_mail', null)); $recipient_mail = shopMakeHtmlSafe(vmGet($_REQUEST, 'recipient_mail', null)); $message = shopMakeHtmlSafe(vmGet($_REQUEST, 'recommend_message')); echo ' <form action="index2.php" method="post"> <table border="0" cellspacing="2" cellpadding="1" width="80%"> <tr> <td>' . $VM_LANG->_('EMAIL_FRIEND_ADDR') . '</td> <td><input type="text" name="recipient_mail" size="50" value="' . (!empty($recipient_mail) ? $recipient_mail : '') . '" /></td> </tr> <tr> <td>' . $VM_LANG->_('EMAIL_YOUR_NAME') . '</td> <td><input type="text" name="sender_name" size="50" value="' . (!empty($sender_name) ? $sender_name : $my->name) . '" /></td> </tr> <tr> <td>' . $VM_LANG->_('EMAIL_YOUR_MAIL') . '</td> <td><input type="text" name="sender_mail" size="50" value="' . (!empty($sender_mail) ? $sender_mail : $my->email) . '" /></td> </tr> <tr> <td colspan="2">' . $VM_LANG->_('VM_RECOMMEND_FORM_MESSAGE') . '</td> </tr> <tr> <td colspan="2"> <textarea name="recommend_message" style="width: 100%; height: 200px">'; if (!empty($message)) { echo stripslashes(str_replace(array('\\r', '\\n'), array("\r", "\n"), $message)); } else { $msg = sprintf($VM_LANG->_('VM_RECOMMEND_MESSAGE', false), $vendor_store_name, $sess->url(URL . 'index.php?page=shop.product_details&product_id=' . $product_id, true)); echo shopMakeHtmlSafe(stripslashes(str_replace('index2.php', 'index.php', $msg))); } echo '</textarea> </td> </tr> </table> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="page" value="shop.recommend" /> <input type="hidden" name="product_id" value="' . $product_id . '" /> <input type="hidden" name="' . vmCreateHash() . '" value="1" /> <input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" /> <input type="hidden" name="func" value="recommendProduct" /> <input class="button" type="submit" name="submit" value="' . $VM_LANG->_('PHPSHOP_SUBMIT') . '" /> <input class="button" type="button" onclick="window.close();" value="' . $VM_LANG->_('CMN_CANCEL') . '" /> </form> '; }
/** * This function returns a base64_encoded string: * VMsessionId|JsessionID * */ function getMartId() { global $vmuser, $mosConfig_secret; // Get the Joomla! / Mambo session ID $sessionId = ps_session::getSessionId(); $userNameSeed = ''; if ($vmuser->id) { $userNameSeed = '|' . md5($vmuser->username . $vmuser->password . $mosConfig_secret); if (is_callable(array('mosMainFrame', 'remCookieName_User'))) { if (!empty($GLOBALS['real_mosConfig_live_site']) && empty($_REQUEST['real_mosConfig_live_site'])) { $GLOBALS['mosConfig_live_site'] = $GLOBALS['real_mosConfig_live_site']; } $userNameSeed .= '|' . vmGet($_COOKIE, mosMainFrame::remCookieName_User(), ''); } } $martID = base64_encode(vmCreateHash($_COOKIE[$this->_session_name] . $sessionId) . $userNameSeed); return $martID; }