本文整理汇总了PHP中vmRedirect函数的典型用法代码示例。如果您正苦于以下问题:PHP vmRedirect函数的具体用法?PHP vmRedirect怎么用?PHP vmRedirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmRedirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: send_file
/**
* Sends the requested file to the browser
* and assures that the requested file is no payable product download file
* @author soeren
* @param int $file_id
* @param int $product_id
* @return mixed
*/
function send_file($file_id, $product_id)
{
global $VM_LANG, $vmLogger, $mosConfig_absolute_path;
$dbf = new ps_DB();
$html = "";
$sql = 'SELECT attribute_value FROM #__{vm}_product_attribute WHERE `product_id` = ' . intval($product_id) . ' AND attribute_name=\'download\'';
$dbf->query($sql);
$dbf->next_record();
$exclude_filename = $GLOBALS['vmInputFilter']->safeSQL($dbf->f("attribute_value"));
$sql = 'SELECT file_mimetype, file_name' . ' FROM `#__{vm}_product_files` WHERE ';
if ($exclude_filename) {
$sql .= ' file_title != \'' . $exclude_filename . '\' AND ';
}
$sql .= ' file_product_id = \'' . $product_id . '\' AND file_published = \'1\' AND file_id = \'' . $file_id . '\' AND file_is_image = \'0\'';
$dbf->setQuery($sql);
$dbf->query();
if (!$dbf->next_record()) {
$vmLogger->err($VM_LANG->_('PHPSHOP_FILES_NOT_FOUND', false));
return false;
}
$filename = $mosConfig_absolute_path . str_replace($mosConfig_absolute_path, '', $dbf->f("file_name"));
// dump anything in the buffer
while (@ob_end_clean()) {
}
if (strtolower(substr($filename, 0, 4)) == 'http') {
vmRedirect($filename);
}
if ($filename) {
require_once CLASSPATH . 'connectionTools.class.php';
vmConnector::sendFile($filename, $dbf->f("file_mimetype"));
$GLOBALS['vm_mainframe']->close(true);
} else {
$vmLogger->err($VM_LANG->_('PHPSHOP_FILES_NOT_FOUND', false));
}
return true;
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:44,代码来源:ps_product_files.php
示例2: ps_product
require_once CLASSPATH . 'ps_order_change.php';
require_once CLASSPATH . 'ps_order_change_html.php';
$ps_product = new ps_product();
$order_id = vmRequest::getInt('order_id');
$ps_order_change_html = new ps_order_change_html($order_id);
//Added Option to resend the Confirmation Mail
$resend_action = vmRequest::getVar('func');
if ($resend_action == 'resendconfirm' && $order_id) {
ps_checkout::email_receipt($order_id);
$redirurl = $_SERVER['PHP_SELF'];
foreach ($_POST as $key => $value) {
if ($value != 'resendconfirm') {
$redirurl .= !strpos($redirurl, '?') ? '?' : '&' . $key . '=' . vmRequest::getVar($key);
}
}
vmRedirect($redirurl, $VM_LANG->_('PHPSHOP_ORDER_RESEND_CONFIRMATION_MAIL_SUCCESS'));
}
if (!is_numeric($order_id)) {
echo "<h2>The Order ID {$order_id} is not valid.</h2>";
} else {
$dbc = new ps_DB();
$q = "SELECT * FROM #__{vm}_orders WHERE order_id='{$order_id}'";
$db->query($q);
if ($db->next_record()) {
// Print View Icon
$print_url = $_SERVER['PHP_SELF'] . "?page=order.order_printdetails&order_id={$order_id}&no_menu=1&pop=1";
if (vmIsJoomla('1.5', '>=')) {
$print_url .= "&tmpl=component";
}
$print_url = $sess->url($print_url);
$print_url = defined('_VM_IS_BACKEND') ? str_replace("index2.php", "index3.php", $print_url) : str_replace("index.php", "index2.php", $print_url);
开发者ID:rafarubert,项目名称:megafiltros,代码行数:31,代码来源:order.order_print.php
示例3: list_payment_methods
/**
* Lists the payment methods of all available payment modules
* @static
* @param int $payment_method_id
*/
function list_payment_methods($payment_method_id = 0)
{
global $order_total, $sess, $VM_CHECKOUT_MODULES;
$ps_vendor_id = $_SESSION['ps_vendor_id'];
$auth = $_SESSION['auth'];
$ship_to_info_id = vmGet($_REQUEST, 'ship_to_info_id');
$shipping_rate_id = vmGet($_REQUEST, 'shipping_rate_id');
require_once CLASSPATH . 'ps_payment_method.php';
$ps_payment_method = new ps_payment_method();
require_once CLASSPATH . 'ps_creditcard.php';
$ps_creditcard = new ps_creditcard();
$count = 0;
// Do we have Credit Card Payments?
$db_cc = new ps_DB();
$q = "SELECT * from #__{vm}_payment_method,#__{vm}_shopper_group WHERE ";
$q .= "#__{vm}_payment_method.shopper_group_id=#__{vm}_shopper_group.shopper_group_id ";
$q .= "AND (#__{vm}_payment_method.shopper_group_id='" . $auth['shopper_group_id'] . "' ";
$q .= "OR #__{vm}_shopper_group.default='1') ";
$q .= "AND (enable_processor='' OR enable_processor='Y') ";
$q .= "AND payment_enabled='Y' ";
$q .= "AND #__{vm}_payment_method.vendor_id='{$ps_vendor_id}' ";
$q .= " ORDER BY list_order";
$db_cc->query($q);
if ($db_cc->num_rows()) {
$first_payment_method_id = $db_cc->f("payment_method_id");
$count += $db_cc->num_rows();
$cc_payments = true;
} else {
$cc_payments = false;
}
$db_nocc = new ps_DB();
$q = "SELECT * from #__{vm}_payment_method,#__{vm}_shopper_group WHERE ";
$q .= "#__{vm}_payment_method.shopper_group_id=#__{vm}_shopper_group.shopper_group_id ";
$q .= "AND (#__{vm}_payment_method.shopper_group_id='" . $auth['shopper_group_id'] . "' ";
$q .= "OR #__{vm}_shopper_group.default='1') ";
$q .= "AND (enable_processor='B' OR enable_processor='N' OR enable_processor='P') ";
$q .= "AND payment_enabled='Y' ";
$q .= "AND #__{vm}_payment_method.vendor_id='{$ps_vendor_id}' ";
$q .= " ORDER BY list_order";
$db_nocc->query($q);
if ($db_nocc->next_record()) {
$nocc_payments = true;
$first_payment_method_id = $db_nocc->f("payment_method_id");
$count += $db_nocc->num_rows();
$db_nocc->reset();
} else {
$nocc_payments = false;
}
// Redirect to the last step when there's only one payment method
if ($VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']) {
if ($count <= 1 && $cc_payments == false) {
vmRedirect($sess->url(SECUREURL . basename($_SERVER['PHP_SELF']) . "?page=checkout.index&payment_method_id={$first_payment_method_id}&ship_to_info_id={$ship_to_info_id}&shipping_rate_id=" . urlencode($shipping_rate_id) . "&checkout_stage=" . $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], false, false), "");
} elseif (isset($order_total) && $order_total <= 0.0) {
// In case the order total is less than or equal zero, we don't need a payment method
vmRedirect($sess->url(SECUREURL . basename($_SERVER['PHP_SELF']) . "?page=checkout.index&ship_to_info_id={$ship_to_info_id}&shipping_rate_id=" . urlencode($shipping_rate_id) . "&checkout_stage=" . $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], false, false), "");
}
}
$theme = new $GLOBALS['VM_THEMECLASS']();
$theme->set_vars(array('db_nocc' => $db_nocc, 'db_cc' => $db_cc, 'nocc_payments' => $nocc_payments, 'payment_method_id' => $payment_method_id, 'first_payment_method_id' => $first_payment_method_id, 'count' => $count, 'cc_payments' => $cc_payments, 'ps_creditcard' => $ps_creditcard, 'ps_payment_method' => $ps_payment_method));
echo $theme->fetch('checkout/list_payment_methods.tpl.php');
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:66,代码来源:ps_checkout.php
示例4: trim
$row->load((int) $user_id);
if ($user_id) {
$query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE user_id = " . (int) $row->id;
$database->setQuery($query);
$contact = $database->loadObjectList();
$row->name = trim($row->name);
$row->email = trim($row->email);
$row->username = trim($row->username);
$row->password = trim($row->password);
} else {
$contact = NULL;
$row->block = 0;
}
// check to ensure only super admins can edit super admin info
if ($my->gid < 25 && $row->gid == 25) {
vmRedirect('index2.php?option=com_users', _NOT_AUTH);
}
$my_group = strtolower($acl->get_group_name($row->gid, 'ARO'));
if ($my_group == 'super administrator' && $my->gid != 25) {
$lists['gid'] = '<input type="hidden" name="gid" value="' . $my->gid . '" /><strong>Super Administrator</strong>';
} else {
if ($my->gid == 24 && $row->gid == 24) {
$lists['gid'] = '<input type="hidden" name="gid" value="' . $my->gid . '" /><strong>Administrator</strong>';
} else {
// ensure user can't add group higher than themselves
$my_groups = $acl->get_object_groups('users', $my->id, 'ARO');
if (is_array($my_groups) && count($my_groups) > 0) {
$ex_groups = $acl->get_group_children($my_groups[0], 'ARO', 'RECURSE');
if (!$ex_groups) {
$ex_groups = array();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:admin.user_form.php
示例5: array
$sql = 'SELECT attribute_value FROM #__{vm}_product_attribute WHERE `product_id` = ' . $product_id . ' AND attribute_name=\'download\'';
$dbf->query($sql);
$downloadFiles = array();
while ($dbf->next_record()) {
$downloadFiles[] = $dbf->f('attribute_value');
}
$q = "SELECT file_id, file_is_image, file_product_id, file_extension, file_url, file_published, file_name, file_title, file_image_thumb_height, file_image_thumb_width FROM #__{vm}_product_files ";
$q .= "WHERE file_product_id = '{$product_id}' ";
$q .= "ORDER BY file_is_image DESC";
$db->query($q);
$db->next_record();
if (!empty($files)) {
$db->record = array_merge($files, $db->record);
}
if ($db->num_rows() < 1 && $task != "cancel") {
vmRedirect($_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.file_form&product_id={$product_id}&no_menu=" . @$_REQUEST['no_menu']);
}
$db->reset();
$arr = array();
$arr2 = array();
while ($db->next_record()) {
// Reorder the whole recordset and put pay-download files at the top
$filename = $mosConfig_absolute_path . str_replace($mosConfig_absolute_path, '', $db->f("file_name"));
$isProductDownload = in_array(basename($filename), $downloadFiles) ? true : false;
if ($isProductDownload) {
$arr[] = $db->getCurrentRow();
} else {
$arr2[] = $db->getCurrentRow();
}
}
$db->record = array_merge($arr, $arr2);
开发者ID:albertobraschi,项目名称:Hab,代码行数:31,代码来源:product.file_list.php
示例6: mm_showMyFileName
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
require_once CLASSPATH . "pageNavigation.class.php";
require_once CLASSPATH . "htmlTools.class.php";
$country_id = vmGet($_REQUEST, 'country_id');
if (is_array($country_id)) {
$country_id = $country_id[0];
}
if (empty($country_id)) {
vmRedirect($_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_list", "A country ID could not be found");
}
$db->query("SELECT country_name FROM #__{vm}_country WHERE country_id='{$country_id}'");
$db->next_record();
$title = $VM_LANG->_('PHPSHOP_STATE_LIST_LBL') . " " . $db->f("country_name");
$q = "SELECT SQL_CALC_FOUND_ROWS * FROM #__{vm}_state ";
$search = '';
if (!empty($keyword)) {
$search .= "AND ( state_name LIKE '%{$keyword}%' OR ";
$search .= "state_2_code LIKE '%{$keyword}%' OR ";
$search .= "state_3_code LIKE '%{$keyword}%' ";
$search .= ") ";
}
$q .= "WHERE country_id='{$country_id}' ";
$q .= $search;
$q .= "ORDER BY state_name ";
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:31,代码来源:admin.country_state_list.php
示例7: mm_showMyFileName
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
global $mosConfig_allowUserRegistration, $mosConfig_useractivation;
require_once CLASSPATH . "ps_userfield.php";
require_once CLASSPATH . "htmlTools.class.php";
$missing = vmGet($_REQUEST, "missing", "");
if (!empty($missing)) {
echo "<script type=\"text/javascript\">alert('" . $VM_LANG->_('CONTACT_FORM_NC', false) . "'); </script>\n";
}
// If not using NO_REGISTRATION, redirect with a warning when Joomla doesn't allow user registration
if ($mosConfig_allowUserRegistration == "0" && VM_REGISTRATION_TYPE != 'NO_REGISTRATION') {
$msg = 'User registration is disabled, it must be enabled in order to proceed.';
vmRedirect($sess->url('index.php?page=' . HOMEPAGE, true, false), $msg);
return;
}
if (vmIsJoomla('1.5')) {
// Set the validation value
$validate = JUtility::getToken();
} else {
$validate = function_exists('josspoofvalue') ? josSpoofValue(1) : vmSpoofValue(1);
}
$fields = ps_userfield::getUserFields('registration', false, '', false);
// Read-only fields on registration don't make sense.
foreach ($fields as $field) {
$field->readonly = 0;
}
$skip_fields = array();
if ($my->id > 0 || VM_REGISTRATION_TYPE != 'NORMAL_REGISTRATION' && VM_REGISTRATION_TYPE != 'OPTIONAL_REGISTRATION' && ($page == 'checkout.index' || $page == 'shop.registration')) {
开发者ID:albertobraschi,项目名称:Hab,代码行数:31,代码来源:checkout_register_form.php
示例8: redirectToPayment
function redirectToPayment(&$d)
{
require_once CLASSPATH . 'ps_checkout.php';
$checkout_steps = ps_checkout::get_checkout_steps();
$current_stage = 0;
foreach ($checkout_steps as $step) {
if (in_array('CHECK_OUT_GET_PAYMENT_METHOD', $checkout_steps[$current_stage])) {
break;
} else {
$current_stage++;
}
}
//Request used for when going from a regular link instead of a post from form
$_REQUEST['checkout_stage'] = $current_stage;
$_POST['checkout_this_step'] = $checkout_steps[$current_stage];
ps_paypal_api::destroyPaypalSession();
vmRedirect($sess->url('index.php?page=checkout.index&shipping_rate_id=' . urlencode($d['shipping_rate_id']) . '&ship_to_info_id=' . $d['ship_to_info_id'] . '&checkout_stage=' . $current_stage, false, false));
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:18,代码来源:ps_paypal_api.php
示例9: elseif
echo "<tr><td> </td><td> </td></tr>\n";
echo "<tr><td> </td><td><input name=\"submit\" type=\"submit\" value=\"" . $VM_LANG->_('PHPSHOP_SUBMIT') . "\" /></td></tr>\n";
echo "</table>\n";
echo "<input type=\"hidden\" name=\"option\" value=\"com_virtuemart\" />\n";
echo "<input type=\"hidden\" name=\"Itemid\" value=\"{$Itemid}\" />\n";
echo "<input type=\"hidden\" name=\"payment_method_id\" value=\"{$payment_method_id}\" />\n";
echo "<input type=\"hidden\" name=\"task\" value=\"changekey\" />\n";
echo "<input type=\"hidden\" name=\"pshop_mode\" value=\"admin\" />\n";
echo "<input type=\"hidden\" name=\"page\" value=\"store.payment_method_keychange\" />\n";
echo "</form>\n";
} elseif ($auth_result && !empty($passkey) && $task == "changekey") {
$q = "UPDATE #__{vm}_payment_method ";
$q .= "SET payment_passkey = " . VM_ENCRYPT_FUNCTION . "('{$passkey}','" . ENCODE_KEY . "')\n";
$q .= "WHERE payment_method_id='{$payment_method_id}';";
$db->query($q);
vmRedirect($sess->url($_SERVER['PHP_SELF'] . "?page=store.payment_method_form&payment_method_id={$payment_method_id}", false, false), $VM_LANG->_('PHPSHOP_CHANGE_PASSKEY_SUCCESS'));
} else {
require_once CLASSPATH . "ps_checkout.php";
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n";
echo "<table class=\"adminForm\">\n";
echo "<tr><td>" . $VM_LANG->_('PHPSHOP_CURRENT_TRANSACTION_KEY') . ":</td><td>" . ($db->f('passkey') ? ps_checkout::asterisk_pad($db->f('passkey'), 4) : '<i>(empty!)</i>') . "</td></tr>\n";
echo "<tr><td> </td><td> </td></tr>\n";
echo "<tr><td>" . $VM_LANG->_('PHPSHOP_TYPE_PASSWORD') . ":</td>\n";
echo "<td><input type=\"password\" name=\"passwd\" value=\"\" /></td></tr>\n";
echo "<tr><td> </td><td> </td></tr>\n";
echo "<tr><td> </td><td><input name=\"submit\" type=\"submit\" value=\"" . $VM_LANG->_('PHPSHOP_SUBMIT') . "\" /></td></tr>\n";
echo "</table>\n";
echo "<input type=\"hidden\" name=\"option\" value=\"com_virtuemart\" />\n";
echo "<input type=\"hidden\" name=\"Itemid\" value=\"{$Itemid}\" />\n";
echo "<input type=\"hidden\" name=\"pshop_mode\" value=\"admin\" />\n";
echo "<input type=\"hidden\" name=\"payment_method_id\" value=\"{$payment_method_id}\" />\n";
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:31,代码来源:store.payment_method_keychange.php
示例10: mm_showMyFileName
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
global $ps_order_status;
require_once CLASSPATH . 'ps_checkout.php';
require_once CLASSPATH . 'ps_userfield.php';
require_once CLASSPATH . 'ps_product.php';
$ps_product = new ps_product();
$registrationfields = ps_userfield::getUserFields('registration', false, '', true, true);
$shippingfields = ps_userfield::getUserFields('shipping', false, '', true, true);
$order_id = vmRequest::getInt('order_id', 0);
if (empty($order_id)) {
vmRedirect($_SERVER['SCRIPT_NAME'] . '?option=com_virtuemart&page=order.order_list');
}
$dbc = new ps_DB();
$q = "SELECT * FROM #__{vm}_orders WHERE order_id={$order_id} and vendor_id = {$ps_vendor_id}";
$db->query($q);
$db->next_record();
echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
?>
<br />
<?php
echo vmCommonHTML::PrintIcon();
?>
<br /><br />
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td valign="top">
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:order.order_printdetails.php
示例11: submit_order
}
if (!in_array('CHECK_OUT_GET_FINAL_CONFIRMATION', $checkout_steps[$current_stage])) {
?>
<div align="center">
<input type="submit" class="button" name="formSubmit" value="<?php
echo $VM_LANG->_('PHPSHOP_CHECKOUT_NEXT');
?>
>>" />
</div>
<?php
}
// Close the Checkout Form, which was opened in the first checkout template using the variable $basket_html
echo '</form>';
if (!in_array('CHECK_OUT_GET_FINAL_CONFIRMATION', $checkout_steps[$current_stage])) {
echo "<script type=\"text/javascript\"><!--\r\n function submit_order( form ) { return true; }\r\n --></script>";
}
} else {
if (!empty($auth['user_id'])) {
// USER IS LOGGED IN, BUT NO REGISTERED CUSTOMER
// WE NEED SOME ADDITIONAL INFORMATION HERE,
// SO REDIRECT HIM TO shop/shopper_add
$vmLogger->info($VM_LANG->_('PHPSHOP_NO_CUSTOMER', false));
include PAGEPATH . 'checkout_register_form.php';
} else {
// user is not logged in
echo $theme->fetch('checkout/login_registration.tpl.php');
}
}
} else {
vmRedirect($sess->url('index.php?page=shop.cart', false, false));
}
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:31,代码来源:checkout.index.php
示例12: add
//.........这里部分代码省略.........
$_REQUEST['flypage'] = ps_product::get_flypage($product_id);
$GLOBALS['page'] = 'shop.product_details';
$vmLogger->tip($VM_LANG->_('PHPSHOP_CART_SELECT_ITEM', false));
return true;
}
//Check for empty custom field and quantity>0 for multiple addto
//Normally means no info added to a custom field, but once added to a cart the quantity is automatically placed
//If another item is added and the custom field is left blank for another product already added this will just ignore that item
if ($multiple_products != 1 && $quantity != 0 && ($result["custom_attribute_given"] == false && !empty($result["custom_attribute_list"]))) {
$vmLogger->tip($VM_LANG->_('PHPSHOP_CART_SELECT_ITEM', false));
continue;
}
// Check for duplicate and do not add to current quantity
for ($i = 0; $i < $_SESSION["cart"]["idx"]; $i++) {
// modified for advanced attributes
if ($_SESSION['cart'][$i]["product_id"] == $product_id && $_SESSION['cart'][$i]["description"] == $e["description"]) {
$updated = 1;
}
}
list($min, $max) = ps_product::product_order_levels($product_id);
if ($min != 0 && $quantity != 0 && $quantity < $min) {
eval("\$msg = \"" . $VM_LANG->_('VM_CART_MIN_ORDER', false) . "\";");
$vmLogger->warning($msg);
continue;
}
if ($max != 0 && $quantity != 0 && $quantity > $max) {
eval("\$msg = \"" . $VM_LANG->_('VM_CART_MAX_ORDER', false) . "\";");
$vmLogger->warning($msg);
continue;
}
// If we did not update then add the item
if (!$updated && $quantity) {
$k = $_SESSION['cart']["idx"];
$_SESSION['cart'][$k]["quantity"] = $quantity;
$_SESSION['cart'][$k]["product_id"] = $product_id;
$_SESSION['cart'][$k]["parent_id"] = $e["product_id"];
$_SESSION['cart'][$k]["category_id"] = vmGet($e, 'category_id', 0);
// added for the advanced attribute modification
$_SESSION['cart'][$k]["description"] = $e["description"];
$_SESSION['cart']["idx"]++;
$total_quantity += $quantity;
} else {
list($updated_prod, $deleted_prod) = $this->update($e);
$total_updated += $updated_prod;
$total_deleted += $deleted_prod;
}
/* next 3 lines added by Erich for coupon code */
/* if the cart was updated we gotta update any coupon discounts to avoid ppl getting free stuff */
if (!empty($_SESSION['coupon_discount'])) {
// Update the Coupon Discount !!
require_once CLASSPATH . 'ps_coupon.php';
ps_coupon::process_coupon_code($d);
}
}
// End Iteration through Prod id's
$cart = $_SESSION['cart'];
ps_cart::saveCart();
// Ouput info message with cart update details /*
if ($total_quantity != 0 || $total_updated != 0 || $total_deleted != 0) {
if ($total_quantity > 0 && $total_updated == 0) {
$msg = $VM_LANG->_('VM_CART_PRODUCT_ADDED', false);
} else {
$msg = $VM_LANG->_('VM_CART_PRODUCT_UPDATED', false);
}
// Comment out the following line to turn off msg i.e. //$vmLogger->tip( $msg );
$vmLogger->info($msg);
} else {
if (@$request_stock) {
$vmLogger->tip($VM_LANG->_('PHPSHOP_CART_GOTO_WAITING_LIST', false));
} elseif ($total_quantity == 0) {
vmRequest::setVar('product_id', $product_id);
$GLOBALS['last_page'] = 'shop.product_details';
$vmLogger->warning($VM_LANG->_('PHPSHOP_CART_ERROR_NO_VALID_QUANTITY', false));
return false;
} else {
$vmLogger->tip($VM_LANG->_('PHPSHOP_CART_QUANTITY_EXCEEDED', false));
}
}
// end cart update message */
// Perform notification of out of stock items
if (@$request_stock) {
global $notify;
$_SESSION['notify'] = array();
$_SESSION['notify']['idx'] = 0;
$k = 0;
$notify = $_SESSION['notify'];
foreach ($request_stock as $request) {
$_SESSION['notify'][$k]["prod_id"] = $request['product_id'];
$_SESSION['notify'][$k]["quantity"] = $request['quantity'];
$_SESSION['notify']['idx']++;
$k++;
}
if (vmIsXHR()) {
$GLOBALS['vm_mainframe']->scriptRedirect($sess->url('index.php?page=shop.waiting_list&product_id=' . $product_id, true, false));
} else {
vmRedirect($sess->url('index.php?page=shop.waiting_list&product_id=' . $product_id, true, false));
}
}
return True;
}
开发者ID:rafarubert,项目名称:megafiltros,代码行数:101,代码来源:ps_cart.php
示例13: prepare_SSL_Session
/**
* This is a solution for the Shared SSL problem
* We have to copy some cookies from the Main Mambo site domain into
* the shared SSL domain (only when necessary!)
*
* The function is called on each page load.
*/
function prepare_SSL_Session()
{
global $mainframe, $my, $database, $mosConfig_secret, $page, $VM_MODULES_FORCE_HTTPS;
if (vmIsAdminMode() && vmIsJoomla('1.0')) {
return;
}
$ssl_redirect = vmGet($_GET, "ssl_redirect", 0);
$redirected = vmGet($_GET, "redirected", 0);
$martID = vmGet($_GET, 'martID', '');
$ssl_domain = "";
if (!empty($VM_MODULES_FORCE_HTTPS)) {
$pagearr = explode('.', $page);
$module = $pagearr[0];
// When NOT in https mode, but the called page is part of a shop module that is
// forced to use https, we prepare the redirection to https here
if (array_search($module, $VM_MODULES_FORCE_HTTPS) !== false && !vmIsHttpsMode() && $this->check_Shared_SSL($ssl_domain)) {
$ssl_redirect = 1;
}
}
// Generally redirect to HTTP (from HTTPS) when it is not necessary? (speed up the pageload)
if (VM_GENERALLY_PREVENT_HTTPS == '1' && vmIsHttpsMode() && $redirected != 1 && $ssl_redirect == 0 && !vmIsAdminMode() && URL != SECUREURL && @$_REQUEST['option'] == 'com_virtuemart') {
$pagearr = explode('.', $page);
$module = $pagearr[0];
// When it is not necessary to stay in https mode, we leave it here
if (array_search($module, $VM_MODULES_FORCE_HTTPS) === false) {
if ($this->check_Shared_SSL($ssl_domain)) {
$this->saveSessionAndRedirect(false);
}
$query_string = vmGet($_SERVER, 'QUERY_STRING');
if (!empty($query_string) && empty($_POST)) {
vmRedirect($this->url(URL . basename($_SERVER['PHP_SELF']) . '?' . vmGet($_SERVER, 'QUERY_STRING') . '&redirected=1', true, false, true));
}
}
}
/**
* This is the first part of the Function:
* We check if the function must be called at all
* Usually this is only called once: Before we go to the checkout.
* The variable ssl_redirect=1 is appended to the URL, just for this function knows
* is must be active! This has nothing to do with SSL / Shared SSL or whatever
*/
if ($ssl_redirect == 1) {
$_SERVER['QUERY_STRING'] = str_replace('&ssl_redirect=1', '', vmGet($_SERVER, 'QUERY_STRING'));
// check_Shared_SSL compares the normal http domain name
// and the https Domain Name. If both do not match, we move on
// else we leave this function.
if ($this->check_Shared_SSL($ssl_domain) && !vmIsHttpsMode() && $redirected == 0) {
$this->saveSessionAndRedirect(true);
} elseif (!vmIsHttpsMode() && $redirected == 0) {
vmRedirect($this->url(SECUREURL . basename($_SERVER['PHP_SELF']) . "?" . vmGet($_SERVER, 'QUERY_STRING') . '&redirected=1', true, false, true));
}
}
/**
* This is part two of the function
* If the redirect (see 4/5 lines above) was successful
* and the Store uses Shared SSL, we have the variable martID
* So let's copy the Session contents ton the new domain and start the session again
* othwerwise: do nothing.
*/
if (!empty($martID)) {
if ($this->check_Shared_SSL($ssl_domain)) {
// We now need to copy the Session Data to the SSL Domain
if ($martID) {
require_once ADMINPATH . 'install.copy.php';
$sessionFile = IMAGEPATH . md5($martID) . '.sess';
// Read the contents of the session file
$session_data = file_get_contents($sessionFile);
// Delete it for security and disk space reasons
unlink($sessionFile);
// Read the session data into $_SESSION
// From now on, we can use all the data in $_SESSION
session_decode($session_data);
$check = base64_decode($martID);
$checkValArr = explode("|", $check);
if (defined('_JEXEC')) {
//TODO
} elseif (class_exists('mambocore')) {
//TODO
} elseif ($GLOBALS['_VERSION']->RELEASE == '1.0' && (int) $GLOBALS['_VERSION']->DEV_LEVEL >= 13) {
if (!empty($GLOBALS['real_mosConfig_live_site']) && empty($_REQUEST['real_mosConfig_live_site'])) {
$GLOBALS['mosConfig_live_site'] = $GLOBALS['real_mosConfig_live_site'];
}
if (!empty($checkValArr[2])) {
// Joomla! >= 1.0.13 can be cheated to log in a user who has previsously logged in and checked the "Remember me" box
setcookie(mosmainframe::remCookieName_User(), $checkValArr[2], false, '/');
// there's no need to call "$mainframe->login"
}
} else {
// Check if the user was logged in in the http domain
// and is not yet logged in at the Shared SSL domain
if (isset($checkValArr[1]) && !$my->id) {
// user should expect to be logged in,
// we can use the values from $_SESSION['auth'] now
//.........这里部分代码省略.........
开发者ID:albertobraschi,项目名称:Hab,代码行数:101,代码来源:ps_session.php
示例14: applyPatch
/**
* Applies the Patch Package
*
* @param array $d
* @return boolean
*/
function applyPatch(&$d)
{
global $vm_mainframe, $vmLogger, $mosConfig_absolute_path, $db, $sess, $VM_LANG;
$updatepackage = vmget($_SESSION, 'vm_updatepackage');
if (empty($updatepackage)) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_DOWNLOAD'));
return false;
}
$patchdir = vmUpdate::getPackageDir($updatepackage);
// RickG - Save the location of the patch file
JRequest::setVar('patchdir', $patchdir);
$packageContents = vmUpdate::getPatchContents($updatepackage);
if (!vmUpdate::verifyPackage($packageContents)) {
return false;
}
$errors = 0;
foreach ($packageContents['fileArr'] as $fileentry) {
$file = $fileentry['filename'];
$patch_file = $patchdir . '/' . $file;
$orig_file = $mosConfig_absolute_path . '/' . $file;
if (file_exists($orig_file)) {
if (!is_writable($orig_file) && !@chmod($orig_file, 0644)) {
$vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_FILE_UNWRITABLE'), $mosConfig_absolute_path . '/' . $file));
$errors++;
}
} else {
if ($fileentry['copy_policy'] == 'only_if_exists') {
continue;
}
$dirname = is_dir($patch_file) ? $orig_file : dirname($orig_file);
if (is_dir($patch_file) || !file_exists($dirname)) {
if (!vmUpdate::mkdirR($dirname, 0755)) {
$vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_DIR_UNWRITABLE'), $dirname));
$errors++;
}
} elseif (!is_writable($mosConfig_absolute_path . '/' . dirname($file)) && !@chmod($mosConfig_absolute_path . '/' . dirname($file), 0755)) {
$vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_DIR_UNWRITABLE'), $mosConfig_absolute_path . '/' . $file));
$errors++;
}
}
}
if ($errors > 0) {
return false;
}
foreach ($packageContents['fileArr'] as $fileentry) {
$file = $fileentry['filename'];
$patch_file = $patchdir . '/' . $file;
$orig_file = $mosConfig_absolute_path . '/' . $file;
if (!file_exists($orig_file) && $fileentry['copy_policy'] == 'only_if_exists') {
continue;
}
if (is_dir($patch_file) || !file_exists(dirname($orig_file))) {
$dirname = is_dir($patch_file) ? $orig_file : dirname($orig_file);
if (!vmUpdate::mkdirR($dirname, 755)) {
$vmLogger->crit('Failed to create a necessary directory');
}
} elseif (!@copy($patch_file, $orig_file)) {
$vmLogger->crit(sprintf($VM_LANG->_('VM_UPDATE_ERR_OVERWRITE_FAILED'), $file));
return false;
} else {
$vmLogger->debug(sprintf($VM_LANG->_('VM_UPDATE_FILE_OVERWROTE'), $file));
}
}
foreach ($packageContents['queryArr'] as $query) {
if ($db->query($query) === false) {
$vmLogger->crit(sprintf($VM_LANG->_('VM_UPDATE_ERR_QUERY_FAILED'), $query));
} else {
$vmLogger->debug(sprintf($VM_LANG->_('VM_UPDATE_QUERY_EXECUTED'), $query));
}
}
// RickG - Run the install file if it exists
if ($packageContents['installfile']) {
include $packageContents['installfile'];
com_vminstall($patchdir);
}
$db->query('UPDATE `#__components` SET `params` = \'RELEASE=' . $packageContents['toversion'] . '\\nDEV_STATUS=stable\' WHERE `name` = \'virtuemart_version\'');
$_SESSION['vmupdatemessage'] = sprintf($VM_LANG->_('VM_UPDATE_SUCCESS'), $packageContents['forversion'], $packageContents['toversion']);
// Delete the patch package file
vmUpdate::removePackageFile($d);
if (vmIsXHR()) {
$vm_mainframe->addResponseScript('parent.loadPage("' . $GLOBALS['sess']->url($_SERVER['PHP_SELF'] . '?page=admin.update_result', false, false) . '");');
} else {
// Redirect to the Result Page and display the Update Message there
vmRedirect($sess->url($_SERVER['PHP_SELF'] . '?page=admin.update_result', false, false));
}
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:92,代码来源:update.class.php
示例15: ps_DB
$Itemid = $sess->getShopItemid();
$db_product = new ps_DB();
// Check for non-numeric product id
if (!empty($product_id)) {
if (!is_numeric($product_id)) {
$product_id = '';
}
}
// Get the product info from the database
$q = "SELECT * FROM `#__{vm}_product` WHERE ";
if (!empty($product_id)) {
$q .= "`product_id`={$product_id}";
} elseif (!empty($product_sku)) {
$q .= "`product_sku`='{$product_sku}'";
} else {
vmRedirect($sess->url($_SERVER['PHP_SELF'] . "?keyword=" . urlencode($keyword) . "&category_id={$_SESSION['session_userstate']['category_id']}&limitstart={$_SESSION['limitstart']}&page=shop.browse", false, false), $VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND'));
}
if (!$perm->check("admin,storeadmin")) {
$q .= " AND `product_publish`='Y'";
if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
$q .= " AND `product_in_stock` > 0 ";
}
}
$db_product->query($q);
// Redirect back to Product Browse Page on Error
if (!$db_product->next_record()) {
$vmLogger->err($VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND', false));
return;
}
if (empty($product_id)) {
$product_id = $db_product->f('product_id');
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:shop.product_details.php
示例16: add
//.........这里部分代码省略.........
$fields = array('user_info_id' => md5(uniqid($hash_secret)), 'user_id' => $uid, 'address_type' => 'BT', 'address_type_name' => '-default-', 'cdate' => $timestamp, 'mdate' => $timestamp, 'perms' => 'shopper');
foreach ($userFields as $userField) {
if (!in_array($userField->name, $skipFields)) {
$fields[$userField->name] = ps_userfield::prepareFieldDataSave($userField->type, $userField->name, vmGet($d, $userField->name, strtoupper($userField->name)));
// Catch a newsletter registration!
if (stristr($userField->params, 'newsletter')) {
if (!empty($d[$userField->name])) {
require_once CLASSPATH . 'parameters.class.php';
$subscribeTo = new vmParameters($userField->params);
$vmLogger->debug('Adding the user to the Newsletter.');
}
}
}
}
$fields['user_email'] = $fields['email'];
unset($fields['email']);
$db->buildQuery('INSERT', '#__{vm}_user_info', $fields);
// Run the query now!
$db->query();
// Insert vendor relationship
$q = "INSERT INTO #__{vm}_auth_user_vendor (user_id,vendor_id)";
$q .= " VALUES ";
$q .= "('" . $uid . "','";
$q .= $ps_vendor_id . "') ";
$db->query($q);
$d['shopper_group_id'] = '';
// Get the ID of the shopper group for this customer
if ($d['isValidVATID']) {
if (trim($d['__euvatid_field']->params) != '') {
$shopper_group = new vmParameters($d['__euvatid_field']->params);
$d['shopper_group_id'] = $shopper_group->get('shopper_group_id');
}
}
if (empty($d['shopper_group_id'])) {
$q = "SELECT shopper_group_id from #__{vm}_shopper_group WHERE ";
$q .= "`default`='1' ";
$db->query($q);
if (!$db->num_rows()) {
// take the first in the table
$q = "SELECT shopper_group_id from #__{vm}_shopper_group";
$db->query($q);
}
$db->next_record();
$d['shopper_group_id'] = $db->f("shopper_group_id");
}
$customer_nr = uniqid(rand());
// Insert Shopper -ShopperGroup - Relationship
$q = "INSERT INTO #__{vm}_shopper_vendor_xref ";
$q .= "(user_id,vendor_id,shopper_group_id,customer_number) ";
$q .= "VALUES ('{$uid}', '{$ps_vendor_id}','" . $d['shopper_group_id'] . "', '{$customer_nr}')";
$db->query($q);
// Process the Newsletter subscription
if (!empty($subscribeTo) && strtolower(get_class($subscribeTo)) == 'vmparameters') {
switch ($subscribeTo->get('newsletter', 'letterman')) {
// TODO:
case 'ccnewsletter':
$db->query("INSERT INTO `#__ccnewsletter_subscribers` ( `name`, `email`, `plainText`, `enabled`, `sdate`) \r\n\t\t\t\t\t\t\tVALUES('" . $d['first_name'] . " " . $d['last_name'] . "','" . $d['email'] . "', '0', '1', NOW())");
// case 'anjel':
// case 'anjel':
case 'letterman':
default:
if (file_exists($mosConfig_absolute_path . '/components/com_letterman/letterman.php')) {
$db->query("INSERT INTO `#__letterman_subscribers` (`user_id`, `subscriber_name`, `subscriber_email`, `confirmed`, `subscribe_date`)\r\n\t\t\t\t\t\t\t\t\t\tVALUES('{$uid}','" . $d['first_name'] . " " . $d['last_name'] . "','" . $d['email'] . "', '1', NOW())");
}
}
}
if (VM_REGISTRATION_TYPE == 'NO_REGISTRATION' || VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION' && empty($d['register_account'])) {
$auth['user_id'] = $uid;
$auth['username'] = $d['email'];
$_SESSION['auth'] = $auth;
} elseif
|
请发表评论