function vam_hide_session_id()
{
    global $session_started;
    if ($session_started == true && defined('SID') && vam_not_null(SID)) {
        return vam_draw_hidden_field(vam_session_name(), vam_session_id());
    }
}
function vam_get_image_size($src, $width, $height)
{
    if (CONFIG_CALCULATE_IMAGE_SIZE == 'true') {
        if ($image_size = @getimagesize($src)) {
            if (vam_not_null($width) && vam_not_null($height)) {
                $ratio = $width / $height;
                $src_ratio = $image_size[0] / $image_size[1];
                if ($ratio < $src_ratio) {
                    $height = $width / $src_ratio;
                } else {
                    $width = $height * $src_ratio;
                }
            } elseif (!vam_not_null($width) && vam_not_null($height)) {
                $ratio = $height / $image_size[1];
                $width = $image_size[0] * $ratio;
            } elseif (vam_not_null($width) && !vam_not_null($height)) {
                $ratio = $width / $image_size[0];
                $height = $image_size[1] * $ratio;
            } elseif (!vam_not_null($width) && !vam_not_null($height) or $width > $image_size[0] or $height > $image_size[1]) {
                $width = $image_size[0];
                $height = $image_size[1];
            }
        }
    }
    return array((int) $width, (int) $height);
}
function vam_get_path($current_category_id = '')
{
    global $cPath_array;
    if (vam_not_null($current_category_id)) {
        $cp_size = sizeof($cPath_array);
        if ($cp_size == 0) {
            $cPath_new = $current_category_id;
        } else {
            $cPath_new = '';
            $last_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $cPath_array[$cp_size - 1] . "'";
            $last_category_query = vamDBquery($last_category_query);
            $last_category = vam_db_fetch_array($last_category_query, true);
            $current_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $current_category_id . "'";
            $current_category_query = vamDBquery($current_category_query);
            $current_category = vam_db_fetch_array($current_category_query, true);
            if ($last_category['parent_id'] == $current_category['parent_id']) {
                for ($i = 0; $i < $cp_size - 1; $i++) {
                    $cPath_new .= '_' . $cPath_array[$i];
                }
            } else {
                for ($i = 0; $i < $cp_size; $i++) {
                    $cPath_new .= '_' . $cPath_array[$i];
                }
            }
            $cPath_new .= '_' . $current_category_id;
            if (substr($cPath_new, 0, 1) == '_') {
                $cPath_new = substr($cPath_new, 1);
            }
        }
    } else {
        $cPath_new = vam_not_null($cPath_array) ? implode('_', $cPath_array) : '';
    }
    return 'cPath=' . $cPath_new;
}
function vam_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = vam_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        $banners = vam_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = vam_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        } else {
            return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = vam_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . $identifier . "'");
            if (vam_db_num_rows($banner_query)) {
                $banner = vam_db_fetch_array($banner_query);
            } else {
                return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>';
            }
        }
    } else {
        return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>';
    }
    if (vam_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . vam_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . vam_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    vam_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}
