コード例 #1
0
function xtc_href_link($page = '', $parameters = '', $connection = 'NONSSL')
{
    //BOF - DokuMan - 2011-01-07 - Sanitize parameters
    $page = xtc_output_string($page);
    //EOF - DokuMan - 2011-01-07 - Sanitize parameters
    if (!xtc_not_null($page)) {
        die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine the page link!<br /><br />Function used:<br /><br />xtc_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</strong>');
    }
    if ($connection == 'NONSSL') {
        $link = HTTP_SERVER . DIR_WS_ADMIN;
    } elseif ($connection == 'SSL') {
        if (defined('ENABLE_SSL') && ENABLE_SSL == 'true') {
            $link = (defined('HTTPS_SERVER') ? HTTPS_SERVER : HTTPS_CATALOG_SERVER) . DIR_WS_ADMIN;
        } else {
            $link = HTTP_SERVER . DIR_WS_ADMIN;
        }
    } else {
        die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL<br /><br />Function used:<br /><br />xtc_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</strong>');
    }
    if ($parameters == '') {
        $link = $link . $page . '?' . SID;
    } else {
        //BOF - DokuMan - 2011-01-07 - Sanitize parameters
        //$link = $link . $page . '?' . $parameters . '&' . SID;
        $link = $link . $page . '?' . xtc_output_string($parameters) . '&' . SID;
        //EOF - DokuMan - 2011-01-07 - Sanitize parameters
    }
    while (substr($link, -1) == '&' || substr($link, -1) == '?') {
        $link = substr($link, 0, -1);
    }
    return $link;
}
コード例 #2
0
function xtc_draw_pull_down_menuNote($data, $values, $default = '', $parameters = '', $required = false)
{
    $field = '<select name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (USE_BOOTSTRAP == "true") {
        $field .= ' class="form-control"';
    }
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (empty($default) && isset($GLOBALS[$data['name']])) {
        $default = $GLOBALS[$data['name']];
    }
    for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
        $field .= '<option value="' . xtc_parse_input_field_data($values[$i]['id'], array('"' => '&quot;')) . '"';
        # New $values parameter disabled
        if (isset($values[$i]['disabled'])) {
            if ($values[$i]['disabled'] == "disabled") {
                $field .= ' disabled="disabled"';
            }
        }
        if ($default == $values[$i]['id']) {
            $field .= ' selected="selected"';
        }
        $field .= '>' . xtc_parse_input_field_data($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
    }
    $field .= '</select>' . $data['text'];
    if ($required == true) {
        $field .= TEXT_FIELD_REQUIRED;
    }
    return $field;
}
コード例 #3
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $xtPrice;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $xtPrice->xtcRemoveCurr($_SESSION['cart']->show_total());
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE_COST);
     // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $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_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
コード例 #4
0
function xtc_get_path($current_category_id = '')
{
    global $cPath_array;
    if (xtc_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 = '" . xtc_db_input((int) $cPath_array[$cp_size - 1]) . "'";
            $last_category_query = xtDBquery($last_category_query);
            $last_category = xtc_db_fetch_array($last_category_query, true);
            $current_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $current_category_id) . "'";
            $current_category_query = xtDBquery($current_category_query);
            $current_category = xtc_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 = xtc_not_null($cPath_array) ? implode('_', $cPath_array) : '';
    }
    return 'cPath=' . $cPath_new;
}
コード例 #5
0
function xtc_hide_session_id()
{
    global $session_started;
    if ($session_started == true && defined('SID') && xtc_not_null(SID)) {
        return xtc_draw_hidden_field(xtc_session_name(), xtc_session_id());
    }
}
コード例 #6
0
function xtc_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    $address_format_query = xtc_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . xtc_db_input((int) $address_format_id) . "'");
    $address_format = xtc_db_fetch_array($address_format_query);
    $company = addslashes($address['company']);
    $firstname = addslashes($address['firstname']);
    $lastname = addslashes($address['lastname']);
    $street = addslashes($address['street_address']);
    $suburb = addslashes($address['suburb']);
    $city = addslashes($address['city']);
    $state = addslashes($address['state']);
    $country_id = $address['country_id'];
    $zone_id = $address['zone_id'];
    $postcode = addslashes($address['postcode']);
    $zip = $postcode;
    $country = xtc_get_country_name($country_id);
    $state = xtc_get_zone_code($country_id, $zone_id, $state);
    if ($html) {
        // HTML Mode
        $HR = '<hr />';
        $hr = '<hr />';
        if ($boln == '' && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br />';
            $cr = '<br />';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    if ($suburb != '') {
        $streets = $street . $cr . $suburb;
    }
    if ($firstname == '') {
        $firstname = addslashes($address['name']);
    }
    if ($country == '') {
        $country = addslashes($address['country']);
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format['format'];
    eval("\$address = \"{$fmt}\";");
    if (ACCOUNT_COMPANY == 'true' && xtc_not_null($company)) {
        $address = $company . $cr . $address;
    }
    $address = stripslashes($address);
    return $address;
}
コード例 #7
0
function xtc_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = xtc_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'");
        $banners = xtc_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = xtc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'");
        } else {
            return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</strong>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = xtc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . xtc_db_input($identifier) . "'");
            if (xtc_db_num_rows($banner_query)) {
                $banner = xtc_db_fetch_array($banner_query);
            } else {
                return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>';
            }
        }
    } else {
        return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</strong>';
    }
    if (xtc_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . xtc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . xtc_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    xtc_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}
