Exemple #1
0
 /**
  * Validates the input parameters onBeforeUserAdd
  *
  * @param array $d
  * @return boolean
  */
 function validate_add(&$d)
 {
     global $my, $perm, $vmLogger, $VM_LANG;
     $db = new ps_DB();
     $valid = true;
     $missing = "";
     require_once CLASSPATH . 'ps_userfield.php';
     $requiredFields = ps_userfield::getUserFields('registration', true);
     $skipFields = array('username', 'password', 'password2', 'email', 'agreed');
     foreach ($requiredFields as $field) {
         if (in_array($field->name, $skipFields)) {
             continue;
         }
         switch ($field->type) {
             case 'age_verification':
                 // The Age Verification here is just a simple check if the selected date
                 // is a birthday older than the minimum age (default: 18)
                 $d[$field->name] = vmRequest::getInt('birthday_selector_year') . '-' . vmRequest::getInt('birthday_selector_month') . '-' . vmRequest::getInt('birthday_selector_day');
                 break;
             default:
                 if (empty($d[$field->name]) && $field->sys == 1) {
                     $valid = false;
                     $fieldtitle = $field->title;
                     if ($VM_LANG->exists($fieldtitle)) {
                         $fieldtitle = $VM_LANG->_($fieldtitle);
                     }
                     $vmLogger->err(sprintf($VM_LANG->_('VM_USER_ERR_MISSINGVALUE'), $fieldtitle));
                 }
                 break;
         }
     }
     $d['user_email'] = @$d['email'];
     if (!$d['perms']) {
         $vmLogger->warning($VM_LANG->_('VM_USER_ERR_GROUP'));
         $valid = false;
     } else {
         if (!$perm->hasHigherPerms($d['perms'])) {
             $vmLogger->err(sprintf($VM_LANG->_('VM_USER_ADD_ERR_NOPERMS'), $d['perms']));
             $valid = false;
         }
     }
     return $valid;
 }
* VirtueMart is free software. This version may have been modified pursuant
* 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 . 'ps_product.php';
$ps_product = new ps_product();
$Itemid = $sess->getShopItemid();
global $vendor_currency, $user;
// Order_id is returned by checkoutComplete function
$order_id = $db->getEscaped(vmGet($vars, 'order_id'));
$print = vmRequest::getInt('print', 0);
/** Retrieve User Email **/
$q = "SELECT * FROM `#__{vm}_order_user_info` WHERE `order_id`='{$order_id}' AND `address_type`='BT'";
$db->query($q);
$db->next_record();
$old_user = '';
if (!empty($user) && is_object($user)) {
    $old_user = $user;
}
$user = $db->record[0];
$dbbt = $db->_clone($db);
$user->email = $db->f("user_email");
/** Retrieve Order & Payment Info **/
$db = new ps_DB();
$q = "SELECT * FROM (`#__{vm}_order_payment` LEFT JOIN `#__{vm}_payment_method` ";
$q .= "ON `#__{vm}_payment_method`.`payment_method_id`  = `#__{vm}_order_payment`.`payment_method_id`), `#__{vm}_orders` ";
		// so we don't have to make safe if ">" is found
		if (strpos($v,">")===false) {
			$v = shopMakeHtmlSafe($v);
		}
		if( $k == 3 ) {
			echo $CURRENCY_DISPLAY->getFullValue( $v )."; ";
		} elseif( $k > 0 && $k < 4) {
			echo $v.'; ';
		}
	}
	echo "</td></tr>";
}

unset( $row );
if( !isset($order_total) || $order_total > 0.00 ) {
	$payment_method_id = vmRequest::getInt( 'payment_method_id' );
	
	$db->query("SELECT payment_method_id, payment_method_name FROM #__{vm}_payment_method WHERE payment_method_id='$payment_method_id'");
	$db->next_record();
	echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYMENT_LBL') . ":</strong></td>";
	echo '<td>';
	echo $db->f("payment_method_name");
	echo "</td></tr>";
}
echo '</table>';
?>
<br />
<div>
    <?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_CUSTOMER_NOTE') ?>:<br />
    <textarea title="<?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_CUSTOMER_NOTE') ?>" cols="50" rows="5" name="customer_note"></textarea>
    <br /><br />
Exemple #4
0
 function featuredProducts($random, $products, $categories)
 {
     global $VM_LANG;
     require_once CLASSPATH . 'ps_product_attribute.php';
     $ps_product_attribute = new ps_product_attribute();
     $db = new ps_DB();
     $tpl = new $GLOBALS['VM_THEMECLASS']();
     $category_id = null;
     if ($categories) {
         $category_id = vmRequest::getInt('category_id');
     }
     if ($category_id) {
         $q = "SELECT DISTINCT product_sku,#__{vm}_product.product_id,product_name,product_s_desc,product_thumb_image, product_full_image, product_in_stock, product_url FROM #__{vm}_product, #__{vm}_product_category_xref, #__{vm}_category WHERE \n";
         $q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') \n";
         $q .= "AND #__{vm}_product.product_id=#__{vm}_product_category_xref.product_id \n";
         $q .= "AND #__{vm}_category.category_id=#__{vm}_product_category_xref.category_id \n";
         $q .= "AND #__{vm}_category.category_id='{$category_id}' \n";
         $q .= "AND #__{vm}_product.product_publish='Y' \n";
         $q .= "AND #__{vm}_product.product_special='Y' \n";
         if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
             $q .= " AND product_in_stock > 0 \n";
         }
         $q .= 'ORDER BY RAND() LIMIT 0, ' . (int) $products;
     } else {
         $q = "SELECT DISTINCT product_sku,product_id,product_name,product_s_desc,product_thumb_image, product_full_image, product_in_stock, product_url FROM #__{vm}_product WHERE ";
         $q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') AND vendor_id='" . $_SESSION['ps_vendor_id'] . "' ";
         $q .= "AND #__{vm}_product.product_publish='Y' ";
         $q .= "AND #__{vm}_product.product_special='Y' ";
         if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
             $q .= " AND product_in_stock > 0 ";
         }
         $q .= 'ORDER BY RAND() LIMIT 0, ' . (int) $products;
     }
     $db->query($q);
     // Output using template
     if ($db->num_rows() > 0) {
         $i = 0;
         $featured_products = array();
         while ($db->next_record()) {
             $flypage = $this->get_flypage($db->f("product_id"));
             $featured_products[$i]['product_sku'] = $db->f("product_sku");
             $featured_products[$i]['product_name'] = $db->f("product_name");
             $price = "";
             if (_SHOW_PRICES == '1') {
                 // Show price, but without "including X% tax"
                 $price = $this->show_price($db->f("product_id"), false);
             }
             $featured_products[$i]['product_price'] = $price;
             $featured_products[$i]['product_s_desc'] = $db->f("product_s_desc");
             $featured_products[$i]['product_url'] = $db->f("product_url");
             $featured_products[$i]['product_thumb'] = $db->f("product_thumb_image");
             $featured_products[$i]['product_full_image'] = $db->f("product_full_image");
             $featured_products[$i]['product_id'] = $db->f("product_id");
             $featured_products[$i]['flypage'] = $flypage;
             $featured_products[$i]['form_addtocart'] = "";
             if (USE_AS_CATALOGUE != '1' && $price != "" && !stristr($price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL')) && !$this->product_has_attributes($db->f('product_id'), true) && $tpl->get_cfg('showAddtocartButtonOnProductList')) {
                 $tpl->set('i', $i);
                 $tpl->set('product_id', $db->f('product_id'));
                 $tpl->set('ps_product_attribute', $ps_product_attribute);
                 $tpl->set('product_in_stock', $db->f('product_in_stock'));
                 $featured_products[$i]['form_addtocart'] = $tpl->fetch('browse/includes/addtocart_form.tpl.php');
                 $featured_products[$i]['has_addtocart'] = true;
             }
             $i++;
         }
         $tpl->set('featured_products', $featured_products);
         return $tpl->fetch('common/featuredProducts.tpl.php');
     }
 }