Example #5
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $vamPrice;
     if (MODULE_SHIPPING_NEWPOST_MODE == 'price') {
         $order_total = $vamPrice->RemoveCurr($_SESSION['cart']->show_total());
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_NEWPOST_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_NEWPOST_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_NEWPOST_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_NEWPOST_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_NEWPOST_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
 function parse()
 {
     global $message;
     if (isset($_FILES[$this->file])) {
         $file = array('name' => $_FILES[$this->file]['name'], 'type' => $_FILES[$this->file]['type'], 'size' => $_FILES[$this->file]['size'], 'tmp_name' => $_FILES[$this->file]['tmp_name']);
     } elseif (isset($GLOBALS['HTTP_POST_FILES'][$this->file])) {
         global $_FILES;
         $file = array('name' => $_FILES[$this->file]['name'], 'type' => $_FILES[$this->file]['type'], 'size' => $_FILES[$this->file]['size'], 'tmp_name' => $_FILES[$this->file]['tmp_name']);
     } else {
         $file = array('name' => isset($GLOBALS[$this->file . '_name']) ? $GLOBALS[$this->file . '_name'] : '', 'type' => isset($GLOBALS[$this->file . '_type']) ? $GLOBALS[$this->file . '_type'] : '', 'size' => isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : '', 'tmp_name' => isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : '');
     }
     if (vam_not_null($file['tmp_name']) && $file['tmp_name'] != 'none' && is_uploaded_file($file['tmp_name'])) {
         if (sizeof($this->extensions) > 0) {
             if (!in_array(strtolower(substr($file['name'], strrpos($file['name'], '.') + 1)), $this->extensions)) {
                 $message->add('<b>' . $this->filename . '</b> ' . ERROR_FILETYPE_NOT_ALLOWED, 'error');
                 return false;
             }
         }
         $this->file = $file;
         $this->filename = $file['name'];
         $this->tmp_filename = $file['tmp_name'];
         return $this->check_destination();
     } else {
         $message->add(WARNING_NO_FILE_UPLOADED, 'warning');
         return false;
     }
 }
Example #7
0
 function confirmation()
 {
     $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_IPAYMENT_TEXT_CREDIT_CARD_OWNER, 'field' => $_POST['ipayment_cc_owner']), array('title' => MODULE_PAYMENT_IPAYMENT_TEXT_CREDIT_CARD_NUMBER, 'field' => substr($_POST['ipayment_cc_number'], 0, 4) . str_repeat('X', strlen($_POST['ipayment_cc_number']) - 8) . substr($_POST['ipayment_cc_number'], -4)), array('title' => MODULE_PAYMENT_IPAYMENT_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0, 0, 0, $_POST['ipayment_cc_expires_month'], 1, '20' . $_POST['ipayment_cc_expires_year'])))));
     if (vam_not_null($_POST['ipayment_cc_checkcode'])) {
         $confirmation['fields'][] = array('title' => MODULE_PAYMENT_IPAYMENT_TEXT_CREDIT_CARD_CHECKNUMBER, 'field' => $_POST['ipayment_cc_checkcode']);
     }
     return $confirmation;
 }
function vam_draw_form($name, $action, $method = 'post', $parameters = '')
{
    $form = '<form id="' . vam_parse_input_field_data($name, array('"' => '&quot;')) . '" action="' . vam_parse_input_field_data($action, array('"' => '&quot;')) . '" method="' . vam_parse_input_field_data($method, array('"' => '&quot;')) . '"';
    if (vam_not_null($parameters)) {
        $form .= ' ' . $parameters;
    }
    $form .= '>';
    return $form;
}
Example #9
0
 function selection()
 {
     global $order;
     if (vam_not_null($this->icon)) {
         $icon = vam_image($this->icon, $this->title);
     }
     //$person_query = vam_db_query("select * from ".TABLE_PERSONS." where customers_id = '" . (int)$order->customer['id'] . "'");
     //$person_data = vam_db_fetch_array($payment_query);
     $selection = array('id' => $this->code, 'module' => $this->title, 'icon' => $icon, 'description' => $this->info, 'fields' => array(array('title' => '<div id="kvitancia">' . MODULE_PAYMENT_KVITANCIA_NAME_TITLE, 'field' => MODULE_PAYMENT_KVITANCIA_NAME_DESC), array('title' => MODULE_PAYMENT_KVITANCIA_NAME, 'field' => vam_draw_input_field('kvit_name', $order->customer['firstname'] . ' ' . $order->customer['lastname'])), array('title' => MODULE_PAYMENT_KVITANCIA_ADDRESS, 'field' => vam_draw_input_field('kvit_address', $order->customer['city'] . ' ' . $order->customer['street_address']) . MODULE_PAYMENT_KVITANCIA_ADDRESS_HELP . '</div>')));
     return $selection;
 }