コード例 #8
0
function xtc_href_link_from_admin($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
{
    global $request_type, $session_started, $http_domain, $https_domain;
    require_once DIR_FS_INC . 'xtc_check_agent.inc.php';
    if (!xtc_not_null($page)) {
        die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine the page link (' . $page . ')!<br /><br />');
    }
    if ($connection == 'NONSSL') {
        $link = HTTP_SERVER . DIR_WS_CATALOG;
    } elseif ($connection == 'SSL') {
        //BOF - DokuMan - 2011-12-20 - fix ticket #88
        if (defined('ENABLE_SSL_CATALOG') && ENABLE_SSL_CATALOG == 'true') {
            $link = (defined('HTTPS_CATALOG_SERVER') ? HTTPS_CATALOG_SERVER : HTTP_CATALOG_SERVER) . DIR_WS_CATALOG;
            //EOF - DokuMan - 2011-12-20 - fix ticket #88
        } else {
            $link = HTTP_SERVER . DIR_WS_CATALOG;
        }
    } else {
        die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
    }
    if (xtc_not_null($parameters)) {
        $link .= $page . '?' . $parameters;
        $separator = '&';
    } else {
        $link .= $page;
        $separator = '?';
    }
    while (substr($link, -1) == '&' || substr($link, -1) == '?') {
        $link = substr($link, 0, -1);
    }
    // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
    if ($add_session_id == true && $session_started == true && SESSION_FORCE_COOKIE_USE == 'False') {
        if (defined('SID') && xtc_not_null(SID)) {
            $sid = SID;
        } elseif ($request_type == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL == true || $request_type == 'SSL' && $connection == 'NONSSL') {
            if ($http_domain != $https_domain) {
                $sid = session_name() . '=' . session_id();
            }
        }
    }
    //--- SEO Hartmut König -----------------------------------------//
    if ($_REQUEST['test'] || SEARCH_ENGINE_FRIENDLY_URLS == 'true' && $search_engine_safe == true) {
        require_once DIR_FS_INC . 'shopstat_functions.inc.php';
        $seolink = shopstat_getSEO($page, $parameters, $connection, $add_session_id, $search_engine_safe, 'admin');
        if ($seolink) {
            $link = $seolink;
            $elements = parse_url($link);
            isset($elements['query']) ? $separator = '&' : ($separator = '?');
        }
    }
    //--- SEO Hartmut König -----------------------------------------//
    if (xtc_check_agent() == 1) {
        $sid = NULL;
    }
    if (isset($sid)) {
        $link .= $separator . $sid;
    }
    return $link;
}
コード例 #9
0
function xtc_draw_form($name, $action, $method = 'post', $parameters = '')
{
    $form = '<form id="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" action="' . xtc_parse_input_field_data($action, array('"' => '&quot;')) . '" method="' . xtc_parse_input_field_data($method, array('"' => '&quot;')) . '"';
    if (xtc_not_null($parameters)) {
        $form .= ' ' . $parameters;
    }
    $form .= '>';
    return $form;
}
コード例 #10
0
 function quote($method = '')
 {
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_SELFPICKUP_TEXT_TITLE);
     $this->quotes['methods'] = array(array('id' => $this->code, 'title' => MODULE_SHIPPING_SELFPICKUP_TEXT_WAY, 'cost' => 0));
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
コード例 #11
0
function xtc_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";
    $category_query = xtDBquery($category_query);
    if (xtc_db_num_rows($category_query, true)) {
        #Default category( first picked from table)
        $category = xtc_db_fetch_array($category_query);
        $p_path_full = $_SERVER['REQUEST_URI'];
        $p_path = $_SERVER['QUERY_STRING'];
        #If we display product check linked categories
        if (strpos($p_path, 'products_id') !== false) {
            while ($categoryies = xtc_db_fetch_array($category_query)) {
                $cat_name = xtc_get_categories_name($categoryies['categories_id']);
                $cat_name_slug = shopstat_hrefSmallmask($cat_name);
                $p_path_full_array = explode('/', $p_path_full);
                if ($p_path_full_array[count($p_path_full_array) - 2] === $cat_name_slug) {
                    $category = $categoryies;
                    break;
                }
            }
        }
        # Check if current categorie or its children have linked product
        $c_path = $_SERVER['QUERY_STRING'];
        if (strpos($c_path, 'cPath') !== false) {
            $category_path = substr($c_path, strpos($c_path, '=') + 1);
            $categorie_previous = end(explode('_', $category_path));
            $cat_children = array();
            $cat_children = xtc_get_categories_children($categorie_previous);
            foreach ($cat_children as $linked_cat) {
                $category_query_check = "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 and p2c.categories_id = '" . $linked_cat . "'";
                $category_query_check = xtDBquery($category_query_check);
                if (xtc_db_num_rows($category_query_check, true)) {
                    $category = xtc_db_fetch_array($category_query_check);
                    break;
                }
            }
        }
        $categories = array();
        xtc_get_parent_categories($categories, $category['categories_id']);
        $categories = array_reverse($categories);
        $cPath = implode('_', $categories);
        if (xtc_not_null($cPath)) {
            $cPath .= '_';
        }
        $cPath .= $category['categories_id'];
    }
    //BOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed"
    /*
      if($_SESSION['lastpath']!=''){
        $cPath = $_SESSION['lastpath'];
      }
    */
    //EOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed"
    return $cPath;
}
コード例 #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'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
コード例 #13
0
function xtc_draw_hidden_field($name, $value = '', $parameters = '')
{
    $field = '<input type="hidden" name="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" value="';
    if (xtc_not_null($value)) {
        $field .= xtc_parse_input_field_data($value, array('"' => '&quot;'));
    } else {
        $field .= xtc_parse_input_field_data(array_key_exists($name, $GLOBALS) ? $GLOBALS[$name] : NULL, array('"' => '&quot;'));
    }
    $field .= xtc_not_null($parameters) ? '" ' . $parameters : '"';
    $field .= ' />';
    return $field;
}
コード例 #14
0
function xtc_get_category_path($cID)
{
    $cPath = '';
    $category = $cID;
    $categories = array();
    xtc_get_parent_categories($categories, $cID);
    $categories = array_reverse($categories);
    $cPath = implode('_', $categories);
    if (xtc_not_null($cPath)) {
        $cPath .= '_';
    }
    $cPath .= $cID;
    return $cPath;
}
コード例 #15
0
function xtc_draw_input_fieldNote($data, $value = '', $parameters = '', $type = 'text', $reinsert_value = true)
{
    $field = '<input type="' . xtc_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (isset($GLOBALS[$data['name']]) && $reinsert_value == true) {
        $field .= ' value="' . xtc_parse_input_field_data($GLOBALS[$data['name']], array('"' => '&quot;')) . '"';
    } elseif (xtc_not_null($value)) {
        $field .= ' value="' . xtc_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= ' />' . $data['text'];
    return $field;
}
コード例 #16
0
 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 (xtc_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);
         }
     }
 }