Exemple #5
0
                $itemid = '&Itemid=' . $sess->getShopItemid();
                if ($ibg != 0) {
                    $mymenu_content .= ",";
                }
                $mymenu_content .= "\n[ '<img src=\"' + ctThemeXPBase + 'darrow.png\" alt=\"arr\" />','" . $db->f("category_name", false) . "','" . sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $db->f("category_id") . $itemid) . "',null,'" . $db->f("category_name", false) . "'\n ";
                $ibg++;
                /* recurse through the subcategories */
                $this->traverse_tree_down($mymenu_content, $db->f("category_child_id"), $level);
                /* let's see if the loop has reached its end */
                $mymenu_content .= "]";
            }
        }
    }
}
$Itemid = vmRequest::getInt('Itemid');
$TreeId = vmRequest::getInt('TreeId');
if (vmIsJoomla('1.5')) {
    $js_src = 'modules/mod_virtuemart';
} else {
    $js_src = 'modules';
}
echo vmCommonHTML::scriptTag('', 'var ctThemeXPBase = "' . $js_src . '/ThemeXP/";');
if ($jscook_type == "tree") {
    if ($jscookTree_style == "ThemeXP") {
        $jscook_tree = "ctThemeXP1";
    }
    if ($jscookTree_style == "ThemeNavy") {
        $jscook_tree = "ctThemeNavy";
    }
    echo vmCommonHTML::scriptTag($js_src . '/JSCookTree.js');
    echo vmCommonHTML::linkTag($js_src . "/{$jscookTree_style}/theme.css");
 function getFirstLevelItem($mitem)
 {
     global $Itemid, $mosConfig_live_site, $mainframe, $sess;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $sess->getShopItemid();
             break;
     }
     $id = 'id="menu' . $mitem->id . '"';
     $mitem->link = vmAmpReplace($mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $this->parent->_params->get('class_sfx');
     // Active Menu highlighting
     $current_itemid = trim(vmRequest::getInt('Itemid'));
     if (in_array($mitem->id, $this->parent->open)) {
         $menuclass = 'mainlevel_active' . $this->parent->_params->get('class_sfx');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name;
             if ($this->parent->hasSubItems($mitem->id)) {
                 $txt .= '&nbsp;&nbsp;<img border="0" src="' . $this->parent->_params->get('LSPath') . '/img/tabarrow.gif" alt="arrow" />';
             }
             $txt .= '</a>';
             break;
     }
     if ($this->parent->_params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($this->parent->_params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }
Exemple #7
0
 /**
  * This is used by lists to show a "Delete this item" button in each row
  *
  * @param string $id_fieldname The name of the identifying field [example: product_id]
  * @param mixed $id The unique ID identifying the item that is to be deleted
  * @param string $func The name of the function that is used to delete the item [e.g. productDelete]
  * @param string $keyword The recent keyword [deprecated]
  * @param int $limitstart The recent limitstart value [deprecated]
  * @param string $extra Additional URL parameters to be appended to the link
  * @return A link with the delete button in it
  */
 function deleteButton($id_fieldname, $id, $func, $keyword = "", $limitstart = 0, $extra = "")
 {
     global $page, $sess, $VM_LANG;
     $no_menu = vmRequest::getInt('no_menu');
     $href = $sess->url($_SERVER['PHP_SELF'] . "?page={$page}&func={$func}&{$id_fieldname}={$id}&keyword=" . urlencode($keyword) . "&limitstart={$limitstart}&no_menu={$no_menu}" . $extra);
     $code = "<a class=\"toolbar\" href=\"{$href}\" onclick=\"return confirm('" . $VM_LANG->_('PHPSHOP_DELETE_MSG') . "');\" onmouseout=\"MM_swapImgRestore();\"  onmouseover=\"MM_swapImage('delete{$id}','','" . IMAGEURL . "ps_image/delete_f2.gif',1);\">";
     $code .= "<img src=\"" . IMAGEURL . "ps_image/delete.gif\" alt=\"Delete this record\" name=\"delete{$id}\" align=\"middle\" border=\"0\" />";
     $code .= "</a>";
     return $code;
 }
 /**
  * Updates a Vendor (and the Store) Record
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $vendor_currency, $VM_LANG;
     $db = new ps_DB();
     $timestamp = time();
     if (!$this->validate_update($d)) {
         return False;
     }
     if (!vmImageTools::process_images($d)) {
         return false;
     }
     foreach ($d as $key => $value) {
         if (!is_array($value)) {
             $d[$key] = addslashes($value);
         }
     }
     $d['display_style'][1] = ps_vendor::checkCurrencySymbol($d['display_style'][1]);
     $d['display_style'] = implode("|", $d['display_style']);
     if (empty($d['vendor_accepted_currencies'])) {
         $d['vendor_accepted_currencies'] = array($vendor_currency);
     }
     $fields = array('vendor_name' => $d["vendor_name"], 'contact_last_name' => $d["contact_last_name"], 'contact_first_name' => $d["contact_first_name"], 'contact_middle_name' => $d["contact_middle_name"], 'contact_title' => $d["contact_title"], 'contact_phone_1' => $d["contact_phone_1"], 'contact_phone_2' => $d["contact_phone_2"], 'contact_fax' => $d["contact_fax"], 'contact_email' => $d["contact_email"], 'vendor_phone' => $d["vendor_phone"], 'vendor_address_1' => $d["vendor_address_1"], 'vendor_address_2' => $d["vendor_address_2"], 'vendor_city' => $d["vendor_city"], 'vendor_state' => $d["vendor_state"], 'vendor_country' => $d["vendor_country"], 'vendor_zip' => $d["vendor_zip"], 'vendor_store_name' => $d["vendor_store_name"], 'vendor_store_desc' => $d["vendor_store_desc"], 'vendor_category_id' => vmRequest::getInt('vendor_category_id'), 'vendor_image_path' => vmGet($d, 'vendor_image_path'), 'vendor_thumb_image' => vmGet($d, 'vendor_thumb_image'), 'vendor_full_image' => vmGet($d, 'vendor_full_image'), 'vendor_currency' => $d["vendor_currency"], 'vendor_url' => $d["vendor_url"], 'mdate' => $timestamp, 'vendor_terms_of_service' => $d["vendor_terms_of_service"], 'vendor_min_pov' => $d["vendor_min_pov"], 'vendor_currency_display_style' => $d["display_style"], 'vendor_freeshipping' => $d['vendor_freeshipping'], 'vendor_accepted_currencies' => implode(',', $d['vendor_accepted_currencies']), 'vendor_address_format' => $d['vendor_address_format'], 'vendor_date_format' => $d['vendor_date_format']);
     if (!empty($d["vendor_category_id"])) {
         $fields['vendor_category_id'] = $d["vendor_category_id"];
     }
     if (!empty($d["vendor_image_path"])) {
         $fields['vendor_image_path'] = $d["vendor_image_path"];
     }
     $db->buildQuery('UPDATE', '#__{vm}_vendor', $fields, 'WHERE vendor_id = ' . $d["vendor_id"]);
     $db->query();
     if ($d['vendor_id'] == 1) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_STORE_UPDATED'));
     } else {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_VENDOR_UPDATED'));
     }
     return True;
 }
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* 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
*
* This file is included by the virtuemart module and product categories module if the module parameter
* MenuType is set to tigratree
**/
mm_showMyFileName(__FILE__);
global $sess, $mosConfig_live_site;
// Decide which node to open (if any)
$Treeid = vmRequest::getInt('Treeid');
// Get the root label
$root_label = $params->get('root_label', $VM_LANG->_('PHPSHOP_STORE_MOD'));
// Get the ps_product_category class
require_once CLASSPATH . 'ps_product_category.php';
if (!isset($ps_product_category)) {
    $ps_product_category = new ps_product_category();
}
// The tree generator
$vmTigraTree = new vmTigraTreeMenu();
// A unique name for our tree (to support multiple instances of the menu)
$varname = uniqid("TigraTree_");
// Get necessary scripts
if (vmIsJoomla('1.5')) {
    $js_src = $mosConfig_live_site . '/modules/mod_virtuemart';
} else {
 /**
  * Updates information about a core module
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $db, $VM_LANG;
     $timestamp = time();
     if (!$this->validate_update($d)) {
         $d['error'] = $this->error;
         return False;
     }
     if (is_array($d['module_perms'])) {
         $d['module_perms'] = implode(',', $d['module_perms']);
     }
     $fields = array('module_name' => vmGet($d, 'module_name'), 'module_perms' => vmGet($d, 'module_perms'), 'module_description' => vmGet($d, 'module_description'), 'module_publish' => vmGet($d, 'module_publish'), 'list_order' => vmRequest::getInt('list_order'));
     $db->buildQuery('UPDATE', '#__{vm}_module', $fields, ' WHERE module_id=' . intval($d['module_id']));
     if ($db->query() !== false) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_MODULE_UPDATED'));
         return True;
     }
     return false;
 }
 /**
  * Updates a product price
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $vmLogger, $VM_LANG;
     if (!$this->validate($d)) {
         return false;
     }
     if ($d["product_price"] === '') {
         return $this->delete($d);
     }
     $timestamp = time();
     $db = new ps_DB();
     if (empty($d["product_price_vdate"])) {
         $d["product_price_vdate"] = '';
     }
     if (empty($d["product_price_edate"])) {
         $d["product_price_edate"] = '';
     }
     $fields = array('shopper_group_id' => vmRequest::getInt('shopper_group_id'), 'product_price' => vmRequest::getFloat('product_price'), 'product_currency' => vmGet($d, 'product_currency'), 'product_price_vdate' => vmGet($d, 'product_price_vdate'), 'product_price_edate' => vmGet($d, 'product_price_edate'), 'mdate' => $timestamp, 'price_quantity_start' => vmRequest::getInt('price_quantity_start'), 'price_quantity_end' => vmRequest::getInt('price_quantity_end'));
     $db = new ps_DB();
     $db->buildQuery('UPDATE', '#__{vm}_product_price', $fields, 'WHERE product_price_id=' . (int) $d["product_price_id"]);
     if ($db->query() !== false) {
         $vmLogger->info($VM_LANG->_('VM_PRODUCT_PRICE_UPDATED', false));
         return true;
     }
     $vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_UPDATING_FAILED', false));
     return false;
 }
Exemple #12
0
    /**
     * This allows us to print the user fields on
     * the various sections of the shop
     *
     * @param array $rowFields An array returned from ps_database::loadObjectlist
     * @param array $skipFields A one-dimensional array holding the names of fields that should NOT be displayed
     * @param ps_DB $db A ps_DB object holding ovalues for the fields
     * @param boolean $startform If true, print the starting <form...> tag
     */
    function listUserFields($rowFields, $skipFields = array(), $db = null, $startForm = true)
    {
        global $mm_action_url, $ps_html, $VM_LANG, $my, $default, $mainframe, $vm_mainframe, $vendor_country_3_code, $mosConfig_live_site, $mosConfig_absolute_path, $page;
        $dbf = new ps_DB();
        if ($db === null) {
            $db = new ps_DB();
        }
        $default['country'] = $vendor_country_3_code;
        $missing = vmGet($_REQUEST, 'missing', '');
        // collect all required fields
        $required_fields = array();
        foreach ($rowFields as $field) {
            if ($field->required == 1) {
                $required_fields[$field->name] = $field->type;
            }
            $allfields[$field->name] = $field->name;
        }
        foreach ($skipFields as $skip) {
            unset($required_fields[$skip]);
        }
        // Form validation function
        if (!vmIsAdminMode()) {
            ps_userfield::printJS_formvalidation($required_fields, $rowFields);
        } else {
            echo vmCommonHTML::scriptTag('', 'function submitregistration() { return true }');
        }
        if (file_exists($mosConfig_absolute_path . '/includes/js/mambojavascript.js')) {
            $vm_mainframe->addScript('includes/js/mambojavascript.js');
        }
        if ($startForm) {
            echo '<form action="' . $mm_action_url . basename($_SERVER['PHP_SELF']) . '" method="post" name="adminForm">';
        }
        echo '
		<div style="width:90%;">';
        if (!empty($required_fields)) {
            echo '<div style="padding:5px;text-align:center;"><strong>(* = ' . $VM_LANG->_('CMN_REQUIRED') . ')</strong></div>';
        }
        $delimiter = 0;
        foreach ($rowFields as $field) {
            if (!isset($default[$field->name])) {
                $default[$field->name] = $field->default;
            }
            $readonly = $field->readonly ? ' readonly="readonly"' : '';
            if (in_array($field->name, $skipFields)) {
                continue;
            }
            // Title handling.
            $key = $field->title;
            if ($key[0] == '_') {
                $key = substr($key, 1, strlen($key) - 1);
            }
            if ($VM_LANG->exists($key)) {
                $field->title = $VM_LANG->_($key);
            }
            if ($field->name == 'agreed') {
                $field->title = '<script type="text/javascript">//<![CDATA[
				document.write(\'<label for="agreed_field">' . str_replace("'", "\\'", $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS')) . '</label><a href="javascript:void window.open(\\\'' . $mosConfig_live_site . '/index2.php?option=com_virtuemart&page=shop.tos&pop=1\\\', \\\'win2\\\', \\\'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no\\\');">\');
				document.write(\' (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')</a>\');
				//]]></script>
				<noscript>
					<label for="agreed_field">' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '</label>
					<a target="_blank" href="' . $mosConfig_live_site . '/index.php?option=com_virtuemart&amp;page=shop.tos" title="' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '">
					 (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')
					</a></noscript>';
            }
            if ($field->name == 'username' && VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') {
                echo '<div class="formLabel">
						<input type="checkbox" id="register_account" name="register_account" value="1" class="inputbox" onchange="showFields( this.checked, new Array(\'username\', \'password\', \'password2\') );if( this.checked ) { document.adminForm.remember.value=\'yes\'; } else { document.adminForm.remember.value=\'yes\'; }" checked="checked" />
					</div>
					<div class="formField">
						<label for="register_account">' . $VM_LANG->_('VM_REGISTER_ACCOUNT') . '</label>
					</div>
					';
            } elseif ($field->name == 'username') {
                echo '<input type="hidden" id="register_account" name="register_account" value="1" />';
            }
            // a delimiter marks the beginning of a new fieldset and
            // the end of a previous fieldset
            if ($field->type == 'delimiter') {
                if ($delimiter > 0) {
                    echo "</fieldset>\n";
                }
                if (VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' && $field->title == $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_INFO_LBL') && $page == 'checkout.index') {
                    continue;
                }
                echo '<fieldset>
				     <legend class="sectiontableheader">' . $field->title . '</legend>
';
                $delimiter++;
                continue;
            }
            echo '<div id="' . $field->name . '_div" class="formLabel ';
            if (stristr($missing, $field->name)) {
                echo 'missing';
            }
            echo '">';
            echo '<label for="' . $field->name . '_field">' . $field->title . '</label>';
            if (isset($required_fields[$field->name])) {
                echo '<strong>* </strong>';
            }
            echo ' </div>
	      <div class="formField" id="' . $field->name . '_input">' . "\n";
            /**
             * This is the most important part of this file
             * Here we print the field & its contents!
             */
            switch ($field->name) {
                case 'title':
                    $ps_html->list_user_title($db->sf('title'), "id=\"title_field\"");
                    break;
                case 'country':
                    if (in_array('state', $allfields)) {
                        $onchange = "onchange=\"changeStateList();\"";
                    } else {
                        $onchange = "";
                    }
                    $ps_html->list_country("country", $db->sf('country'), "id=\"country_field\" {$onchange}");
                    break;
                case 'state':
                    echo $ps_html->dynamic_state_lists("country", "state", $db->sf('country'), $db->sf('state'));
                    echo "<noscript>\n";
                    $ps_html->list_states("state", $db->sf('state'), "", "id=\"state_field\"");
                    echo "</noscript>\n";
                    break;
                case 'agreed':
                    echo '<input type="checkbox" id="agreed_field" name="agreed" value="1" class="inputbox" />';
                    break;
                case 'password':
                case 'password2':
                    echo '<input type="password" id="' . $field->name . '_field" name="' . $field->name . '" size="30" class="inputbox" />' . "\n";
                    break;
                default:
                    switch ($field->type) {
                        case 'date':
                            echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/calendar.js');
                            if (vmIsJoomla('1.5', '>=')) {
                                // in Joomla 1.5, the name of calendar lang file is changed...
                                echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en-GB.js');
                            } else {
                                echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en.js');
                            }
                            echo vmCommonHTML::linkTag($mosConfig_live_site . '/includes/js/calendar/calendar-mos.css');
                            $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
                            echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
                            echo '<input name="reset" type="reset" class="button" onclick="return showCalendar(\'' . $field->name . '_field\', \'y-mm-dd\');" value="..." />';
                            break;
                        case 'text':
                        case 'emailaddress':
                        case 'webaddress':
                        case 'euvatid':
                            $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
                            echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
                            break;
                        case 'textarea':
                            echo '<textarea name="' . $field->name . '" id="' . $field->name . '_field" cols="' . $field->cols . '" rows="' . $field->rows . '" ' . $readonly . '>' . $db->sf($field->name) . '</textarea>';
                            break;
                        case 'editorta':
                            editorArea($field->name, $db->sf($field->name), $field->name, '300', '150', $field->cols, $field->rows);
                            break;
                        case 'checkbox':
                            echo '<input type="checkbox" name="' . $field->name . '" id="' . $field->name . '_field" value="1" ' . ($db->sf($field->name) ? 'checked="checked"' : '') . '/>';
                            break;
                        case 'age_verification':
                            $year = vmRequest::getInt('birthday_selector_year', date('Y'));
                            if ($db->f($field->name)) {
                                $birthday = $db->f($field->name);
                                $date_array = explode('-', $birthday);
                                $year = $date_array[0];
                                $month = $date_array[1];
                                $day = $date_array[2];
                            }
                            ps_html::list_days('birthday_selector_day', vmRequest::getInt('birthday_selector_day', @$day));
                            ps_html::list_month('birthday_selector_month', vmRequest::getInt('birthday_selector_month', @$month));
                            ps_html::list_year('birthday_selector_year', $year, $year - 100, $year);
                            break;
                        case 'captcha':
                            if (file_exists($mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php')) {
                                include $mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php';
                                // Note that this package name must be used on the validation side too! If both are not equal, validation will fail
                                $packageName = 'securityVMRegistrationCheck';
                                echo insertSecurityImage($packageName);
                                echo getSecurityImageText($packageName);
                            } else {
                                if (file_exists($mosConfig_absolute_path . '/plugins/system/securityimages.php')) {
                                    echo "<script type=\"text/javascript\" src=\"" . JURI::root() . "/components/com_securityimages/js/securityImages.js\"></script>";
                                    echo "<img id='captchaSecurityImages' name='captchaSecurityImages' src=\"" . JURI::root() . "/index.php?option=com_securityimages&task=displayCaptcha\" />";
                                    echo "<a href=\"javascript:askNewSecurityImages('captchaSecurityImages');\">";
                                    echo "<img src=\"" . JURI::root() . "/components/com_securityimages/buttons/reload.gif\" id=\"securityImagesContactCaptchaReload\" name=\"securityImagesContactCaptchaReload\" border=\"0\">";
                                    echo "</a>";
                                    echo "<input type=\"text\" name=\"securityVMRegistrationCheck_try\" />";
                                }
                            }
                            break;
                            // Begin of a fallthrough
                        // Begin of a fallthrough
                        case 'multicheckbox':
                        case 'select':
                        case 'multiselect':
                        case 'radio':
                            $k = $db->f($field->name);
                            $dbf->setQuery("SELECT fieldtitle,fieldvalue FROM #__{vm}_userfield_values" . "\n WHERE fieldid = " . $field->fieldid . "\n ORDER BY ordering");
                            $Values = $dbf->loadObjectList();
                            $multi = "";
                            $rowFieldValues['lst_' . $field->name] = '';
                            if ($field->type == 'multiselect') {
                                $multi = "multiple='multiple'";
                            }
                            if (count($Values) > 0) {
                                if ($field->type == 'radio') {
                                    $rowFieldValues['lst_' . $field->name] = vmCommonHTML::radioListTable($Values, $field->name, 'class="inputbox" size="1" ', 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required);
                                } else {
                                    $ks = explode("|*|", $k);
                                    $k = array();
                                    foreach ($ks as $kv) {
                                        $k[]->fieldvalue = $kv;
                                    }
                                    if ($field->type == 'multicheckbox') {
                                        $rowFieldValues['lst_' . $field->name] = vmCommonHTML::checkboxListTable($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required);
                                    } else {
                                        $rowFieldValues['lst_' . $field->name] = vmCommonHTML::selectList($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k);
                                    }
                                }
                            }
                            // no break! still a fallthrough
                            echo $rowFieldValues['lst_' . $field->name];
                            break;
                    }
                    break;
            }
            if ($field->description != '') {
                echo vmToolTip($field->description);
            }
            echo '<br /></div>
				      <br style="clear:both;" />';
        }
        if ($delimiter > 0) {
            echo "</fieldset>\n";
        }
        echo '</div>';
        if (VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') {
            echo '<script type="text/javascript">
		   function showFields( show, fields ) {
		   	if( fields ) {
		   		for (i=0; i<fields.length;i++) {
		   			if( show ) {
		   				document.getElementById( fields[i] + \'_div\' ).style.display = \'\';
		   				document.getElementById( fields[i] + \'_input\' ).style.display = \'\';
		   			} else {
		   				document.getElementById( fields[i] + \'_div\' ).style.display = \'none\';
		   				document.getElementById( fields[i] + \'_input\' ).style.display = \'none\';
		   			}
		   		}
		   	}
		   }
		   try {
		   	showFields( document.getElementById( \'register_account\').checked, new Array(\'username\', \'password\', \'password2\') );
		   } catch(e){}
		   </script>';
        }
    }
 /**
  * updates Parameter information
  * @author Zdenek Dvorak
  * @param array $d
  * @return boolean
  */
 function update_parameter(&$d)
 {
     $db = new ps_DB();
     if ($this->validate_update_parameter($d)) {
         if ($d["parameter_old_type"] == "B") {
             // delete record and call add_parameter()
             $q = "DELETE FROM #__{vm}_product_type_parameter WHERE product_type_id='" . $d["product_type_id"] . "' ";
             $q .= "AND parameter_name='" . $db->getEscaped(vmGet($d, 'parameter_name')) . "'";
             $db->setQuery($q);
             $db->query();
             return $this->add_parameter($d);
         }
         // added for custom parameter modification
         // strips the trailing semi-colon from an values
         if (';' == substr($d["parameter_values"], strlen($d["parameter_values"]) - 1, 1)) {
             $d["parameter_values"] = substr($d["parameter_values"], 0, strlen($d["parameter_values"]) - 1);
         }
         if (empty($d["parameter_multiselect"])) {
             $d["parameter_multiselect"] = "N";
         }
         // delete "\n" from field parameter_description
         $d["parameter_description"] = str_replace("\r\n", "", $d["parameter_description"]);
         $d["parameter_description"] = str_replace("\n", "", $d["parameter_description"]);
         $fields = array('parameter_name' => vmGet($d, 'parameter_name'), 'parameter_label' => vmGet($d, 'parameter_label'), 'parameter_description' => vmGet($d, 'parameter_description'), 'parameter_list_order' => vmRequest::getInt('list_order'), 'parameter_type' => vmGet($d, 'parameter_type'), 'parameter_values' => vmGet($d, 'parameter_values'), 'parameter_multiselect' => vmGet($d, 'parameter_multiselect'), 'parameter_default' => vmGet($d, 'parameter_default'), 'parameter_unit' => vmGet($d, 'parameter_unit'));
         $db->buildQuery('UPDATE', '#__{vm}_product_type_parameter', $fields, "WHERE `product_type_id`='" . $d["product_type_id"] . "' AND `parameter_name`='" . $db->getEscaped(vmGet($d, 'parameter_old_name')) . "'");
         $db->query();
         /* Re-Order the Parameter table IF the list_order has been changed */
         if (intval($d['list_order']) != intval($d['currentpos'])) {
             $dbu = new ps_DB();
             /* Moved UP in the list order */
             if (intval($d['list_order']) < intval($d['currentpos'])) {
                 $q = "SELECT product_type_id,parameter_name FROM #__{vm}_product_type_parameter WHERE ";
                 $q .= "product_type_id=' " . $d["product_type_id"];
                 $q .= "' AND parameter_name <> '" . $db->getEscaped(vmGet($d, 'parameter_name'));
                 $q .= "' AND parameter_list_order >= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type_parameter SET parameter_list_order=parameter_list_order+1 WHERE product_type_id='" . $db->f("product_type_id") . "' AND parameter_name='" . $db->f("parameter_name") . "'");
                 }
             } else {
                 $q = "SELECT product_type_id,parameter_name FROM #__{vm}_product_type_parameter WHERE ";
                 $q .= "product_type_id='" . $d["product_type_id"];
                 $q .= "' AND parameter_name <> '" . $db->getEscaped(vmGet($d, 'parameter_name'));
                 $q .= "' AND parameter_list_order > '" . intval($d["currentpos"]);
                 $q .= "' AND parameter_list_order <= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type_parameter SET parameter_list_order=parameter_list_order-1 WHERE product_type_id='" . $db->f("product_type_id") . "' AND parameter_name='" . $db->f("parameter_name") . "'");
                 }
             }
         }
         /* END Re-Ordering */
         if ($d["parameter_type"] != "B") {
             // != Break Line
             // Delete old index
             $q = "ALTER TABLE `#__{vm}_product_type_";
             $q .= $d["product_type_id"] . "` DROP INDEX `idx_product_type_" . $d["product_type_id"] . "_";
             $q .= $db->getEscaped(vmGet($d, 'parameter_old_name')) . "`;";
             $db->setQuery($q);
             $db->query();
             // Update column in table product_type_<id>
             $q = "ALTER TABLE `#__{vm}_product_type_";
             $q .= $d["product_type_id"] . "` CHANGE `";
             $q .= $db->getEscaped(vmGet($d, 'parameter_old_name')) . "` `";
             $q .= $db->getEscaped(vmGet($d, 'parameter_name')) . "` ";
             switch ($d["parameter_type"]) {
                 case "I":
                     $q .= "int(11) ";
                     break;
                     // Integer
                 // Integer
                 case "T":
                     $q .= "text ";
                     break;
                     // Text
                 // Text
                 case "S":
                     $q .= "varchar(255) ";
                     break;
                     // Short Text
                 // Short Text
                 case "F":
                     $q .= "float ";
                     break;
                     // Float
                 // Float
                 case "C":
                     $q .= "char(1) ";
                     break;
                     // Char
                 // Char
                 case "D":
                     $q .= "datetime ";
                     break;
                     // Date & Time
                 // Date & Time
                 case "A":
                     $q .= "date ";
                     break;
                     // Date
                 // Date
                 case "V":
                     $q .= "varchar(255) ";
                     break;
                     // Multiple Value
                 // Multiple Value
                 case "M":
                     $q .= "time ";
                     break;
                     // Time
                 // Time
                 default:
                     $q .= "varchar(255) ";
                     // Default type Short Text
             }
             if ($d["parameter_default"] != "" && $d["parameter_type"] != "T") {
                 $q .= "DEFAULT '" . $db->getEscaped(vmGet($d, 'parameter_default')) . "' NOT NULL;";
             }
             $db->setQuery($q);
             $db->query();
             // Make index for this column
             if ($d["parameter_type"] == "T") {
                 $q = "ALTER TABLE `#__{vm}_product_type_";
                 $q .= $d["product_type_id"] . "` ADD FULLTEXT `idx_product_type_" . $d["product_type_id"] . "_";
                 $q .= $d["parameter_name"] . "` (`" . $db->getEscaped(vmGet($d, 'parameter_name')) . "`);";
                 $db->setQuery($q);
                 $db->query();
             } else {
                 $q = "ALTER TABLE `#__{vm}_product_type_";
                 $q .= $d["product_type_id"] . "` ADD KEY `idx_product_type_" . $d["product_type_id"] . "_";
                 $q .= $db->getEscaped(vmGet($d, 'parameter_name')) . "` (`" . $db->getEscaped(vmGet($d, 'parameter_name')) . "`);";
                 $db->setQuery($q);
                 $db->query();
             }
         }
         return True;
     } else {
         return False;
     }
 }
 /**
  * updates the affiliate details
  * @author SP Bridgewater
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     $db = new ps_DB();
     $fields = array('rate' => $d['rate'], 'active' => $d["active"] == 'on' ? 'Y' : 'N');
     $db->buildQuery('UPDATE', '#__{vm}_affiliate', $fields, 'WHERE affiliate_id =\'' . vmRequest::getInt('affiliate_id') . '\'');
     return $db->query();
 }
    /**
     * The function to handle all default page situations
     * not responsible for lists!
     */
    function FORMS_MENU_SAVE_CANCEL()
    {
        global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $VM_LANG, $product_id, $page, $limitstart, $mosConfig_editor, $vmIcons;
        $bar =& JToolBar::getInstance('toolbar');
        $product_id = vmGet($_REQUEST, 'product_id', 0);
        $no_menu = vmGet($_REQUEST, 'no_menu', 0);
        $is_iframe = vmGet($_REQUEST, 'is_iframe', 0);
        $product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0);
        $script = '';
        $clone_product = vmRequest::getInt('clone_product', 0);
        if (is_array($product_id)) {
            $product_id = "";
        }
        // These editor arrays tell the toolbar to load correct "getEditorContents" script parts
        // This is necessary for WYSIWYG Editors like TinyMCE / mosCE / FCKEditor
        $editor1_array = array('product.product_form' => 'product_desc', 'shopper.shopper_group_form' => 'shopper_group_desc', 'product.product_category_form' => 'category_description', 'manufacturer.manufacturer_form' => 'mf_desc', 'store.store_form' => 'vendor_store_desc', 'product.product_type_parameter_form' => 'parameter_description', 'product.product_type_form' => 'product_type_description', 'vendor.vendor_form' => 'vendor_store_desc');
        $editor2_array = array('store.store_form' => 'vendor_terms_of_service', 'vendor.vendor_form' => 'vendor_terms_of_service');
        $editor1 = isset($editor1_array[$page]) ? $editor1_array[$page] : '';
        $editor2 = isset($editor2_array[$page]) ? $editor2_array[$page] : '';
        if ($no_menu) {
            vmCommonHTML::loadExtjs();
        }
        $script .= '<script type="text/javascript">
        	function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == \'cancel\') {
				submitform( pressbutton );
				return;
			}
			';
        if ($editor1 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor1);
                }
            } else {
                ob_start();
                getEditorContents('editor1', $editor1);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($editor2 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor2);
                }
            } else {
                ob_start();
                getEditorContents('editor2', $editor2);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($no_menu) {
            $admin = defined('_VM_IS_BACKEND') ? '/administrator' : '';
            $script .= "\n\t\t\t\n    // define some private variables\n    var dialog, showBtn;\n\n   // the second argument is true to indicate file upload.\n   YAHOO.util.Connect.setForm(form, true);\n   \n    var showDialog = function( content ) {\n    \tExt.MessageBox.show( { \n            \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\n            \t\tmsg: content,\n            \t\tautoCreate: true,\n                    width:400,\n                    height:180,\n                    modal: false,\n                    resizable: false,\n                    buttons: Ext.MessageBox.OK,\n                    shadow:true,\n                    animEl:Ext.get( 'vm-toolbar' )\n            });\n        setTimeout('Ext.MessageBox.hide()', 3000);\n    };\n    \n    // return a public interface\n    var callback = {\n    \tsuccess: function(o) {\n    \t\t//Ext.DomHelper.insertHtml( document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n    \t},\n    \tfailure: function(o) {\n    \t\tExt.DomHelper.append( document.body, { tag: 'div', id: 'vmLogResult', html: 'Save action failed: ' + o.statusText } );\n    \t\tshowDialog( o.responseText );\n    \t},\n        upload : function(o){\n            //Ext.DomHelper.insertHtml( 'beforeEnd', document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n        }\n    };\n    \n   \tvar cObj = YAHOO.util.Connect.asyncRequest('POST', '{$_SERVER['PHP_SELF']}', callback);\n\t\n\t\t\t\n";
        } else {
            $script .= "\n\t\t\tsubmitform( pressbutton );\n";
        }
        $script .= "\t\t}\n\t\t</script>";
        $bar->appendButton('Custom', $script);
        vmMenuBar::startTable();
        if ($page == "product.product_form" && !empty($product_id) && $clone_product != 1) {
            if (empty($product_parent_id)) {
                // add new attribute
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_attribute_form&product_id=" . $product_id . "&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            } else {
                // back to parent product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_RETURN_LBL');
                vmMenuBar::customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt);
                vmMenuBar::spacer();
                // new child product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ADD_ANOTHER_ITEM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            // Go to Price list
            $href = $_SERVER['PHP_SELF'] . "?page=product.product_price_list&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&return_args=&option=com_virtuemart&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            // add product type
            $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_product_type_form&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            /*** Adding an item is only pssible, if the product has attributes ***/
            if (ps_product::product_has_attributes($product_id)) {
                // Add Item
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_id}&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            vmMenuBar::divider();
        } elseif ($page == "admin.country_form") {
            if (!empty($_REQUEST['country_id'])) {
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ADD_STATE');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_LIST_STATES');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                vmMenuBar::divider();
            }
        }
        vmMenuBar::spacer();
        vmMenuBar::save('save', $VM_LANG->_('CMN_SAVE'));
        if ($no_menu == 0) {
            vmMenuBar::spacer();
            vmMenuBar::apply('apply', $VM_LANG->_('E_APPLY'));
        }
        if ((strstr(@$_SERVER['HTTP_REFERER'], $page) || strstr(@$_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) && $no_menu && !$is_iframe) {
            // offer a back button
            vmMenuBar::spacer();
            vmMenuBar::back();
        }
        vmMenuBar::spacer();
        vmMenuBar::cancel();
        vmMenuBar::spacer();
        vmMenuBar::endTable();
    }
Exemple #16
0
 $parseToIntFields = array('user_id', 'product_id', 'category_id', 'manufacturer_id', 'id', 'cid', 'vendor_id', 'country_id', 'currency_id', 'limitstart', 'tax_rate_id', 'order_id', 'module_id', 'function_id', 'payment_method_id', 'coupon_id', 'product_type_id', 'product_price_id', 'shopper_group_id');
 foreach ($parseToIntFields as $intField) {
     if (!empty($_REQUEST[$intField]) && is_array($_REQUEST[$intField])) {
         vmArrayToInts($_REQUEST[$intField]);
     } elseif (isset($_REQUEST[$intField])) {
         $_REQUEST[$intField] = ${$intField} = vmRequest::getInt($intField);
     }
 }
 $product_id = vmRequest::getInt('product_id');
 $vm_mainframe->setUserState('product_id', $product_id);
 if (vmIsAdminMode()) {
     $category_id = (int) $vm_mainframe->getUserStateFromRequest('category_id', 'category_id');
 } else {
     $category_id = vmRequest::getInt('category_id');
 }
 $manufacturer_id = vmRequest::getInt('manufacturer_id');
 $user_info_id = vmRequest::getVar('user_info_id');
 $myInsecureArray = array('user_info_id' => $user_info_id, 'page' => $page, 'func' => $func);
 /**
  * This InputFiler Object will help us filter malicious variable contents
  * @global vmInputFiler vmInputFiler
  */
 $GLOBALS['vmInputFilter'] = $vmInputFilter = vmInputFilter::getInstance();
 // prevent SQL injection
 if ($perm->check('admin,storeadmin')) {
     $myInsecureArray = $vmInputFilter->safeSQL($myInsecureArray);
     $myInsecureArray = $vmInputFilter->process($myInsecureArray);
     // Re-insert the escaped strings into $_REQUEST
     foreach ($myInsecureArray as $requestvar => $requestval) {
         $_REQUEST[$requestvar] = $requestval;
     }
Exemple #17
0
 function validate_update(&$d)
 {
     global $my, $perm, $vmLogger, $mosConfig_absolute_path, $auth;
     if ($my->id == 0 && $auth['user_id'] == 0) {
         $vmLogger->err("Please Login first.");
         return false;
     }
     $db = new ps_DB();
     $provided_required = true;
     $missing = "";
     require_once CLASSPATH . 'ps_userfield.php';
     $accountFields = ps_userfield::getUserFields('account', false, '', true);
     if (VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' || VM_REGISTRATION_TYPE == 'NO_REGISTRATION' || VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION' && empty($d['register_account'])) {
         $skipFields = array('username', 'password', 'password2');
     }
     if ($my->id > 0 || VM_REGISTRATION_TYPE != 'NORMAL_REGISTRATION' && VM_REGISTRATION_TYPE != 'OPTIONAL_REGISTRATION') {
         $skipFields = array('username', 'password', 'password2');
     }
     if ($my->id) {
         $skipFields[] = 'email';
     }
     foreach ($accountFields as $field) {
         if ($field->required == 0) {
             if ($field->type == 'euvatid' && !empty($d[$field->name])) {
             } else {
                 continue;
             }
         }
         if (in_array($field->name, $skipFields)) {
             continue;
         }
         switch ($field->type) {
             case 'age_verification':
                 // The Age Verification here is just a simple check if the selected date
                 // is a birthday older than the minimum age (default: 18)
                 $d[$field->name] = vmRequest::getInt('birthday_selector_year') . '-' . vmRequest::getInt('birthday_selector_month') . '-' . vmRequest::getInt('birthday_selector_day');
                 $params = new vmParameters($field->params);
                 $min_age = $params->get('minimum_age', 18);
                 $min_date = date('Y') - $min_age . '-' . date('n') . '-' . date('j');
                 if ($d[$field->name] > $min_date) {
                     // User too young!
                     $provided_required = false;
                     $missing .= $field->name . ",";
                 }
                 break;
             case 'captcha':
                 $this->checkCaptcha($provided_required, $missing);
                 break;
             case 'euvatid':
                 if (empty($d[$field->name])) {
                     break;
                 }
                 // Do nothing when the EU VAT ID field was left empty
                 // Check the VAT ID against the validation server of the European Union
                 $d['isValidVATID'] = vmValidateEUVat($d[$field->name]);
                 $d['__euvatid_field'] = $field;
                 break;
                 // We don't need to go further in the loop
             // We don't need to go further in the loop
             default:
                 if (empty($d[$field->name])) {
                     $provided_required = false;
                     $missing .= $field->name . ",";
                 }
                 break;
         }
     }
     if (!$provided_required) {
         $_REQUEST['missing'] = $missing;
         return false;
     }
     $d['user_email'] = vmGet($d, 'email', $my->email);
     $d['perms'] = 'shopper';
     return true;
 }
Exemple #18
0
 /**
  * updates manufacturer information
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $VM_LANG;
     $db = new ps_DB();
     if (!$this->validate_update($d)) {
         return False;
     }
     $fields = array('mf_name' => vmGet($d, 'mf_name'), 'mf_email' => vmGet($d, 'mf_email'), 'mf_desc' => vmGet($d, 'mf_desc', '', VMREQUEST_ALLOWHTML), 'mf_category_id' => vmRequest::getInt('mf_category_id'), 'mf_url' => vmGet($d, 'mf_url'));
     $db->buildQuery('UPDATE', '#__{vm}_manufacturer', $fields, 'WHERE manufacturer_id=' . (int) $d["manufacturer_id"]);
     if ($db->query()) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_MANUF_UPDATED'));
         return true;
     }
     return false;
 }
Exemple #19
0
 /**
  * Process and store a product review
  *
  * @param array $d
  * @return boolean
  */
 function process_review(&$d)
 {
     global $db, $auth, $perm, $VM_LANG, $vmLogger, $mosConfig_offset;
     if (PSHOP_ALLOW_REVIEWS == "1" && !empty($auth['user_id'])) {
         $d["comment"] = trim($d["comment"]);
         if (strlen($d["comment"]) < VM_REVIEWS_MINIMUM_COMMENT_LENGTH) {
             $vmLogger->err(sprintf($VM_LANG->_('PHPSHOP_REVIEW_ERR_COMMENT1', false), VM_REVIEWS_MINIMUM_COMMENT_LENGTH));
             return true;
         }
         if (strlen($d["comment"]) > VM_REVIEWS_MAXIMUM_COMMENT_LENGTH) {
             $vmLogger->err(sprintf($VM_LANG->_('PHPSHOP_REVIEW_ERR_COMMENT2', false), VM_REVIEWS_MAXIMUM_COMMENT_LENGTH));
             return true;
         }
         if (!isset($d["user_rating"]) || intval($d["user_rating"]) < 0 || intval($d["user_rating"]) > 5) {
             $vmLogger->err($VM_LANG->_('PHPSHOP_REVIEW_ERR_RATE', false));
             return true;
         }
         $commented = false;
         $sql = "SELECT userid FROM #__{vm}_product_reviews WHERE product_id = '" . $d["product_id"] . "'";
         $db->query($sql);
         while ($db->next_record()) {
             $uid = $db->f("userid");
             if ($db->f("userid") == $auth['user_id']) {
                 $commented = true;
                 break;
             }
         }
         if (!$perm->check('admin,storeadmin')) {
             $userid = $auth['user_id'];
         } else {
             $userid = vmRequest::getInt('userid', $auth['user_id']);
         }
         if ($commented == false) {
             $comment = nl2br(htmlspecialchars(vmGet($d, 'comment')));
             $published = VM_REVIEWS_AUTOPUBLISH ? 'Y' : 'N';
             $time = time() + $mosConfig_offset * 60 * 60;
             $fields = array('product_id' => $d['product_id'], 'userid' => $userid, 'comment' => $comment, 'user_rating' => vmRequest::getInt('user_rating'), 'published' => $published, 'time' => $time);
             $db->buildQuery('INSERT', '#__{vm}_product_reviews', $fields);
             $db->query();
             $this->process_vote($d);
             $vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_THANKYOU', false));
         } else {
             $vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_ALREADYDONE', false));
         }
     }
     return true;
 }
 /**
  * Updates a category record and its category_xref record
  * 
  * @author pablo
  * @author soeren
  * 
  * @param array $d
  * @return boolean true on success, false on error
  */
 function update(&$d)
 {
     global $vmLogger, $VM_LANG;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $db = new ps_DB();
     $timestamp = time();
     foreach ($d as $key => $value) {
         if (!is_array($value)) {
             $d[$key] = addslashes($value);
         }
     }
     if ($this->validate_update($d)) {
         if (!vmImageTools::process_images($d)) {
             return false;
         }
         if (empty($d["category_publish"])) {
             $d["category_publish"] = "N";
         }
         $fields = array('category_name' => vmGet($d, 'category_name'), 'category_publish' => vmGet($d, 'category_publish'), 'category_description' => vmGet($d, 'category_description', '', VMREQUEST_ALLOWHTML), 'category_browsepage' => vmGet($d, 'category_browsepage'), 'products_per_row' => vmRequest::getInt('products_per_row'), 'category_flypage' => vmGet($d, 'category_flypage'), 'category_thumb_image' => vmGet($d, 'category_thumb_image'), 'category_full_image' => vmGet($d, 'category_full_image'), 'mdate' => $timestamp, 'list_order' => vmRequest::getInt('list_order'));
         $db->buildQuery('UPDATE', '#__{vm}_category', $fields, 'WHERE category_id=' . (int) $d["category_id"] . ' AND vendor_id=' . $ps_vendor_id);
         $db->query();
         /*
          ** update #__{vm}_category x-reference table with parent-child relationship
          */
         if ($d['current_parent_id'] != $d["category_parent_id"]) {
             $fields = array('category_parent_id' => (int) $d["category_parent_id"]);
             $db->buildQuery('UPDATE', '#__{vm}_category_xref', $fields, 'WHERE category_child_id=' . (int) $d["category_id"]);
             $db->query();
         }
         /* Re-Order the category table IF the list_order has been changed */
         if (intval($d['list_order']) != intval($d['currentpos'])) {
             $dbu = new ps_DB();
             /* Moved UP in the list order */
             if (intval($d['list_order']) < intval($d['currentpos'])) {
                 $q = "SELECT category_id FROM #__{vm}_category_xref,#__{vm}_category ";
                 $q .= "WHERE category_parent_id='" . (int) $d["category_parent_id"] . "' ";
                 $q .= "AND category_child_id=category_id ";
                 $q .= "AND category_id <> '" . $d["category_id"] . "' ";
                 $q .= "AND list_order >= '" . (int) $d["list_order"] . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_category SET list_order=list_order+1 WHERE category_id='" . $db->f("category_id") . "'");
                 }
             } else {
                 $q = "SELECT category_id FROM #__{vm}_category_xref,#__{vm}_category ";
                 $q .= "WHERE category_parent_id='" . (int) $d["category_parent_id"] . "' ";
                 $q .= "AND category_child_id=category_id ";
                 $q .= "AND category_id <> '" . $d["category_id"] . "' ";
                 $q .= "AND list_order > '" . intval($d["currentpos"]) . "'";
                 $q .= "AND list_order <= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_category SET list_order=list_order-1 WHERE category_id='" . $db->f("category_id") . "'");
                 }
             }
         }
         /* END Re-Ordering */
         // Problem: When the parent id has changed, the category is
         // in a new level. We now need to change the list order value
         // of the category to the value: recent MAXIMUM + 1
         if ($d["category_parent_id"] != $d["current_parent_id"]) {
             // Let's find out the last category in
             // the new level of the category
             $q = "SELECT MAX(list_order) AS list_order FROM #__{vm}_category_xref,#__{vm}_category ";
             $q .= "WHERE category_parent_id='" . (int) $d["category_parent_id"] . "' ";
             $q .= "AND category_child_id=category_id ";
             $q .= "AND category_id <> '" . $d["category_id"] . "'";
             $db->query($q);
             $db->next_record();
             $q = "UPDATE #__{vm}_category SET list_order=" . $db->f("list_order") . "+1 WHERE category_id='" . $d["category_id"] . "'";
             $db->query($q);
         }
         $vmLogger->info($VM_LANG->_('VM_PRODUCT_CATEGORY_UPDATED') . ': "' . vmGet($d, 'category_name') . "'");
         return True;
     } else {
         return False;
     }
 }
 /**
  * Updates a state entry
  *
  * @param array $d
  * @return boolean
  */
 function updateState(&$d)
 {
     $db = new ps_DB();
     if (empty($d['state_id']) || empty($d['country_id'])) {
         $GLOBALS['vmLogger']->err('Please select a state or country for update!');
         return False;
     }
     $fields = array('state_name' => vmGet($d, 'state_name'), 'country_id' => vmRequest::getInt('country_id'), 'state_2_code' => vmGet($d, 'state_2_code'), 'state_3_code' => vmGet($d, 'state_3_code'));
     $db->buildQuery('UPDATE', '#__{vm}_state', $fields, 'WHERE state_id=' . (int) $d["state_id"]);
     if ($db->query()) {
         $GLOBALS['vmLogger']->info('The state has been updated.');
         return True;
     }
     return false;
 }
 /**
  * updates Product Type information
  * @author Zdenek Dvorak
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     $db = new ps_DB();
     if ($this->validate_update($d)) {
         if (empty($d["product_type_publish"])) {
             $d["product_type_publish"] = "N";
         }
         $fields = array('product_type_name' => vmGet($d, 'product_type_name'), 'product_type_description' => vmGet($d, 'product_type_description'), 'product_type_publish' => vmGet($d, 'product_type_publish'), 'product_type_browsepage' => vmGet($d, 'product_type_browsepage'), 'product_type_flypage' => vmGet($d, 'product_type_flypage'), 'product_type_list_order' => vmRequest::getInt('list_order'));
         $db->buildQuery('UPDATE', '#__{vm}_product_type', $fields, 'WHERE product_type_id=' . (int) $d["product_type_id"]);
         $db->query();
         // Re-Order the Product Type table IF the list_order has been changed
         if (intval($d['list_order']) != intval($d['currentpos'])) {
             $dbu = new ps_DB();
             /* Moved UP in the list order */
             if (intval($d['list_order']) < intval($d['currentpos'])) {
                 $q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
                 $q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
                 $q .= "AND product_type_list_order >= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order+1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
                 }
             } else {
                 $q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
                 $q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
                 $q .= "AND product_type_list_order > '" . intval($d["currentpos"]) . "'";
                 $q .= "AND product_type_list_order <= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order-1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
                 }
             }
         }
         // END Re-Ordering
         return True;
     } else {
         return False;
     }
 }
