当前位置: 首页>>代码示例>>PHP>>正文


PHP vmRequest::setVar方法代码示例

本文整理汇总了PHP中vmRequest::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP vmRequest::setVar方法的具体用法?PHP vmRequest::setVar怎么用?PHP vmRequest::setVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vmRequest的用法示例。


在下文中一共展示了vmRequest::setVar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 /**
  * Adds a new Shopper Group
  *
  * @param array $d
  * @return boolean
  */
 function add(&$d)
 {
     global $perm, $vmLogger, $VM_LANG;
     $hash_secret = "virtuemart";
     if ($perm->check("admin")) {
         $vendor_id = $d["vendor_id"];
     } else {
         $vendor_id = $_SESSION["ps_vendor_id"];
     }
     $db = new ps_DB();
     $timestamp = time();
     $default = @$d["default"] == "1" ? "1" : "0";
     if (!$this->validate_add($d)) {
         return False;
     }
     $user_id = md5(uniqid($hash_secret));
     $fields = array('vendor_id' => $vendor_id, 'shopper_group_name' => $d["shopper_group_name"], 'shopper_group_desc' => $d["shopper_group_desc"], 'shopper_group_discount' => $d["shopper_group_discount"], 'show_price_including_tax' => $d["show_price_including_tax"], 'default' => $default);
     $db->buildQuery('INSERT', '#__{vm}_shopper_group', $fields);
     if ($db->query() !== false) {
         $shopper_group_id = $db->last_insert_id();
         vmRequest::setVar('shopper_group_id', $shopper_group_id);
         $vmLogger->info($VM_LANG->_('SHOPPER_GROUP_ADDED'));
         // Set all other shopper groups to be non-default, if this new shopper group shall be "default"
         if ($default == "1") {
             $q = "UPDATE #__{vm}_shopper_group ";
             $q .= "SET `default`=0 ";
             $q .= "WHERE shopper_group_id !=" . $shopper_group_id;
             $q .= " AND vendor_id ={$vendor_id}";
             $db->query($q);
             $db->next_record();
         }
         return $_REQUEST['shopper_group_id'];
     }
     $vmLogger->err($VM_LANG->_('SHOPPER_GROUP_ADD_FAILED'));
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:42,代码来源:ps_shopper_group.php

示例2: validate

 /**
  * Validates product fields and uploaded image files.
  *
  * @param array $d The input vars
  * @return boolean True when validation successful, false when not
  */
 function validate(&$d)
 {
     global $vmLogger, $database, $perm, $VM_LANG;
     require_once CLASSPATH . 'imageTools.class.php';
     $valid = true;
     $db = new ps_DB();
     $q = "SELECT product_id,product_thumb_image,product_full_image FROM #__{vm}_product WHERE product_sku='";
     $q .= $d["product_sku"] . "'";
     $db->setQuery($q);
     $db->query();
     if ($db->next_record() && $db->f("product_id") != $d["product_id"]) {
         $vmLogger->err("A Product with the SKU " . $d['product_sku'] . " already exists.");
         $valid = false;
     }
     if (!empty($d['product_discount_id'])) {
         if ($d['product_discount_id'] == "override") {
             $d['is_percent'] = "0";
             // If discount are applied before tax then base the discount on the untaxed price
             if (PAYMENT_DISCOUNT_BEFORE == '1') {
                 $d['amount'] = (double) $d['product_price'] - (double) $d['discounted_price_override'];
             } else {
                 $d['amount'] = (double) $d['product_price_incl_tax'] - (double) $d['discounted_price_override'];
             }
             // Set the discount start date as today
             $d['start_date'] = date('Y-m-d');
             require_once CLASSPATH . 'ps_product_discount.php';
             $ps_product_discount = new ps_product_discount();
             $ps_product_discount->add($d);
             $d['product_discount_id'] = $database->insertid();
             vmRequest::setVar('product_discount_id', $d['product_discount_id']);
         }
     }
     if (empty($d['manufacturer_id'])) {
         $d['manufacturer_id'] = "1";
     }
     if (empty($d["product_sku"])) {
         $vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_SKU', false));
         $valid = false;
     }
     if (!$d["product_name"]) {
         $vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_NAME', false));
         $valid = false;
     }
     if (empty($d["product_available_date"])) {
         $vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_AVAILDATE', false));
         $valid = false;
     } else {
         $day = (int) substr($d["product_available_date"], 8, 2);
         $month = (int) substr($d["product_available_date"], 5, 2);
         $year = (int) substr($d["product_available_date"], 0, 4);
         $d["product_available_date_timestamp"] = mktime(0, 0, 0, $month, $day, $year);
     }
     /** Validate Product Specific Fields **/
     if (!$d["product_parent_id"]) {
         if (empty($d['product_categories']) || !is_array(@$d['product_categories'])) {
             $d['product_categories'] = explode('|', $d['category_ids']);
         }
         if (sizeof(@$d["product_categories"]) < 1) {
             $vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_CATEGORY'));
             $valid = false;
         }
     }
     /** Image Upload Validation **/
     // do we have an image URL or an image File Upload?
     if (!empty($d['product_thumb_image_url'])) {
         // Image URL
         if (substr($d['product_thumb_image_url'], 0, 4) != "http") {
             $vmLogger->err($VM_LANG->_('VM_PRODUCT_IMAGEURL_MUSTBEGIN', false));
             $valid = false;
         }
         // if we have an uploaded image file, prepare this one for deleting.
         if ($db->f("product_thumb_image") && substr($db->f("product_thumb_image"), 0, 4) != "http") {
             $_REQUEST["product_thumb_image_curr"] = $db->f("product_thumb_image");
             $d["product_thumb_image_action"] = "delete";
             if (!vmImageTools::validate_image($d, "product_thumb_image", "product")) {
                 return false;
             }
         }
         $d["product_thumb_image"] = $d['product_thumb_image_url'];
     } else {
         // File Upload
         if (!vmImageTools::validate_image($d, "product_thumb_image", "product")) {
             $valid = false;
         }
     }
     if (!empty($d['product_full_image_url'])) {
         // Image URL
         if (substr($d['product_full_image_url'], 0, 4) != "http") {
             $vmLogger->err($VM_LANG->_('VM_PRODUCT_IMAGEURL_MUSTBEGIN', false));
             return false;
         }
         // if we have an uploaded image file, prepare this one for deleting.
         if ($db->f("product_full_image") && substr($db->f("product_full_image"), 0, 4) != "http") {
             $_REQUEST["product_full_image_curr"] = $db->f("product_full_image");
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:ps_product.php

示例3: linkTag

 /**
  * Returns a link tag
  *
  * @param string $href
  * @param string $type
  * @param string $rel
  * @return string
  */
 function linkTag($href, $type = 'text/css', $rel = 'stylesheet', $media = "screen, projection")
 {
     global $mosConfig_gzip, $mosConfig_live_site;
     if (isset($_REQUEST['usefetchscript'])) {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1);
         vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
     } else {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1, 'session');
     }
     if (stristr($href, 'com_virtuemart') && $use_fetchscript) {
         $base_href = str_replace(URL, '', $href);
         $base_href = str_replace(SECUREURL, '', $base_href);
         $base_href = str_replace('components/com_virtuemart/', '', $base_href);
         $href = $mosConfig_live_site . '/components/com_virtuemart/fetchscript.php?gzip=' . $mosConfig_gzip . '&amp;subdir[0]=' . dirname($base_href) . '&amp;file[0]=' . basename($href);
     }
     return '<link type="' . $type . '" href="' . $href . '" rel="' . $rel . '"' . (empty($media) ? '' : ' media="' . $media . '"') . ' />' . "\n";
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:25,代码来源:htmlTools.class.php

示例4: update

 /**
  * Updates a Shipping Adress for the specified user info ID
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $perm, $VM_LANG;
     require_once CLASSPATH . 'ps_userfield.php';
     $db = new ps_DB();
     $timestamp = time();
     if (!$this->validate_update($d)) {
         return false;
     }
     // Get all fields which where shown to the user
     $shippingFields = ps_userfield::getUserFields('shipping', false, '', true);
     $skip_fields = ps_userfield::getSkipFields();
     foreach ($shippingFields as $userField) {
         if (!in_array($userField->name, $skip_fields)) {
             $fields[$userField->name] = ps_userfield::prepareFieldDataSave($userField->type, $userField->name, vmGet($d, $userField->name, strtoupper($userField->name)));
         }
     }
     // These are pre-defined fields.
     $fields['user_id'] = !$perm->check("admin,storeadmin") ? $_SESSION['auth']['user_id'] : (int) $d["user_id"];
     $fields['address_type'] = 'ST';
     $fields['mdate'] = time();
     $db->buildQuery('UPDATE', '#__{vm}_user_info', $fields, "WHERE user_info_id='" . $db->getEscaped($d["user_info_id"]) . "'" . (!$perm->check("admin,storeadmin") ? " AND user_id=" . $_SESSION['auth']['user_id'] : ''));
     if ($db->query() === false) {
         $GLOBALS['vmLogger']->err($VM_LANG->_('VM_USERADDRESS_UPDATED_FAILED'));
         return false;
     }
     $GLOBALS['vmLogger']->info($VM_LANG->_('VM_USERADDRESS_UPDATED'));
     vmRequest::setVar('ship_to_info_id', $d['user_info_id']);
     return true;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:36,代码来源:ps_user_address.php

示例5: stripslashes

   <input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
   <input type="hidden" name="description" value="' . stripslashes($cart[$i]["description"]) . '" />
   <input type="image" name="update" title="' . $VM_LANG->_('PHPSHOP_CART_UPDATE') . '" src="' . VM_THEMEURL . 'images/update_quantity_cart.png" alt="' . $VM_LANG->_('PHPSHOP_UPDATE') . '" align="middle" />
 </form>';
       $product_rows[$i]['delete_form'] = '<form action="' . $action_url . '" method="post" name="delete" style="display: inline;">
   <input type="hidden" name="option" value="com_virtuemart" />
   <input type="hidden" name="page" value="' . $page . '" />
   <input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
   <input type="hidden" name="func" value="cartDelete" />
   <input type="hidden" name="product_id" value="' . $_SESSION['cart'][$i]["product_id"] . '" />
   <input type="hidden" name="description" value="' . $cart[$i]["description"] . '" />
 	<input type="image" name="delete" title="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" src="' . VM_THEMEURL . 'images/remove_from_cart.png" alt="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" align="middle" />
 </form>';
   }
   // End of for loop through the Cart
   vmRequest::setVar('zone_qty', $vars['zone_qty']);
   $total = $total_undiscounted = round($total, 5);
   $vars["total"] = $total;
   $subtotal_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($grandSubtotal);
   if (!empty($_POST["do_coupon"]) || in_array(strtolower($func), array('cartadd', 'cartupdate', 'cartdelete')) && !empty($_SESSION['coupon_redeemed'])) {
       /* process the coupon */
       require_once CLASSPATH . "ps_coupon.php";
       $vars["total"] = $total;
       ps_coupon::process_coupon_code($vars);
   }
   /* HANDLE SHIPPING COSTS */
   if (!empty($shipping_rate_id) && !ps_checkout::noShippingMethodNecessary()) {
       $shipping = true;
       $vars["weight"] = $weight_total;
       $shipping_total = round($ps_checkout->_SHIPPING->get_rate($vars), 5);
       $shipping_taxrate = $ps_checkout->_SHIPPING->get_tax_rate();
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:basket.php

示例6: set

 function set($array, $hash = 'default', $overwrite = true)
 {
     foreach ($array as $key => $value) {
         vmRequest::setVar($key, $value, $hash, $overwrite);
     }
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:6,代码来源:request.class.php

示例7: elseif

     $tmp_product_id = $menuparams->get('product_id');
     $tmp_category_id = $menuparams->get('category_id');
     $tmp_flypage = $menuparams->get('flypage');
     $tmp_page = $menuparams->get('page');
     if (!empty($tmp_product_id)) {
         vmRequest::setVar('product_id', $tmp_product_id);
         vmRequest::setVar('page', 'shop.product_details');
     } elseif (!empty($tmp_category_id)) {
         vmRequest::setVar('category_id', $tmp_category_id);
         vmRequest::setVar('page', 'shop.browse');
     }
     if ((!empty($tmp_product_id) || !empty($tmp_category_id)) && !empty($tmp_flypage)) {
         vmRequest::setVar('flypage', $tmp_flypage);
     }
     if (!empty($tmp_page)) {
         vmRequest::setVar('page', $tmp_page);
     }
     // Set the default page
     $defaultpage = HOMEPAGE;
 } else {
     $defaultpage = vmget($_SESSION, 'last_page');
 }
 $page = vmRequest::getVar('page', $defaultpage);
 $func = vmRequest::getVar('func');
 $ajax_request = strtolower(vmGet($_SERVER, 'HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest' || vmGet($_REQUEST, 'ajax_request') == '1';
 $option = vmRequest::getVar('option');
 // This makes it possible to use Shared SSL
 $sess->prepare_SSL_Session();
 if ($option == "com_virtuemart") {
     // Get sure that we have float values with a decimal point!
     @setlocale(LC_NUMERIC, 'en_US', 'en');
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:virtuemart_parser.php

示例8: render

 function render($print = false)
 {
     global $mainframe, $mosConfig_gzip, $mosConfig_live_site;
     foreach ($this->_style as $style) {
         $tag = '<style type="' . key($style) . '">' . current($style) . '</style>';
         if ($print) {
             echo $tag;
         } else {
             $mainframe->addCustomHeadTag($tag);
         }
     }
     if (isset($_REQUEST['usefetchscript'])) {
         $use_fetchscript = vmRequest::getBool('usefetchscript', true);
         vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
     } else {
         $use_fetchscript = vmRequest::getBool('usefetchscript', true, 'session');
     }
     // Gather all the linked Scripts into ONE link
     $i = 0;
     $appendix = '';
     $loadorder = array();
     foreach ($this->_scripts as $script) {
         $src = $script['url'];
         $type = $script['type'];
         $content = $script['content'];
         $position = $script['position'];
         $urlpos = strpos($src, '?');
         $url_params = '';
         $js_file = false;
         $js_statement = false;
         if ($urlpos && (stristr($src, VM_COMPONENT_NAME) && !stristr($src, '.php') && $use_fetchscript)) {
             $url_params = '&amp;' . substr($src, $urlpos);
             $src = substr($src, 0, $urlpos);
         }
         /* Group the JS files together */
         if (stristr($src, VM_COMPONENT_NAME) && !stristr($src, '.php') && $use_fetchscript) {
             $base_source = str_replace($GLOBALS['real_mosConfig_live_site'], '', $src);
             $base_source = str_replace($GLOBALS['mosConfig_live_site'], '', $base_source);
             $base_source = str_replace('/components/' . VM_COMPONENT_NAME, '', $base_source);
             $base_source = str_replace('components/' . VM_COMPONENT_NAME, '', $base_source);
             $js_file = '&amp;subdir[' . $i . ']=' . dirname($base_source) . '&amp;file[' . $i . ']=' . basename($src);
             $i++;
         } else {
             $js_statement = array('type' => $type, 'src' => $src, 'content' => $content);
         }
         /* Group the statements according to their position */
         /* JS files */
         if ($js_file) {
             if (!isset($loadorder[$position]['js_file']['appendix'])) {
                 $loadorder[$position]['js_file']['appendix'] = '';
             }
             $loadorder[$position]['js_file']['appendix'] .= $js_file;
         }
         $js_file = false;
         /* JS statements */
         if ($js_statement) {
             $loadorder[$position]['js_statement'][] = $js_statement;
         }
         $js_statement = false;
     }
     /* Add the JS to the output */
     $processorder = array('top', 'middle', 'bottom');
     foreach ($processorder as $key => $pos) {
         if (isset($loadorder[$pos])) {
             if (isset($loadorder[$pos]['js_file'])) {
                 /* JS files */
                 $src = $mosConfig_live_site . '/components/' . VM_COMPONENT_NAME . '/fetchscript.php?gzip=' . $mosConfig_gzip;
                 $src .= $loadorder[$pos]['js_file']['appendix'];
                 $tag = '<script src="' . $src . @$url_params . '" type="text/javascript"></script>';
                 if ($print) {
                     echo $tag;
                 } else {
                     $mainframe->addCustomHeadTag($tag);
                 }
             }
             if (isset($loadorder[$pos]['js_statement'])) {
                 /* JS statements */
                 foreach ($loadorder[$pos]['js_statement'] as $statement_key => $otherscript) {
                     if (!empty($otherscript['src'])) {
                         $tag = '<script type="' . $otherscript['type'] . '" src="' . $otherscript['src'] . '"></script>';
                     } else {
                         $tag = '<script type="' . $otherscript['type'] . '">' . $otherscript['content'] . '</script>';
                     }
                     if ($print) {
                         echo $tag;
                     } else {
                         $mainframe->addCustomHeadTag($tag);
                     }
                 }
             }
         }
     }
     // Gather all the linked Stylesheets into ONE link
     $i = 0;
     $appendix = '';
     $url_params = '';
     foreach ($this->_styleSheets as $stylesheet) {
         $urlpos = strpos($stylesheet['url'], '?');
         if ($urlpos) {
             $url_params .= '&amp;' . substr($stylesheet['url'], $urlpos);
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:mainframe.class.php

示例9: add

 /**
  * adds an item to the shopping cart
  * @author pablo
  * @param array $d
  */
 function add(&$d)
 {
     global $sess, $VM_LANG, $cart, $vmLogger, $func;
     $d = $GLOBALS['vmInputFilter']->process($d);
     include_class("product");
     $db = new ps_DB();
     $ci = 0;
     $request_stock = "";
     $total_quantity = 0;
     $total_updated = 0;
     $total_deleted = 0;
     $_SESSION['last_page'] = "shop.product_details";
     if (!empty($d['product_id']) && !isset($d["prod_id"])) {
         if (empty($d['prod_id'])) {
             $d['prod_id'] = array();
         }
         if (is_array($d['product_id'])) {
             $d['prod_id'] = array_merge($d['prod_id'], $d['product_id']);
         } else {
             $d['prod_id'] = array_merge($d['prod_id'], array($d['product_id']));
         }
     }
     //Check to see if a prod_id has been set
     if (!isset($d["prod_id"])) {
         return true;
     }
     $multiple_products = sizeof($d["prod_id"]);
     //Iterate through the prod_id's and perform an add to cart for each one
     for ($ikey = 0; $ikey < $multiple_products; $ikey++) {
         // Create single array from multi array
         $key_fields = array_keys($d);
         foreach ($key_fields as $key) {
             if (is_array($d[$key])) {
                 $e[$key] = @$d[$key][$ikey];
             } else {
                 $e[$key] = $d[$key];
             }
         }
         if ($multiple_products > 1) {
             $func = "cartUpdate";
         }
         $e['product_id'] = $d['product_id'];
         $e['Itemid'] = $d['Itemid'];
         if (is_array($d["prod_id"])) {
             $product_id = $d["prod_id"][$ikey];
         } else {
             $product_id = $e["prod_id"];
         }
         if (is_array($d["quantity"])) {
             $quantity = @$d['quantity'][$ikey];
         } else {
             $quantity = @$e['quantity'];
         }
         // Check for negative quantity
         if ($quantity < 0) {
             vmRequest::setVar('product_id', $product_id);
             $vmLogger->warning($VM_LANG->_('PHPSHOP_CART_ERROR_NO_NEGATIVE', false));
             return False;
         }
         if (!is_numeric($quantity)) {
             vmRequest::setVar('product_id', $product_id);
             $vmLogger->warning($VM_LANG->_('PHPSHOP_CART_ERROR_NO_VALID_QUANTITY', false));
             return False;
         }
         $quantity = intval($quantity);
         // Check to see if checking stock quantity
         if (CHECK_STOCK) {
             $product_in_stock = ps_product::get_field($product_id, 'product_in_stock');
             if (empty($product_in_stock)) {
                 $product_in_stock = 0;
             }
             if ($quantity > $product_in_stock) {
                 //Create an array for out of stock items and continue to next item
                 $request_stock[$ci]['product_id'] = $product_id;
                 $request_stock[$ci]['quantity'] = $quantity;
                 $ci++;
                 continue;
             }
         }
         // Check if product exists and is published
         if (!ps_product::product_exists($product_id)) {
             $vmLogger->tip($VM_LANG->_('VM_CART_PRODUCT_NOTEXIST', false));
             return false;
         }
         // Quick add of item
         $q = "SELECT product_id FROM #__{vm}_product WHERE ";
         $q .= "product_parent_id = " . (int) $product_id;
         $db->query($q);
         if ($db->num_rows()) {
             vmRequest::setVar('product_id', $e["product_id"]);
             $vmLogger->tip($VM_LANG->_('PHPSHOP_CART_SELECT_ITEM', false));
             $_REQUEST['flypage'] = ps_product::get_flypage($e["product_id"]);
             $GLOBALS['page'] = 'shop.product_details';
             return true;
         }
//.........这里部分代码省略.........
开发者ID:rafarubert,项目名称:megafiltros,代码行数:101,代码来源:ps_cart.php


注:本文中的vmRequest::setVar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。