コード例 #17
0
function xtc_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true)
{
    $field = '<textarea name="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" id="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" cols="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" rows="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (isset($GLOBALS[$name]) && $reinsert_value == true) {
        $field .= $GLOBALS[$name];
    } elseif (xtc_not_null($text)) {
        $field .= $text;
    }
    $field .= '</textarea>';
    return $field;
}
コード例 #18
0
function xtc_image_submit($image, $alt = '', $parameters = '')
{
    if (USE_BOOTSTRAP == "true") {
        return xtc_image_button($image, $alt, $parameters, true);
    } else {
        $image_submit = '<input type="image" src="' . xtc_parse_input_field_data('templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/' . $image, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';
        if (xtc_not_null($alt)) {
            $image_submit .= ' title=" ' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . ' "';
        }
        if (xtc_not_null($parameters)) {
            $image_submit .= ' ' . $parameters;
        }
        $image_submit .= ' />';
        return $image_submit;
    }
}
コード例 #19
0
function xtc_expire_banners()
{
    $banners_query = xtc_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 (xtc_db_num_rows($banners_query)) {
        while ($banners = xtc_db_fetch_array($banners_query)) {
            if (xtc_not_null($banners['expires_date'])) {
                if (date('Y-m-d H:i:s') >= $banners['expires_date']) {
                    xtc_set_banner_status($banners['banners_id'], '0');
                }
            } elseif (xtc_not_null($banners['expires_impressions'])) {
                if ($banners['banners_shown'] >= $banners['expires_impressions']) {
                    xtc_set_banner_status($banners['banners_id'], '0');
                }
            }
        }
    }
}
コード例 #20
0
function xtc_validate_password($plain, $encrypted)
{
    if (xtc_not_null($plain) && xtc_not_null($encrypted)) {
        // split apart the hash / salt
        if ($encrypted == md5($plain)) {
            return true;
        } else {
            $plain = mb_convert_encoding($plain, "ISO-8859-15", "UTF-8");
            if ($encrypted == md5($plain)) {
                return true;
            } else {
                return false;
            }
        }
    }
    return false;
}
コード例 #21
0
 function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page')
 {
     global $PHP_SELF;
     if (xtc_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 = xtc_draw_form('pages', basename($PHP_SELF), '', 'get');
         if ($current_page_number > 1) {
             //$display_links .= '<a href="' . xtc_href_link(basename($PHP_SELF), $parameters . $page_name . '=1') . '" class="splitPageLink">' . PREVNEXT_BUTTON_FIRST . ' </a>&nbsp;';
             $display_links .= '<a href="' . xtc_href_link(basename($PHP_SELF), $parameters . $page_name . '=' . ($current_page_number - 1)) . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a>&nbsp;&nbsp;';
         } else {
             $display_links .= PREVNEXT_BUTTON_PREV . '&nbsp;&nbsp;';
         }
         $display_links .= sprintf(TEXT_RESULT_PAGE, xtc_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="' . xtc_href_link(basename($PHP_SELF), $parameters . $page_name . '=' . ($current_page_number + 1)) . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>';
             //$display_links .= '&nbsp;<a href="' . xtc_href_link(basename($PHP_SELF), $parameters . $page_name . '=' . $num_pages) . '" class="splitPageLink">' . PREVNEXT_BUTTON_LAST . '</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 .= xtc_draw_hidden_field(rawurldecode($key), rawurldecode($value));
             }
         }
         if (SID) {
             $display_links .= xtc_draw_hidden_field(session_name(), session_id());
         }
         $display_links .= '</form>';
     } else {
         $display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages);
     }
     return $display_links;
 }
