Ejemplo n.º 1
0
function olc_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false, $AJAX_validation = false)
{
    $field = '<select name="' . $name . '" id="' . $name . QUOTE;
    if ($AJAX_validation) {
        $field .= '" onchange="pull_down_menu_change(this);"';
    }
    //W. Kaiser - AJAX
    if (olc_not_null($parameters)) {
        $field .= BLANK . $parameters;
    }
    $field .= '>';
    if (empty($default) && isset($GLOBALS[$name])) {
        $default = $GLOBALS[$name];
    }
    $special = array(QUOTE => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;');
    for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
        $id = $values[$i]['id'];
        $field .= '<option value="' . htmlentities(olc_parse_input_field_data($id, array(QUOTE => '&quot;'))) . QUOTE;
        if ($default == $id) {
            $field .= ' selected="selected"';
        }
        //$field .= '>' . htmlentities(olc_parse_input_field_data($values[$i]['text'],$special)) . '</option>';
        $field .= '>' . olc_parse_input_field_data($values[$i]['text'], $special) . '</option>';
    }
    $field .= '</select>';
    //W. Kaiser - AJAX
    if (USE_AJAX) {
        $field = "<span id=\"" . $name . "_select\">" . $field . "</span>";
    }
    //W. Kaiser - AJAX
    if ($required) {
        $field .= TEXT_FIELD_REQUIRED;
    }
    return $field;
}
function olc_image_submit($src, $alt = '', $parameters = '', $Ajax_reset_cart_data_dirty = false)
{
    $rep = array(QUOTE => '&quot;');
    $src = olc_parse_input_field_data($src, $rep);
    if (IS_ADMIN_FUNCTION) {
        $src = CURRENT_TEMPLATE_ADMIN_BUTTONS . $src;
    } else {
        $src = CURRENT_TEMPLATE_BUTTONS . $src;
    }
    /*
    if (IS_MULTI_SHOP)
    {
    	$src=olc_set_multi_shop_dir_info($src);
    }
    */
    $src = '<input type="image" class="image" src="' . $src . '"  style="border:0px"';
    if (olc_not_null($alt)) {
        $alt = olc_parse_input_field_data($alt, $rep);
        $src .= ' title="' . $alt . QUOTE;
    }
    $src .= ' alt="' . $alt . QUOTE;
    //W. Kaiser - AJAX
    if ($Ajax_reset_cart_data_dirty) {
        //Reset "cart_data_dirty"-flag, if form is submitted
        $parameters .= ' onclick="javascript:sticky_cart_data_dirty=false;"';
    }
    if (olc_not_null($parameters)) {
        $src .= BLANK . $parameters;
    }
    $src .= '/>';
    return $src;
}
Ejemplo n.º 3
0
function olc_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true)
{
    $field = '<textarea name="' . olc_parse_input_field_data($name, array('"' => '&quot;')) . '" wrap="' . olc_parse_input_field_data($wrap, array('"' => '&quot;')) . '" cols="' . olc_parse_input_field_data($width, array('"' => '&quot;')) . '" rows="' . olc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    if (olc_not_null($parameters)) {
        $field .= BLANK . $parameters;
    }
    $field .= '>' . $text . '</textarea>';
    return $field;
}
Ejemplo n.º 4
0
function olc_draw_submit_button($name, $value = '', $parameters = '')
{
    $name = olc_parse_input_field_data($name, array('"' => '&quot;'));
    $field = '<input type="submit" name="' . $name . '" id="' . $name . '" value="';
    $field .= olc_parse_input_field_data($value, array('"' => '&quot;')) . QUOTE;
    if ($parameters) {
        $field .= BLANK . $parameters;
    }
    $field .= '/>';
    return $field;
}
Ejemplo n.º 5
0
function olc_draw_hidden_field($name, $value = '', $parameters = '')
{
    $name = olc_parse_input_field_data($name, array('"' => '&quot;'));
    $field = '<input type="hidden" name="' . $name;
    if (strpos($parameters, 'id=') === false) {
        $field .= '" id="' . $name;
    }
    $field .= '" value="';
    if (!$value) {
        $value = $GLOBALS[$name];
    }
    $field .= olc_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    if (olc_not_null($parameters)) {
        $field .= BLANK . $parameters;
    }
    $field .= '/>';
    return $field;
}
Ejemplo n.º 6
0
function olc_draw_form($name, $action, $method = 'post', $action_parameters = '', $form_parameters = '')
{
    //W. Kaiser - AJAX
    //QUOTE='"';
    $html_quot = '&quot;';
    $form_name = olc_parse_input_field_data($name, array(QUOTE => $html_quot));
    $method_par = olc_parse_input_field_data($method, array(QUOTE => $html_quot));
    $action_par = olc_parse_input_field_data($action, array(QUOTE => $html_quot));
    if (IS_ADMIN_FUNCTION) {
        //Note: the admin prog modules use different calling parameter order!
        $form = $action_parameters;
        $action_parameters = $method_par;
        $method_par = $form;
        $action_par = olc_href_link($action, $action_parameters, NONSSL, true, true, false);
        $action_parameters = EMPTY_STRING;
    } else {
        $form_parameters = $action_parameters;
    }
    if ($method_par == EMPTY_STRING) {
        $method_par = "post";
    }
    if ($form_parameters != EMPTY_STRING) {
        $form_parameters = BLANK . $form_parameters;
    }
    if (USE_AJAX) {
        //Remove AJAX Javascript routine from "action"-url, as we need it in its original form for the xhttprequest
        /*
        if ((strpos($action_par, AJAX_REQUEST_FUNC_START) !== false))
        {
        	$action_par = str_replace(AJAX_REQUEST_FUNC_START, EMPTY_STRING, $action_par);
        	$action_par = str_replace(AJAX_REQUEST_FUNC_END, EMPTY_STRING, $action_par);
        }
        */
        $onsubmit = "onsubmit";
        if (strpos(strtolower($form_parameters), strtolower($onsubmit)) === false) {
            $form_parameters .= BLANK . $onsubmit . '="return make_AJAX_Request_POST(\'' . $name . '\',\'' . $action_par . '\');"';
        }
        $form_name .= '" id="' . $form_name;
    }
    //W. Kaiser - AJAX
    $form = '<form name="' . $form_name . '" action="' . $action_par . '" method="' . $method_par . QUOTE . $form_parameters . '>';
    return $form;
}
function olc_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true, $AJAX_validate = false, $AJAX_required = false, $AJAX_caption = "", $AJAX_add_span = false)
{
    $field = '<input type="' . olc_parse_input_field_data($type, array(QUOTE => '&quot;')) . '" name="' . olc_parse_input_field_data($name, array(QUOTE => '&quot;')) . QUOTE;
    /*
    if (false && (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
    	$value=$GLOBALS[$name];
    	//$field .= ' class="text" value="' . olc_parse_input_field_data($GLOBALS[$name], array(QUOTE => '&quot;')) . QUOTE;
    } elseif (olc_not_null($value)) {
    	//$field .= ' class="text" value="' . olc_parse_input_field_data($value, array(QUOTE => '&quot;')) . QUOTE;
    }
    */
    $field .= ' class="text" value="' . olc_parse_input_field_data($value, array(QUOTE => '&quot;')) . QUOTE;
    //W. Kaiser - AJAX
    if (AJAX_VALIDATE) {
        if (strpos($parameters, " id=") === false) {
            $parameters .= " id=\"" . $name . "\"";
        }
        if ($AJAX_validate) {
            $parameters .= " onchange=\"set_validation_required(this);AJAX_validate_element('" . $AJAX_caption . "','" . $name . "'," . $AJAX_required . ")\"";
            //$parameters .= " onkeydown=\"on_key_press();\"";
            //$parameters .= " onchange=\"set_validation_required(this);\"";
            $parameters .= " onfocus=\"clear_validation_required();\"";
        }
    }
    //W. Kaiser - AJAX
    if (olc_not_null($parameters)) {
        $field .= BLANK . $parameters;
    }
    $field .= '/>';
    //W. Kaiser - AJAX
    if (USE_AJAX) {
        if ($AJAX_validate) {
            if ($AJAX_add_span) {
                //If more then 1 valid answer is validated, offer selectionbox for selection of value
                //Allocate span for potential SELECT-box
                $field .= '<span id="' . $name . '_select"></span>';
            }
        }
    }
    //W. Kaiser - AJAX
    return $field;
}
Ejemplo n.º 8
0
function olc_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '')
{
    $name = $name = '"' . olc_parse_input_field_data($name, array(QUOTE => '&quot;')) . '"';
    $selection = '<input type="' . olc_parse_input_field_data($type, array(QUOTE => '&quot;')) . '" name=' . $name;
    $id_text = "id=";
    if (strpos($parameters, $id_text) === false) {
        $selection .= BLANK . $id_text . $name;
    }
    if (olc_not_null($value)) {
        $selection .= ' value="' . olc_parse_input_field_data($value, array(QUOTE => '&quot;')) . '"';
    }
    if ($checked == true || $GLOBALS[$name] == 'on' || $value && $GLOBALS[$name] == $value) {
        $selection .= ' checked="checked"';
    }
    if (olc_not_null($parameters)) {
        $selection .= BLANK . $parameters;
    }
    $selection .= '/>';
    return $selection;
}
function olc_image($src, $alt = '', $width = '', $height = '', $parameters = '')
{
    global $server, $force_scale;
    if (!$src) {
        $src = get_default_image();
    }
    $not_image_required = IMAGE_REQUIRED == FALSE_STRING_S;
    if ($not_image_required) {
        if (!$src || $src == DIR_WS_IMAGES) {
            return false;
        }
    }
    $rep = array(QUOTE => '&quot;');
    $src = olc_parse_input_field_data($src, $rep);
    /*
    if (IS_MULTI_SHOP)
    {
    $src=olc_set_multi_shop_dir_info($src);
    }
    */
    //Don't calculate if the image is a button
    //or set to a "%" width and/or height
    //or if a 'pixel' image is being passed (hope you dont have pixels for sale!)
    if ($force_scale) {
        $do_calculate = true;
    } elseif (strstr($src, '/buttons/') == false) {
        if (strstr($src, '/manufacturers/') == false) {
            if (strstr($width, PERCENT) == false) {
                if (strstr($height, PERCENT) == false) {
                    $do_calculate = strstr($src, 'pixel') == false;
                }
            }
        }
    }
    if ($do_calculate) {
        if (strpos($src, HASH . DOT) === false) {
            if (DO_IMAGE_ON_THE_FLY) {
                if (!file_exists($src)) {
                    $dir = DIR_WS_THUMBNAIL_IMAGES;
                    if (strpos($src, $dir) !== false) {
                        $img_type = 'thumbnail';
                    } else {
                        $dir = DIR_WS_INFO_IMAGES;
                        if (strpos($src, $dir) !== false) {
                            $img_type = 'info';
                        } else {
                            $dir = DIR_WS_POPUP_IMAGES;
                            if (strpos($src, $dir) !== false) {
                                $img_type = 'popup';
                            } else {
                                if (strpos($src, DIR_WS_ORIGINAL_IMAGES) !== false) {
                                    $src = get_default_image();
                                } else {
                                    $img_type = EMPTY_STRING;
                                }
                            }
                        }
                    }
                    if ($img_type) {
                        if ($force_scale) {
                            $srcn = $src;
                        } else {
                            $srcn = str_replace($img_type, 'original', $src);
                        }
                        $products_image_name = basename($srcn);
                        $src_path = ADMIN_PATH_PREFIX . $srcn;
                        if (file_exists($src_path)) {
                            $processsor = DIR_WS_INCLUDES . 'product_' . $img_type . '_images.php';
                            if (NOT_IS_ADMIN_FUNCTION) {
                                $prefix = 'admin/';
                                $processsor = $prefix . $processsor;
                            }
                            //$src_manipulation_text='image_manipulation';
                            if (!class_exists('image_manipulation')) {
                                $dir_fs_catalog = 'DIR_FS_CATALOG_';
                                define($dir_fs_catalog . 'IMAGES', ADMIN_PATH_PREFIX . DIR_WS_IMAGES);
                                define($dir_fs_catalog . 'ORIGINAL_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_ORIGINAL_IMAGES);
                                define($dir_fs_catalog . 'THUMBNAIL_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_THUMBNAIL_IMAGES);
                                define($dir_fs_catalog . 'INFO_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_INFO_IMAGES);
                                define($dir_fs_catalog . 'POPUP_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_POPUP_IMAGES);
                                include_once $prefix . DIR_WS_CLASSES . 'image_manipulator.php';
                            }
                            include $processsor;
                        } else {
                            return EMPTY_STRING;
                        }
                    }
                }
            }
            if (CONFIG_CALCULATE_IMAGE_SIZE) {
                // Do we calculate the image size?
                $do_calculate = !$width || !$height || $force_scale;
                if ($do_calculate) {
                    $src_size = @getimagesize($src);
                    if (!$src_size) {
                        $src_size = @getimagesize(get_default_image());
                    }
                    if ($src_size) {
                        $src_width = $src_size[0];
                        $src_height = $src_size[1];
                        // Set the width and height to the proper ratio
                        if (!($width || $height)) {
                            $width = $src_width;
                            $height = $src_height;
                            $ratio = $width / $height;
                        } else {
                            if (!$width) {
                                $ratio = $height / $src_height;
                                $width = intval($src_width * $ratio);
                            } else {
                                $ratio = $width / $src_width;
                                $height = intval($src_height * $ratio);
                            }
                        }
                        // Scale the image if not the original size
                        if ($src_width != $width || $src_height != $height || $force_scale) {
                            $rx = $src_width / $width;
                            $ry = $src_height / $height;
                            if ($rx < $ry) {
                                $width = intval($height / $ratio);
                            } else {
                                $height = intval($width * $ratio);
                            }
                        }
                    } elseif ($not_image_required) {
                        return false;
                    }
                }
            }
        }
    }
    // Add remaining image parameters if they exist
    $src = '<img src="' . $src . '" style="border:0px"';
    if (olc_not_null($alt)) {
        $alt = olc_parse_input_field_data($alt, $rep);
        $src .= ' title="' . $alt . QUOTE;
    }
    $src .= ' alt="' . $alt . QUOTE;
    if ($width) {
        $src .= ' width="' . $width . QUOTE;
    }
    if ($height) {
        $src .= ' height="' . $height . QUOTE;
    }
    if ($parameters) {
        $src .= BLANK . $parameters;
    } else {
        $src .= ' align="middle"';
    }
    $src .= '/>';
    return $src;
}