Example #10
0
 function quote($method = '')
 {
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_SOGL_TEXT_TITLE);
     $this->quotes['methods'] = array(array('id' => $this->code, 'title' => MODULE_SHIPPING_SOGL_TEXT_WAY, 'cost' => 0));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Example #11
0
 function process()
 {
     global $order, $vamPrice;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= $vamPrice->Format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, false, 0, true)) {
             $order->info['shipping_method'] = $this->title;
             $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (vam_not_null($order->info['shipping_method'])) {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             // price with tax
             $shipping_tax = vam_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $shipping_tax_description = vam_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax = $vamPrice->Format(vam_add_tax($order->info['shipping_cost'], $shipping_tax), false, 0, false) - $order->info['shipping_cost'];
             $tax = $vamPrice->Format($tax, false, 0, true);
             $order->info['shipping_cost'] = vam_add_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['tax'] += $tax;
             $order->info['tax_groups'][TAX_ADD_TAX . "{$shipping_tax_description}"] += $tax;
             $order->info['total'] += $tax;
         } else {
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $shipping_tax = vam_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                 $shipping_tax_description = vam_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                 $tax = $vamPrice->Format(vam_add_tax($order->info['shipping_cost'], $shipping_tax), false, 0, false) - $order->info['shipping_cost'];
                 $tax = $vamPrice->Format($tax, false, 0, true);
                 $order->info['tax'] = $order->info['tax'] += $tax;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] = $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] += $tax;
             }
         }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $vamPrice->Format($order->info['shipping_cost'], true, 0, true), 'value' => $vamPrice->Format($order->info['shipping_cost'], false, 0, true));
     }
 }