コード例 #22
0
 function quote($method = '')
 {
     global $xtPrice;
     if ($xtPrice->xtcRemoveCurr($_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 ($xtPrice->xtcRemoveCurr($_SESSION['cart']->show_total()) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT) {
         $this->quotes['error'] = sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $xtPrice->xtcFormat(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true));
     } else {
         $this->quotes['methods'] = array(array('id' => $this->code, 'title' => sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $xtPrice->xtcFormat(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true)), 'cost' => 0));
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
function xtc_get_product_original_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 = xtDBquery($category_query);
    if (xtc_db_num_rows($category_query, true)) {
        $category = xtc_db_fetch_array($category_query);
        $categories = array();
        xtc_get_parent_categories($categories, $category['categories_id']);
        $categories = array_reverse($categories);
        $cPath = implode('_', $categories);
        if (xtc_not_null($cPath)) {
            $cPath .= '_';
        }
        $cPath .= $category['categories_id'];
    }
    return $cPath;
}
コード例 #24
0
 function quote($method = '', $module = '')
 {
     global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
     $quotes_array = array();
     if (is_array($this->modules)) {
         $shipping_quoted = '';
         $shipping_num_boxes = 1;
         $shipping_weight = $total_weight;
         if ($shipping_weight > SHIPPING_MAX_WEIGHT) {
             // Split into many boxes
             $shipping_num_boxes = ceil($shipping_weight / SHIPPING_MAX_WEIGHT);
             $shipping_weight = $shipping_weight / $shipping_num_boxes;
         }
         if (SHIPPING_BOX_WEIGHT >= $shipping_weight * SHIPPING_BOX_PADDING / 100) {
             $shipping_weight = $shipping_weight + SHIPPING_BOX_WEIGHT;
         } else {
             $shipping_weight = $shipping_weight + $shipping_weight * SHIPPING_BOX_PADDING / 100;
         }
         $include_quotes = array();
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             if (xtc_not_null($module) && isset($GLOBALS[$class])) {
                 if ($module == $class && $GLOBALS[$class]->enabled) {
                     $include_quotes[] = $class;
                 }
             } elseif ($GLOBALS[$class]->enabled) {
                 $include_quotes[] = $class;
             }
         }
         for ($i = 0, $size = sizeof($include_quotes); $i < $size; $i++) {
             $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
             // BOF - Tomcraft - 2011-02-01 - Paypal Express Modul
             // if (is_array($quotes)) $quotes_array[] = $quotes;
             if (!isset($quotes['error'])) {
                 if (is_array($quotes)) {
                     $quotes_array[] = $quotes;
                 }
             }
             // EOF - Tomcraft - 2011-02-01 - Paypal Express Modul
         }
     }
     return $quotes_array;
 }