$only_page = vmRequest::getInt('only_page', 0);
if (PSHOP_IS_OFFLINE == '1' && !$perm->hasHigherPerms('storeadmin')) {
    echo PSHOP_OFFLINE_MESSAGE;
} else {
    if (PSHOP_IS_OFFLINE == '1') {
        echo '<h2>' . $VM_LANG->_('OFFLINE_MODE') . '</h2>';
    }
    if ($is_popup) {
        echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
        echo vmCommonHTML::PrintIcon('', true, ' ' . $VM_LANG->_('CMN_PRINT'));
    }
    // The Vendor ID is important
    $ps_vendor_id = $_SESSION['ps_vendor_id'];
    // The authentication array
    $auth = $_SESSION['auth'];
    $no_menu = vmRequest::getInt('no_menu', 0);
    // Timer Start
    if (vmShouldDebug()) {
        /*@MWM1: Log/Debug enhancements */
        $start = utime();
        $GLOBALS["mosConfig_debug"] = 1;
    }
    // update the cart because something could have
    // changed while running a function
    $cart = $_SESSION["cart"];
    if ((!$pagePermissionsOK || !$funcParams) && $_REQUEST['page'] != 'checkout.index') {
        if (!$pagePermissionsOK && defined('_VM_PAGE_NOT_AUTH')) {
            $page = 'checkout.login_form';
            echo '<br/><br/>' . $VM_LANG->_('DO_LOGIN') . '<br/><br/>';
        } elseif (!$pagePermissionsOK && defined('_VM_PAGE_NOT_FOUND')) {
            $page = HOMEPAGE;
Exemple #24
0
 /**
  * Updates a Payment Entry
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $VM_LANG;
     global $vmLogger, $VM_LANG;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $db = new ps_DB();
     if (!$this->validate_update($d)) {
         return False;
     }
     if (!empty($d["payment_class"])) {
         $payment_class = basename($d["payment_class"]);
         @(include CLASSPATH . "payment/" . $payment_class . ".php");
         if (class_exists($payment_class)) {
             $_PAYMENT = new $payment_class();
         } else {
             $GLOBALS['vmLogger']->err($VM_LANG->_('VM_PAYMENTMETHOD_CLASS_NOT_EXIST'));
             return false;
         }
     } else {
         include CLASSPATH . "payment/ps_payment.php";
         $_PAYMENT = new ps_payment();
     }
     if ($_PAYMENT->configfile_writeable() || $_PAYMENT->classname == 'ps_payment') {
         $_PAYMENT->write_configuration($d);
         $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false));
     } else {
         $vmLogger->err(sprintf($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false), CLASSPATH . "payment/" . $_PAYMENT->classname . ".cfg.php"));
         return false;
     }
     $fields = array('payment_method_name' => vmGet($d, 'payment_method_name'), 'payment_class' => vmGet($d, 'payment_class'), 'shopper_group_id' => vmRequest::getInt('shopper_group_id'), 'payment_method_discount' => vmRequest::getFloat('payment_method_discount'), 'payment_method_discount_is_percent' => vmGet($d, 'payment_method_discount_is_percent'), 'payment_method_discount_max_amount' => (double) str_replace(',', '.', $d["payment_method_discount_max_amount"]), 'payment_method_discount_min_amount' => (double) str_replace(',', '.', $d["payment_method_discount_min_amount"]), 'payment_method_code' => vmGet($d, 'payment_method_code'), 'enable_processor' => vmGet($d, 'enable_processor'), 'list_order' => vmRequest::getInt('list_order'), 'is_creditcard' => vmGet($d, 'is_creditcard'), 'payment_enabled' => vmGet($d, 'payment_enabled'), 'accepted_creditcards' => vmGet($d, 'accepted_creditcards'), 'payment_extrainfo' => vmGet($_POST, 'payment_extrainfo', null, VMREQUEST_ALLOWRAW));
     $db->buildQuery('UPDATE', '#__{vm}_payment_method', $fields, 'WHERE payment_method_id=' . (int) $d["payment_method_id"] . ' AND vendor_id=' . $ps_vendor_id);
     $db->query();
     return True;
 }
 /**
  * Updates an Order Status
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $VM_LANG;
     $db = new ps_DB();
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     if (!$this->validate_update($d)) {
         return False;
     }
     $fields = array('order_status_code' => vmGet($d, 'order_status_code'), 'order_status_name' => vmGet($d, 'order_status_name'), 'order_status_description' => vmGet($d, 'order_status_description'), 'list_order' => vmRequest::getInt('list_order'));
     $db->buildQuery('UPDATE', $this->_table_name, $fields, "WHERE order_status_id=" . (int) $d["order_status_id"] . " AND vendor_id={$ps_vendor_id}");
     if ($db->query() !== false) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_ORDERSTATUS_UPDATED'));
         return true;
     }
     return false;
 }
Exemple #26
0
    /**
     * Writes necessary hidden input fields
     * and closes the form
     */
    function finishForm($func, $page = '')
    {
        $no_menu = vmRequest::getInt('no_menu');
        $html = '
		<input type="hidden" name="vmtoken" value="' . vmSpoofValue($GLOBALS['sess']->getSessionId()) . '" />
		<input type="hidden" name="func" value="' . $func . '" />
        <input type="hidden" name="page" value="' . $page . '" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="option" value="' . VM_COMPONENT_NAME . '" />';
        if ($no_menu) {
            $html .= '<input type="hidden" name="ajax_request" value="1" />';
        } else {
            $html .= '<input type="hidden" name="ajax_request" value="0" />';
        }
        $html .= '<input type="hidden" name="no_menu" value="' . $no_menu . '" />';
        $html .= '<input type="hidden" name="no_toolbar" value="' . vmGet($_REQUEST, 'no_toolbar', 0) . '" />';
        $html .= '<input type="hidden" name="only_page" value="' . vmGet($_REQUEST, 'only_page', 0) . '" />';
        if (defined("_VM_IS_BACKEND") || @$_REQUEST['pshop_mode'] == "admin") {
            $html .= '<input type="hidden" name="pshop_admin" value="admin" />';
        }
        $html .= '
		</form>
		';
        echo $html;
    }
Exemple #27
0
 /**
  * Lists Shipping Methods of all published Shipping Modules
  *
  * @param string $ship_to_info_id
  * @param string $shipping_method_id
  */
 function list_shipping_methods($ship_to_info_id = null, $shipping_method_id = null)
 {
     global $PSHOP_SHIPPING_MODULES, $vmLogger, $auth, $weight_total;
     if (empty($ship_to_info_id)) {
         // Get the Bill to user_info_id
         $database = new ps_DB();
         $database->setQuery("SELECT user_info_id FROM #__{vm}_user_info WHERE user_id=" . $auth['user_id'] . " AND address_type='BT'");
         $vars["ship_to_info_id"] = $_REQUEST['ship_to_info_id'] = $database->loadResult();
     } else {
         $vars['ship_to_info_id'] = $ship_to_info_id;
     }
     $vars['shipping_rate_id'] = $shipping_method_id;
     $vars["weight"] = $weight_total;
     $vars['zone_qty'] = vmRequest::getInt('zone_qty', 0);
     $i = 0;
     $theme = new $GLOBALS['VM_THEMECLASS']();
     $theme->set_vars(array('vars' => $vars, 'PSHOP_SHIPPING_MODULES' => $PSHOP_SHIPPING_MODULES));
     echo $theme->fetch('checkout/list_shipping_methods.tpl.php');
 }
* 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__);
global $ps_order_status;
require_once CLASSPATH . 'ps_product.php';
require_once CLASSPATH . 'ps_order_status.php';
require_once CLASSPATH . 'ps_checkout.php';
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>";
$useStatusText = 'false';
$useCookies = 'false';
$closeSameLevel = 'false';
// if all folders should be open, we will ignore the closeSameLevel
$openAll = 'false';
if ($openAll == "true") {
    $closeSameLevel = "false";
}
$menu_htmlcode = "";
// what should be used as the base of the tree?
// ( could be *first* menu item, *site* name, *module*, *menu* name or *text* )
$base = "first";
// in case *text* should be the base node, what text should be displayed?
$basetext = "";
// what category_id is selected?
$category_id = vmRequest::getInt('category_id');
// select menu items from database
$query = "SELECT category_id,category_parent_id,category_name FROM #__{vm}_category, #__{vm}_category_xref ";
$query .= "WHERE #__{vm}_category.category_publish='Y' AND ";
$query .= "#__{vm}_category.category_id=#__{vm}_category_xref.category_child_id ";
$query .= "ORDER BY category_parent_id, list_order, category_name ASC";
$db->query($query);
$db->next_record();
// how many menu items in this menu?
$row = $db->num_rows();
// create a unique tree identifier, in case multiple dtrees are used
// (max one per module)
$tree = "d" . uniqid("tree_");
// start creating the content
// create left aligned table, load the CSS stylesheet and dTree code
$menu_htmlcode .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"100%\"><tr><td align=\"left\">\n";
Exemple #30
0
    /**
     * This creates a header above the list table, containing a search box
     * @param The Label for the list (will be used as list heading!)
     * @param The core module name (e.g. "product")
     * @param The page name (e.g. "product_list" )
     * @param Additional varaibles to include as hidden input fields
     */
    function writeSearchHeader($title, $image = "", $modulename, $pagename)
    {
        global $sess, $keyword, $VM_LANG;
        if (!empty($keyword)) {
            $keyword = urldecode($keyword);
        } else {
            $keyword = "";
        }
        $search_date = JRequest::getVar('search_date', null);
        //vmGet( $_REQUEST, 'search_date', null);
        $show = JRequest::getVar('show', '');
        //( $_REQUEST, "show", "" );
        $header = '<a name="listheader"></a>';
        $header .= '<form name="adminForm" action="' . $_SERVER['PHP_SELF'] . '" method="post">
					
					<input type="hidden" name="option" value="' . VM_COMPONENT_NAME . '" />
					<input type="hidden" name="page" value="' . $modulename . '.' . $pagename . '" />
					<input type="hidden" name="task" value="" />
					<input type="hidden" name="func" value="" />
					<input type="hidden" name="vmtoken" value="' . vmSpoofValue($sess->getSessionId()) . '" />
					<input type="hidden" name="no_menu" value="' . vmRequest::getInt('no_menu') . '" />
					<input type="hidden" name="no_toolbar" value="' . vmRequest::getInt('no_toolbar') . '" />
					<input type="hidden" name="only_page" value="' . vmRequest::getInt('only_page') . '" />
					<input type="hidden" name="boxchecked" />';
        if (defined("_VM_IS_BACKEND") || @$_REQUEST['pshop_mode'] == "admin") {
            $header .= "<input type=\"hidden\" name=\"pshop_mode\" value=\"admin\" />\n";
        }
        if ($title != "" || !empty($pagename)) {
            $header .= '<table><tr>';
            if ($title != "") {
                $style = $image != '' ? 'style="background:url(' . $image . ') no-repeat;text-indent: 30px;line-height: 50px;"' : '';
                $header .= '<td><div class="header" ' . $style . '><h2 style="margin: 0px;">' . $title . '</h2></div></td>' . "\n";
                $GLOBALS['vm_mainframe']->setPageTitle($title);
            }
            if (!empty($pagename)) {
                $header .= '<td width="20%">
				<input class="inputbox" type="text" size="25" name="keyword" value="' . shopMakeHtmlSafe($keyword) . '" />
				<input class="button" type="submit" name="search" value="' . $VM_LANG->_('PHPSHOP_SEARCH_TITLE') . '" />
				</td>';
            }
            $header .= "\n</tr></table><br style=\"clear:both;\" />\n";
        }
        if (!empty($search_date)) {
            // Changed search by date
            $header .= '<input type="hidden" name="search_date" value="' . $search_date . '" />';
        }
        if (!empty($show)) {
            $header .= "<input type=\"hidden\" name=\"show\" value=\"{$show}\" />\n";
        }
        echo $header;
    }