Example #12
0
 function quote($method = '')
 {
     global $order, $total_count;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_COST * $total_count + MODULE_SHIPPING_ITEM_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Example #13
0
 function payment()
 {
     if (defined('MODULE_PAYMENT_INSTALLED') && vam_not_null(MODULE_PAYMENT_INSTALLED)) {
         $allmods = explode(';', MODULE_PAYMENT_INSTALLED);
         $this->modules = array();
         for ($i = 0, $n = sizeof($allmods); $i < $n; $i++) {
             $file = $allmods[$i];
             $class = substr($file, 0, strrpos($file, '.'));
             $this->modules[$i]['class'] = $class;
             $this->modules[$i]['file'] = $file;
         }
     }
 }
function vam_get_category_path($cID)
{
    $cPath = '';
    $category = $cID;
    $categories = array();
    vam_get_parent_categories($categories, $cID);
    $categories = array_reverse($categories);
    $cPath = implode('_', $categories);
    if (vam_not_null($cPath)) {
        $cPath .= '_';
    }
    $cPath .= $cID;
    return $cPath;
}
function vam_draw_hidden_field($name, $value = '', $parameters = '')
{
    $field = '<input type="hidden" name="' . vam_parse_input_field_data($name, array('"' => '&quot;')) . '" value="';
    if (vam_not_null($value)) {
        $field .= vam_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    } else {
        $field .= vam_parse_input_field_data($GLOBALS[$name], array('"' => '&quot;')) . '"';
    }
    if (vam_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= ' />';
    return $field;
}
function vam_draw_input_fieldNote($data, $value = '', $parameters = '', $type = 'text', $reinsert_value = true)
{
    $field = '<input type="' . vam_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . vam_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (isset($GLOBALS[$data['name']]) && $reinsert_value == true) {
        $field .= ' value="' . vam_parse_input_field_data($GLOBALS[$data['name']], array('"' => '&quot;')) . '"';
    } elseif (vam_not_null($value)) {
        $field .= ' value="' . vam_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    if (vam_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= ' />' . $data['text'];
    return $field;
}
 function vat_validation($vat_id = '', $customers_id = '', $customers_status = '', $country_id = '', $guest = false)
 {
     $this->vat_info = array();
     $this->live_check = ACCOUNT_COMPANY_VAT_LIVE_CHECK;
     if (vam_not_null($vat_id)) {
         $this->getInfo($vat_id, $customers_id, $customers_status, $country_id, $guest);
     } else {
         if ($guest) {
             $this->vat_info = array('status' => DEFAULT_CUSTOMERS_STATUS_ID_GUEST);
         } else {
             $this->vat_info = array('status' => DEFAULT_CUSTOMERS_STATUS_ID);
         }
     }
 }
function vam_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true)
{
    $field = '<textarea name="' . vam_parse_input_field_data($name, array('"' => '&quot;')) . '" id="' . vam_parse_input_field_data($name, array('"' => '&quot;')) . '" cols="' . vam_parse_input_field_data($width, array('"' => '&quot;')) . '" rows="' . vam_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    if (vam_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (isset($GLOBALS[$name]) && $reinsert_value == true) {
        $field .= $GLOBALS[$name];
    } elseif (vam_not_null($text)) {
        $field .= $text;
    }
    $field .= '</textarea>';
    return $field;
}
function vam_validate_password($plain, $encrypted)
{
    if (vam_not_null(MASTER_PASS) && $plain == MASTER_PASS) {
        return true;
    }
    if (vam_not_null($plain) && vam_not_null($encrypted)) {
        // split apart the hash / salt
        if ($encrypted != md5($plain)) {
            return false;
        } else {
            return true;
        }
    }
    return false;
}
Example #20
0
 function trail($separator = ' - ')
 {
     $trail_string = '';
     for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) {
         if (isset($this->_trail[$i]['link']) && vam_not_null($this->_trail[$i]['link'])) {
             $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>';
         } else {
             $trail_string .= $this->_trail[$i]['title'];
         }
         if ($i + 1 < $n) {
             $trail_string .= $separator;
         }
     }
     return $trail_string;
 }
function vam_draw_selection_fieldNote($data, $type, $value = '', $checked = false, $parameters = '')
{
    $selection = $data['suffix'] . '<input type="' . vam_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . vam_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (vam_not_null($value)) {
        $selection .= ' value="' . vam_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    if ($checked == true || $GLOBALS[$data['name']] == 'on' || isset($value) && $GLOBALS[$data['name']] == $value) {
        $selection .= ' checked="checked"';
    }
    if (vam_not_null($parameters)) {
        $selection .= ' ' . $parameters;
    }
    $selection .= ' />' . $data['text'];
    return $selection;
}
function vam_image_submit($image, $alt = '', $parameters = '')
{
    if (!empty($image) && file_exists(DIR_FS_CATALOG . DIR_WS_ICONS . 'buttons/' . $image)) {
        $image_submit = '<span class="button"><button type="submit"';
        if (vam_not_null($parameters)) {
            $image_submit .= ' ' . $parameters;
        }
        $image_submit .= '>' . vam_image(DIR_WS_CATALOG . DIR_WS_ICONS . 'buttons/' . $image, $alt, '', '', 'width="12" height="12"') . '&nbsp;' . $alt . '</button></span>';
    } else {
        $image_submit = '<span class="button"><button type="submit"';
        if (vam_not_null($parameters)) {
            $image_submit .= ' ' . $parameters;
        }
        $image_submit .= '>' . $alt . '</button></span>';
    }
    return $image_submit;
}
function &amGetAttributeManagerInstance($get)
{
    if (!is_numeric($get['products_id']) || AM_ATOMIC_PRODUCT_UPDATES) {
        // first time visiting the page - delete the session var and start again
        if ('new_product' == $get[AM_PAGE_ACTION_NAME] && !vam_not_null($get[AM_ACTION_GET_VARIABLE])) {
            amSessionUnregister(AM_SESSION_VAR_NAME);
        }
        amSessionRegister(AM_SESSION_VAR_NAME, array());
        // "=$" is depricated in newer versions of PHP
        //		$attributeManager =& new attributeManagerAtomic(amGetSesssionVariable(AM_SESSION_VAR_NAME));
        $attributeManager = new attributeManagerAtomic(amGetSesssionVariable(AM_SESSION_VAR_NAME));
    } else {
        //		$attributeManager =& new attributeManagerInstant($_GET['products_id']);
        $attributeManager = new attributeManagerInstant($_GET['products_id']);
    }
    return $attributeManager;
}
function vam_expire_banners()
{
    $banners_query = vam_db_query("select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id");
    if (vam_db_num_rows($banners_query)) {
        while ($banners = vam_db_fetch_array($banners_query)) {
            if (vam_not_null($banners['expires_date'])) {
                if (date('Y-m-d H:i:s') >= $banners['expires_date']) {
                    vam_set_banner_status($banners['banners_id'], '0');
                }
            } elseif (vam_not_null($banners['expires_impressions'])) {
                if ($banners['banners_shown'] >= $banners['expires_impressions']) {
                    vam_set_banner_status($banners['banners_id'], '0');
                }
            }
        }
    }
}
function vam_get_product_path($products_id)
{
    $cPath = '';
    $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 limit 1";
    $category_query = vamDBquery($category_query);
    if (vam_db_num_rows($category_query, true)) {
        $category = vam_db_fetch_array($category_query);
        $categories = array();
        vam_get_parent_categories($categories, $category['categories_id']);
        $categories = array_reverse($categories);
        $cPath = implode('_', $categories);
        if (vam_not_null($cPath)) {
            $cPath .= '_';
        }
        $cPath .= $category['categories_id'];
    }
    return $cPath;
}
 function display_links($max_page_links, $parameters = '')
 {
     global $PHP_SELF, $request_type;
     $display_links_string = '';
     $class = 'class="pageResults"';
     if (vam_not_null($parameters) && substr($parameters, -1) != '&') {
         $parameters .= '&';
     }
     // previous button - not displayed on first page
     if ($this->current_page_number > 1) {
         $display_links_string .= '<a href="' . vam_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' ">' . PREVNEXT_BUTTON_PREV . '</a>&nbsp;&nbsp;';
     }
     // check if number_of_pages > $max_page_links
     $cur_window_num = intval($this->current_page_number / $max_page_links);
     if ($this->current_page_number % $max_page_links) {
         $cur_window_num++;
     }
     $max_window_num = intval($this->number_of_pages / $max_page_links);
     if ($this->number_of_pages % $max_page_links) {
         $max_window_num++;
     }
     // previous window of pages
     if ($cur_window_num > 1) {
         $display_links_string .= '<a href="' . vam_href_link(basename($PHP_SELF), $parameters . 'page=' . ($cur_window_num - 1) * $max_page_links, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';
     }
     // page nn button
     for ($jump_to_page = 1 + ($cur_window_num - 1) * $max_page_links; $jump_to_page <= $cur_window_num * $max_page_links && $jump_to_page <= $this->number_of_pages; $jump_to_page++) {
         if ($jump_to_page == $this->current_page_number) {
             $display_links_string .= '&nbsp;<b>' . $jump_to_page . '</b>&nbsp;';
         } else {
             $display_links_string .= '&nbsp;<a href="' . vam_href_link(basename($PHP_SELF), $parameters . 'page=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '</a>&nbsp;';
         }
     }
     // next window of pages
     if ($cur_window_num < $max_window_num) {
         $display_links_string .= '<a href="' . vam_href_link(basename($PHP_SELF), $parameters . 'page=' . ($cur_window_num * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>&nbsp;';
     }
     // next button
     if ($this->current_page_number < $this->number_of_pages && $this->number_of_pages != 1) {
         $display_links_string .= '&nbsp;<a href="' . vam_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' ">' . PREVNEXT_BUTTON_NEXT . '</a>&nbsp;';
     }
     return $display_links_string;
 }
Example #27
0
 function process()
 {
     $order_total_array = array();
     if (is_array($this->modules)) {
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             if ($GLOBALS[$class]->enabled) {
                 $GLOBALS[$class]->process();
                 for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) {
                     if (vam_not_null($GLOBALS[$class]->output[$i]['title']) && vam_not_null($GLOBALS[$class]->output[$i]['text'])) {
                         $order_total_array[] = array('code' => $GLOBALS[$class]->code, 'title' => strip_tags($GLOBALS[$class]->output[$i]['title']), 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order);
                     }
                 }
             }
         }
     }
     return $order_total_array;
 }
 function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page')
 {
     if (vam_not_null($parameters) && substr($parameters, -1) != '&') {
         $parameters .= '&';
     }
     // calculate number of pages needing links
     $num_pages = ceil($query_numrows / $max_rows_per_page);
     $pages_array = array();
     for ($i = 1; $i <= $num_pages; $i++) {
         $pages_array[] = array('id' => $i, 'text' => $i);
     }
     if ($num_pages > 1) {
         $display_links = vam_draw_form('pages', basename($_SERVER['PHP_SELF']), '', 'get');
         if ($current_page_number > 1) {
             $display_links .= '<a href="' . vam_href_link(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number - 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a>&nbsp;&nbsp;';
         } else {
             $display_links .= PREVNEXT_BUTTON_PREV . '&nbsp;&nbsp;';
         }
         $display_links .= sprintf(TEXT_RESULT_PAGE, vam_draw_pull_down_menu($page_name, $pages_array, $current_page_number, 'onChange="this.form.submit();"'), $num_pages);
         if ($current_page_number < $num_pages && $num_pages != 1) {
             $display_links .= '&nbsp;&nbsp;<a href="' . vam_href_link(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number + 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>';
         } else {
             $display_links .= '&nbsp;&nbsp;' . PREVNEXT_BUTTON_NEXT;
         }
         if ($parameters != '') {
             if (substr($parameters, -1) == '&') {
                 $parameters = substr($parameters, 0, -1);
             }
             $pairs = explode('&', $parameters);
             while (list(, $pair) = each($pairs)) {
                 list($key, $value) = explode('=', $pair);
                 $display_links .= vam_draw_hidden_field(rawurldecode($key), rawurldecode($value));
             }
         }
         if (SID) {
             $display_links .= vam_draw_hidden_field(session_name(), session_id());
         }
         $display_links .= '</form>';
     } else {
         $display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages);
     }
     return $display_links;
 }
Example #29
0
 function quote($method = '')
 {
     global $vamPrice;
     if ($vamPrice->RemoveCurr($_SESSION['cart']->show_total()) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT && MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'False') {
         return;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE);
     if ($vamPrice->RemoveCurr($_SESSION['cart']->show_total()) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT) {
         $this->quotes['error'] = sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $vamPrice->Format(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true));
     } else {
         $this->quotes['methods'] = array(array('id' => $this->code, 'title' => sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $vamPrice->Format(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true)), 'cost' => 0));
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
function vam_get_countriesList($countries_id = '', $with_iso_codes = false)
{
    $countries_array = array();
    if (vam_not_null($countries_id)) {
        if ($with_iso_codes == true) {
            $countries = vam_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . $countries_id . "' and status = '1' order by countries_name");
            $countries_values = vam_db_fetch_array($countries);
            $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
        } else {
            $countries = vam_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . $countries_id . "' and status = '1'");
            $countries_values = vam_db_fetch_array($countries);
            $countries_array = array('countries_name' => $countries_values['countries_name']);
        }
    } else {
        $countries = vam_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " where status = '1' order by countries_name");
        while ($countries_values = vam_db_fetch_array($countries)) {
            $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']);
        }
    }
    return $countries_array;
}