コード例 #25
0
 function trail($separator = ' - ', $prefix = '', $suffix = '', $active = '')
 {
     $trail_string = '';
     for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) {
         if (isset($this->_trail[$i]['link']) && xtc_not_null($this->_trail[$i]['link'])) {
             if ($i + 1 < $n) {
                 $trail_string .= $prefix . '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>' . $suffix;
             } else {
                 $trail_string .= $active . $this->_trail[$i]['title'] . $suffix;
             }
         } else {
             $trail_string .= $prefix . $this->_trail[$i]['title'] . $suffix;
         }
         if ($i + 1 < $n) {
             $trail_string .= $separator;
         }
     }
     return $trail_string;
 }
コード例 #26
0
 function getPaymentInstalled()
 {
     if (defined('MODULE_PAYMENT_INSTALLED') && xtc_not_null(MODULE_PAYMENT_INSTALLED)) {
         $payment_module = explode(';', MODULE_PAYMENT_INSTALLED);
     }
     for ($i = 0, $n = sizeof($payment_module); $i < $n; $i++) {
         $this->payment_module[$i] = substr($payment_module[$i], 0, -4);
         $check_query = xtc_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_EASYBILL_PAYMENT_TEXT_" . strtoupper($this->payment_module[$i]) . "'");
         if (xtc_db_num_rows($check_query) == 0) {
             xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_EASYBILL_PAYMENT_TEXT_" . strtoupper($this->payment_module[$i]) . "', '',  '111', '15', '', now())");
             define('MODULE_EASYBILL_PAYMENT_TEXT_' . strtoupper($this->payment_module[$i]) . '_DESC', 'Bitte den Rechnungstext eingeben:');
             define('MODULE_EASYBILL_PAYMENT_TEXT_' . strtoupper($this->payment_module[$i]) . '_TITLE', '<b>Zahlart ' . $this->getPaymentTitle($this->payment_module[$i]) . '</b>');
         } else {
             $key[] = 'MODULE_EASYBILL_PAYMENT_TEXT_' . strtoupper($this->payment_module[$i]);
             define('MODULE_EASYBILL_PAYMENT_TEXT_' . strtoupper($this->payment_module[$i]) . '_DESC', 'Bitte den Rechnungstext eingeben:');
             define('MODULE_EASYBILL_PAYMENT_TEXT_' . strtoupper($this->payment_module[$i]) . '_TITLE', '<b>Zahlart ' . $this->getPaymentTitle($this->payment_module[$i]) . '</b>');
         }
     }
     return $key;
 }
コード例 #27
0
 function quote()
 {
     global $order, $shipping_weight;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_CHRONOPOST_TEXT_TITLE, 'methods' => array());
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     for ($i = 1; $i <= $this->num_chronopost; $i++) {
         $countries_table = constant('MODULE_SHIPPING_CHRONOPOST_COUNTRIES_' . $i);
         $country = explode(",", $countries_table);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         if (in_array($dest_country, $country)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_INVALID_ZONE;
         return $this->quotes;
     }
     $table = preg_split("/[:,]/", constant('MODULE_SHIPPING_CHRONOPOST_COST_' . $dest_zone));
     // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $cost = -1;
     for ($i = 0, $n = sizeof($table); $i < $n; $i += 2) {
         if ($shipping_weight <= $table[$i]) {
             $cost = $table[$i + 1] + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING;
             break;
         }
     }
     if ($cost == -1) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_UNDEFINED_RATE;
         return $this->quotes;
     }
     $this->quotes['methods'][] = array('id' => $this->code, 'title' => MODULE_SHIPPING_CHRONOPOST_TEXT_WAY . ' ' . $order->delivery['country']['title'], 'cost' => $cost + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING);
     return $this->quotes;
 }
コード例 #28
0
function xtc_image($src, $alt = '', $width = '', $height = '', $parameters = '')
{
    if (empty($src) || $src == DIR_WS_IMAGES || $src == DIR_WS_THUMBNAIL_IMAGES) {
        return false;
    }
    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default
    $image = '<img src="' . xtc_parse_input_field_data($src, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';
    //BOF - Dokuman - 2009-10-14 - Remove title-attribute from images to avoid "keyword stuffing" (SEO), as it is identical to the alt-attribute
    /*
    if (xtc_not_null($alt)) {
      $image .= ' title=" ' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . ' "';
    }
    */
    //EOF - Dokuman - 2009-10-14 - Remove title-attribute from images to avoid "keyword stuffing" (SEO), as it is identical to the alt-attribute
    if (CONFIG_CALCULATE_IMAGE_SIZE == 'true' && (empty($width) || empty($height))) {
        if ($image_size = @getimagesize($src)) {
            if (empty($width) && xtc_not_null($height)) {
                $ratio = $height / $image_size[1];
                $width = $image_size[0] * $ratio;
            } elseif (xtc_not_null($width) && empty($height)) {
                $ratio = $width / $image_size[0];
                $height = $image_size[1] * $ratio;
            } elseif (empty($width) && empty($height)) {
                $width = $image_size[0];
                $height = $image_size[1];
            }
        } elseif (defined('IMAGE_REQUIRED') && IMAGE_REQUIRED == 'false') {
            //DokuMan - 2010-02-26 - set undefined constant
            return false;
        }
    }
    if (xtc_not_null($width) && xtc_not_null($height)) {
        $image .= ' width="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" height="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    }
    if (xtc_not_null($parameters)) {
        $image .= ' ' . $parameters;
    }
    $image .= ' />';
    return $image;
}
コード例 #29
0
function xtc_get_countriesList($countries_id = '', $with_iso_codes = false)
{
    $countries_array = array();
    if (xtc_not_null($countries_id)) {
        if ($with_iso_codes == true) {
            $countries = xtc_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . xtc_db_input((int) $countries_id) . "' and status = '1' order by countries_name");
            $countries_values = xtc_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 = xtc_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . xtc_db_input((int) $countries_id) . "' and status = '1'");
            $countries_values = xtc_db_fetch_array($countries);
            $countries_array = array('countries_name' => $countries_values['countries_name']);
        }
    } else {
        $countries = xtc_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " where status = '1' order by countries_name");
        while ($countries_values = xtc_db_fetch_array($countries)) {
            $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']);
        }
    }
    return $countries_array;
}
コード例 #30
0
function xtc_draw_selection_fieldNote($data, $type, $value = '', $checked = false, $parameters = '')
{
    $selection = $data['suffix'] . '<input type="' . xtc_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (xtc_not_null($value)) {
        $selection .= ' value="' . xtc_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    //BOF - DokuMan - 2010-09-17 - set undefined index
    //if ( ($checked == true) || ($GLOBALS[$data['name']] == 'on') || ( (isset($value)) && ($GLOBALS[$data['name']] == $value) ) ) {
    if ($checked == true || isset($GLOBALS[$data['name']]) && $GLOBALS[$data['name']] == 'on' || isset($value) && (isset($GLOBALS[$data['name']]) && $GLOBALS[$data['name']] == $value)) {
        //EOF - DokuMan - 2010-09-17 - set undefined index
        $selection .= ' checked="checked"';
    }
    if (xtc_not_null($parameters)) {
        $selection .= ' ' . $parameters;
    }
    //BOF - DokuMan - 2010-09-17 - set undefined index: text
    //$selection .= ' />'.$data['text'];
    $selection .= ' />';
    if (isset($data['text'])) {
        $selection .= $data['text'];
    }
    //EOF - DokuMan - 2010-09-17 - set undefined index: text
    return $selection;
}