Tried this, didn't work for me. I may just end up having to redo my header and hunt down all of my invalid url's and changing them. DOH!!! :censored:
Printable View
Okay, nevermind about the whole index.php addon. It's not going to be as hard as I though to change all of this. I've just gotta purchase adobe flash to modify this header so it all works. Thanks for the help!
Cane Master - don't buy a full copy of flash straight away. Visit the adobe site, and you may be able to use their trial for 30 days until you decide this is definately the software you want to buy. The trial version will still let you modify and save teh files.
Secondly, when you re-create the links, create them as proper Zen links, so index.php?main_page=xxxx links. Search engines won't take any notice of teh flash links anyway, and regards of which SEO module you install, these links will always work.
Absolute
Hello!
I have some questions!
1. Help to make, please, that at different languages was as well the different text in url. That is:
www.mysite.com/language-1-p-300.html
www.mysite.com/language-2-p-300.html?language=en
(but it is better, that, also, have helped to make as follows
www.mysite.com/language-2-p-300-l-en.html)
2. How to make redirect 301 for the others wrong requestions to page:
- www.mysite.com/lanage-1-p-300.html => redirect 301 => www.mysite.com/language-1-p-300.html
- www.mysite.com/languagedasfas-1-p-300.html => redirect 301 => www.mysite.com/language-1-p-300.html
Thank you!
Hello Everyone,
please help me to install Ultimate seo url.
I read instruction in read me file but they are inadequate and I am not getting anywhere :frusty:
I already installed zencart on my root folder now please somebody let me know which file I have to copy and where? :ohmy:
Thanks everyone in advance please give me your five minuts help :smile:
Samin
Hi everyone,
I've been using this mod on my site and everything is fine apart from one thing. If you visit http://www.handcrafteduk.com/40cmpai...rum-p-174.html you'll see that my MP3 clip has .html after it. When I turn off the mod it is fine.
I know i'm using an older version but i tried installing the new one. When this was done, I found the checkout wasn't displaying the https even though secure checkout is enabled. That's why I thought I'd stick with the version I have!
So, could someone PLEASE tell me how to get rid of that .html at the end of the link? I'd really appreciate it.
FYI, I have included the code from includes/function/html_output.php
Quote:
<?php
/**
* html_output.php
* HTML-generating functions used throughout the core
*
* @package functions
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: html_output.php 4263 2006-08-25 06:13:19Z drbyte $
*/
////
// Ultimate SEO URLs v2.100
// The HTML href link wrapper function
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {
if (!isset($GLOBALS['seo_urls']) && !is_object($GLOBALS['seo_urls'])) {
include_once(DIR_WS_CLASSES . 'seo.url.php');
$GLOBALS['seo_urls'] = &new SEO_URL($_SESSION['languages_id']);
}
return $GLOBALS['seo_urls']->href_link($page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
}
/*
* The HTML href link wrapper function
*/
function original_zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {
global $request_type, $session_started, $http_domain, $https_domain;
if (!zen_not_null($page)) {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine the page link!</strong><br /><br />');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == 'true') {
$link = HTTPS_SERVER ;
} else {
$link = HTTP_SERVER;
}
} else {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
}
if ($use_dir_ws_catalog) {
if ($connection == 'SSL' && ENABLE_SSL == 'true') {
$link .= DIR_WS_HTTPS_CATALOG;
} else {
$link .= DIR_WS_CATALOG;
}
}
if (!$static) {
if (zen_not_null($parameters)) {
$link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
} else {
$link .= 'index.php?main_page=' . $page;
}
} else {
if (zen_not_null($parameters)) {
$link .= $page . "?" . zen_output_string($parameters);
} 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') && zen_not_null(SID)) {
$sid = SID;
// } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL_ADMIN == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if ($http_domain != $https_domain) {
$sid = zen_session_name() . '=' . zen_session_id();
}
}
}
// clean up the link before processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = str_replace('&', '/', $link);
$link = str_replace('?', '/', $link);
$link = str_replace('&', '/', $link);
$link = str_replace('=', '/', $link);
$separator = '?';
}
if (isset($sid)) {
$link .= $separator . zen_output_string($sid);
}
// clean up the link after processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = ereg_replace('&', '&', $link);
return $link;
}
/*
* The HTML image wrapper function for non-proportional images
* used when "proportional images" is turned off or if calling from a template directory
*/
function zen_image_OLD($src, $alt = '', $width = '', $height = '', $parameters = '') {
global $template_dir;
//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
// if not in current template switch to template_default
if (!file_exists($src)) {
$src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}
// 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="' . zen_output_string($src) . '" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) {
$image .= ' title=" ' . zen_output_string($alt) . ' "';
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
if ($image_size = @getimagesize($src)) {
if (empty($width) && zen_not_null($height)) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} elseif (zen_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 (IMAGE_REQUIRED == 'false') {
return false;
}
}
if (zen_not_null($width) && zen_not_null($height)) {
$image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
}
if (zen_not_null($parameters)) $image .= ' ' . $parameters;
$image .= ' />';
return $image;
}
/*
* The HTML image wrapper function
*/
function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
global $template_dir;
// soft clean the alt tag
$alt = zen_clean_html($alt);
// use old method on template images
if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {
return zen_image_OLD($src, $alt, $width, $height, $parameters);
}
//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
// if not in current template switch to template_default
if (!file_exists($src)) {
$src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}
// hook for handle_image() function such as Image Handler etc
if (function_exists('handle_image')) {
$newimg = handle_image($src, $alt, $width, $height, $parameters);
list($src, $alt, $width, $height, $parameters) = $newimg;
}
// Convert width/height to int for proper validation.
// intval() used to support compatibility with plugins like image-handler
$width = empty($width) ? $width : intval($width);
$height = empty($height) ? $height : intval($height);
// 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="' . zen_output_string($src) . '" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) {
$image .= ' title=" ' . zen_output_string($alt) . ' "';
}
if ( ((CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height))) ) {
if ($image_size = @getimagesize($src)) {
if (empty($width) && zen_not_null($height)) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} elseif (zen_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 (IMAGE_REQUIRED == 'false') {
return false;
}
}
if (zen_not_null($width) && zen_not_null($height) and file_exists($src)) {
// $image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
// proportional images
$image_size = @getimagesize($src);
// fix division by zero error
$ratio = ($image_size[0] != 0 ? $width / $image_size[0] : 1);
if ($image_size[1]*$ratio > $height) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} else {
$height = $image_size[1] * $ratio;
}
// BMZ IH2: intval for width and height since proportional images
// calculate float. int is needed for the code to validate
if ($image_size[0] < $width and $image_size[1] < $height) {
$image .= ' width="' . $image_size[0] . '" height="' . intval($image_size[1]) . '"';
} else {
$image .= ' width="' . round($width) . '" height="' . round($height) . '"';
}
} else {
// override on missing image to allow for proportional and required/not required
if (IMAGE_REQUIRED == 'false') {
return false;
} else {
// BMZ IH2: Again intval for width and height
$image .= ' width="' . intval(SMALL_IMAGE_WIDTH) . '" height="' . intval(SMALL_IMAGE_HEIGHT) . '"';
}
}
if (zen_not_null($parameters)) $image .= ' ' . $parameters;
$image .= ' />';
return $image;
}
/*
* The HTML form submit button wrapper function
* Outputs a "submit" button in the selected language
*/
function zen_image_submit($image, $alt = '', $parameters = '', $sec_class = '') {
global $template, $current_page_base, $zco_notifier;
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class /*, $parameters = ''*/ );
$zco_notifier->notify('PAGE_OUTPUT_IMAGE_SUBMIT');
$image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';
if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;
$image_submit .= ' />';
return $image_submit;
}
/*
* Output a function button in the selected language
*/
function zen_image_button($image, $alt = '', $parameters = '', $sec_class = '') {
global $template, $current_page_base, $zco_notifier;
$zco_notifier->notify('PAGE_OUTPUT_IMAGE_BUTTON');
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');
return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
}
/**
* generate CSS buttons in the current language
* concept from contributions by Seb Rouleau and paulm, subsequently adapted to Zen Cart
* note: any hard-coded buttons will not be able to use this function
**/
function zenCssButton($image = '', $text, $type, $sec_class = '', $parameters = '') {
// automatic width setting depending on the number of characters
$min_width = 80; // this is the minimum button width, change the value as you like
$character_width = 6.5; // change this value depending on font size!
// end settings
// added html_entity_decode function to prevent html special chars to be counted as multiple characters (like &)
$width = strlen(html_entity_decode($text)) * $character_width;
$width = (int)$width;
if ($width < $min_width) $width = $min_width;
$style = ' style="width: ' . $width . 'px;"';
// if no secondary class is set use the image name for the sec_class
if (empty($sec_class)) $sec_class = basename($image, '.gif');
if(!empty($sec_class))$sec_class = ' ' . $sec_class;
if(!empty($parameters))$parameters = ' ' . $parameters;
$mouse_out_class = 'cssButton' . $sec_class;
$mouse_over_class = 'cssButtonHover' . $sec_class . $sec_class . 'Hover';
// javascript to set different classes on mouseover and mouseout: enables hover effect on the buttons
// (pure css hovers on non link elements do work work in every browser)
$css_button_js .= 'onmouseover="this.className=\''. $mouse_over_class . '\'" onmouseout="this.className=\'' . $mouse_out_class . '\'"';
if ($type == 'submit'){
// form input button
$css_button = '<input class="' . $mouse_out_class . '" ' . $css_button_js . ' type="submit" value="' .$text . '"' . $parameters . $style . ' />';
}
if ($type=='button'){
// link button
$css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $style . ' > ' . $text . ' </span>'; // add $parameters ???
}
return $css_button;
}
/*
* Output a separator either through whitespace, or with an image
*/
function zen_draw_separator($image = 'true', $width = '100%', $height = '1') {
// set default to use from template - zen_image will translate if not found in current template
if ($image == 'true') {
$image = DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_BLACK_SEPARATOR;
} else {
if (!strstr($image, DIR_WS_TEMPLATE_IMAGES)) {
$image = DIR_WS_TEMPLATE_IMAGES . $image;
}
}
return zen_image($image, '', $width, $height);
}
/*
* Output a form
*/
function zen_draw_form($name, $action, $method = 'post', $parameters = '') {
$form = '<form name="' . zen_output_string($name) . '" action="' . zen_output_string($action) . '" method="' . zen_output_string($method) . '"';
if (zen_not_null($parameters)) $form .= ' ' . $parameters;
$form .= '>';
return $form;
}
/*
* Output a form input field
*/
function zen_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
$field = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= ' />';
return $field;
}
/*
* Output a form password field
*/
function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
return zen_draw_input_field($name, $value, $parameters, 'password', true);
}
/*
* Output a selection field - alias function for zen_draw_checkbox_field() and zen_draw_radio_field()
*/
function zen_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
$selection = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) $selection .= ' value="' . zen_output_string($value) . '"';
if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
$selection .= ' checked="checked"';
}
if (zen_not_null($parameters)) $selection .= ' ' . $parameters;
$selection .= ' />';
return $selection;
}
/*
* Output a form checkbox field
*/
function zen_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
return zen_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
}
/*
* Output a form radio field
*/
function zen_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
return zen_draw_selection_field($name, 'radio', $value, $checked, $parameters);
}
/*
* Output a form textarea field
*/
function zen_draw_textarea_field($name, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
$field = '<textarea name="' . zen_output_string($name) . '" cols="' . zen_output_string($width) . '" rows="' . zen_output_string($height) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= stripslashes($GLOBALS[$name]);
} elseif (zen_not_null($text)) {
$field .= $text;
}
$field .= '</textarea>';
return $field;
}
/*
* Output a form hidden field
*/
function zen_draw_hidden_field($name, $value = '', $parameters = '') {
$field = '<input type="hidden" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
} elseif (isset($GLOBALS[$name])) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= ' />';
return $field;
}
/*
* Output a form file-field
*/
function zen_draw_file_field($name, $required = false) {
$field = zen_draw_input_field($name, '', ' size="50" ', 'file');
return $field;
}
/*
* Hide form elements while including session id info
* IMPORTANT: This should be used in every FORM that has an OnSubmit() function tied to it, to prevent unexpected logouts
*/
function zen_hide_session_id() {
global $session_started;
if ( ($session_started == true) && defined('SID') && zen_not_null(SID) ) {
return zen_draw_hidden_field(zen_session_name(), zen_session_id());
}
}
/*
* Output a form pull down menu
* Pulls values from a passed array, with the indicated option pre-selected
*/
function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
$field = '<select name="' . zen_output_string($name) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>' . "\n";
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= ' <option value="' . zen_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' selected="selected"';
}
$field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>' . "\n";
}
$field .= '</select>' . "\n";
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
}
/*
* Creates a pull-down list of countries
*/
function zen_get_country_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = zen_get_countries();
for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
}
return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
/*
* The HTML attribute image wrapper function
*/
function zen_attribute_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
global $template_dir;
// soft clean the alt tag
$alt = zen_clean_html($alt);
// use old method on template images
if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {
return zen_image_OLD($src, $alt, $width, $height, $parameters);
}
//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
// if not in current template switch to template_default
if (!file_exists($src)) {
$src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}
// hook for handle_image() function such as Image Handler etc
if (function_exists('handle_image')) {
$newimg = handle_image($src, $alt, $width, $height, $parameters);
list($src, $alt, $width, $height, $parameters) = $newimg;
}
// Convert width/height to int for proper validation.
// intval() used to support compatibility with plugins like image-handler
$width = empty($width) ? $width : intval($width);
$height = empty($height) ? $height : intval($height);
// 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="thumb.php?src=' . zen_output_string($src) . '&x=100&y=100&f=0" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) {
$image .= ' title=" ' . zen_output_string($alt) . ' "';
}
if (zen_not_null($parameters)) $image .= ' ' . $parameters;
$image .= ' onclick="popupWindow(\'index.php?main_page=popup_image&src='.zen_output_string($ src).'\')"';
$image .= ' />';
return $image;
}
?>
@HandcraftedUK - that link seems to be working perfectly. Does this mean that you have fixed the problem, or altered the coding?
Absolute
@saminshah - what have you done so far? Have you followed the Readme and the Install files? There is also a link included in the readme to the developer's site, where full install instructions are shown.
If you can be a bit more specific as to which bit you are struggling with, someone can give you a pointer. A general HELP is a little vague unfortunately.
Absolute
Hello,
Thanks for the reply. I decided to install the 2.106 version which fixed the problem and even got the secure checkout working. BUT, i have now run into another problem!
When looking at products everything is fine UNLESS they have attributes attached to them. In that case, the screen goes blank. For example, on this page:
http://www.handcrafteduk.com/ethnicg...ls-c-3_51.html
Click on the singing bowl book and everything is okay. But, click on any of the singing bowls and it won't work. It's definitely something to do with attributes as products with multiple images are okay.
Any idea what's wrong? Again, I've included the info from my new html_output file
Thanks,Quote:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: html_output.php 3089 2006-03-01 18:32:25Z ajeh $
//
////
// The HTML href link wrapper function
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true) {
global $request_type, $session_started, $http_domain, $https_domain;
if ($page == '') {
die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>Function used:<br><br>zen_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER . DIR_WS_ADMIN;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL_ADMIN == 'true') {
$link = HTTPS_SERVER . DIR_WS_HTTPS_ADMIN;
} else {
$link = HTTP_SERVER . DIR_WS_ADMIN;
}
} else {
die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>zen_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
}
if (!strstr($page, '.php')) $page .= '.php';
if ($parameters == '') {
$link = $link . $page;
$separator = '?';
} else {
$link = $link . $page . '?' . $parameters;
$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) ) {
if (defined('SID') && zen_not_null(SID)) {
$sid = SID;
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL_ADMIN == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
//die($connection);
if ($http_domain != $https_domain) {
$sid = zen_session_name() . '=' . zen_session_id();
}
}
}
if (isset($sid)) {
$link .= $separator . $sid;
}
return $link;
}
function zen_catalog_href_link($page = '', $parameters = '', $connection = 'NONSSL') {
if ($connection == 'NONSSL') {
$link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL_CATALOG == 'true') {
$link = HTTPS_CATALOG_SERVER . DIR_WS_HTTPS_CATALOG;
} else {
$link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
}
} else {
die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>zen_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
}
if ($parameters == '') {
$link .= 'index.php?main_page='. $page;
} else {
$link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
}
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
return $link;
}
////
// The HTML image wrapper function
function zen_image($src, $alt = '', $width = '', $height = '', $params = '') {
$image = '<img src="' . $src . '" border="0" alt="' . $alt . '"';
if ($alt) {
$image .= ' title=" ' . $alt . ' "';
}
if ($width) {
$image .= ' width="' . $width . '"';
}
if ($height) {
$image .= ' height="' . $height . '"';
}
if ($params) {
$image .= ' ' . $params;
}
$image .= '>';
return $image;
}
////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
function zen_image_submit($image, $alt = '', $parameters = '') {
global $language;
$image_submit = '<input type="image" src="' . zen_output_string(DIR_WS_LANGUAGES . $_SESSION['language'] . '/images/buttons/' . $image) . '" border="0" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';
if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;
$image_submit .= '>';
return $image_submit;
}
////
// Draw a 1 pixel black line
function zen_black_line() {
return zen_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '1');
}
////
// Output a separator either through whitespace, or with an image
function zen_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
return zen_image(DIR_WS_IMAGES . $image, '', $width, $height);
}
////
// Output a function button in the selected language
function zen_image_button($image, $alt = '', $params = '') {
global $language;
return zen_image(DIR_WS_LANGUAGES . $_SESSION['language'] . '/images/buttons/' . $image, $alt, '', '', $params);
}
////
// javascript to dynamically update the states/provinces list when the country is changed
// TABLES: zones
function zen_js_zone_list($country, $form, $field) {
global $db;
$countries = $db->Execute("select distinct zone_country_id
from " . TABLE_ZONES . "
order by zone_country_id");
$num_country = 1;
$output_string = '';
while (!$countries->EOF) {
if ($num_country == 1) {
$output_string .= ' if (' . $country . ' == "' . $countries->fields['zone_country_id'] . '") {' . "\n";
} else {
$output_string .= ' } else if (' . $country . ' == "' . $countries->fields['zone_country_id'] . '") {' . "\n";
}
$states = $db->Execute("select zone_name, zone_id
from " . TABLE_ZONES . "
where zone_country_id = '" . $countries->fields['zone_country_id'] . "'
order by zone_name");
$num_state = 1;
while (!$states->EOF) {
if ($num_state == '1') $output_string .= ' ' . $form . '.' . $field . '.options[0] = new Option("' . PLEASE_SELECT . '", "");' . "\n";
$output_string .= ' ' . $form . '.' . $field . '.options[' . $num_state . '] = new Option("' . $states->fields['zone_name'] . '", "' . $states->fields['zone_id'] . '");' . "\n";
$num_state++;
$states->MoveNext();
}
$num_country++;
$countries->MoveNext();
}
$output_string .= ' } else {' . "\n" .
' ' . $form . '.' . $field . '.options[0] = new Option("' . TYPE_BELOW . '", "");' . "\n" .
' }' . "\n";
return $output_string;
}
////
// Output a form
function zen_draw_form($name, $action, $parameters = '', $method = 'post', $params = '', $usessl = 'false') {
$form = '<form name="' . zen_output_string($name) . '" action="';
if (zen_not_null($parameters)) {
if ($usessl) {
$form .= zen_href_link($action, $parameters, 'NONSSL');
} else {
$form .= zen_href_link($action, $parameters, 'NONSSL');
}
} else {
if ($usessl) {
$form .= zen_href_link($action, '', 'NONSSL');
} else {
$form .= zen_href_link($action, '', 'NONSSL');
}
}
$form .= '" method="' . zen_output_string($method) . '"';
if (zen_not_null($params)) {
$form .= ' ' . $params;
}
$form .= '>';
return $form;
}
////
// Output a form input field
function zen_draw_input_field($name, $value = '', $parameters = '', $required = false, $type = 'text', $reinsert_value = true) {
$field = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if (isset($GLOBALS[$name]) && ($reinsert_value == true) && is_string($GLOBALS[$name])) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
}
////
// Output a form password field
function zen_draw_password_field($name, $value = '', $required = false) {
$field = zen_draw_input_field($name, $value, 'maxlength="40"', $required, 'password', false);
return $field;
}
////
// Output a form filefield
function zen_draw_file_field($name, $required = false) {
$field = zen_draw_input_field($name, '', ' size="50" ', $required, 'file');
return $field;
}
////
// Output a selection field - alias function for zen_draw_checkbox_field() and zen_draw_radio_field()
function zen_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $parameters = '') {
$selection = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) $selection .= ' value="' . zen_output_string($value) . '"';
if ( ($checked == true) || (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ($GLOBALS[$name] == 'on')) || (isset($value) && isset($GLOBALS[$name]) && (stripslashes($GLOBALS[$name]) == $value)) || (zen_not_null($value) && zen_not_null($compare) && ($value == $compare)) ) {
$selection .= ' CHECKED';
}
if (zen_not_null($parameters)) $selection .= ' ' . $parameters;
$selection .= '>';
return $selection;
}
////
// Output a form checkbox field
function zen_draw_checkbox_field($name, $value = '', $checked = false, $compare = '', $parameters = '') {
return zen_draw_selection_field($name, 'checkbox', $value, $checked, $compare, $parameters);
}
////
// Output a form radio field
function zen_draw_radio_field($name, $value = '', $checked = false, $compare = '', $parameters = '') {
return zen_draw_selection_field($name, 'radio', $value, $checked, $compare, $parameters);
}
////
// Output a form textarea field
function zen_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
$field = '<textarea name="' . zen_output_string($name) . '" wrap="' . zen_output_string($wrap) . '" cols="' . zen_output_string($width) . '" rows="' . zen_output_string($height) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= stripslashes($GLOBALS[$name]);
} elseif (zen_not_null($text)) {
$field .= $text;
}
$field .= '</textarea>';
return $field;
}
////
// Output a form hidden field
function zen_draw_hidden_field($name, $value = '', $parameters = '') {
$field = '<input type="hidden" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
} elseif (isset($GLOBALS[$name]) && is_string($GLOBALS[$name])) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
return $field;
}
////
// Output a form pull down menu
function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
// $field = '<select name="' . zen_output_string($name) . '"';
$field = '<select rel="dropdown" name="' . zen_output_string($name) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= '<option value="' . zen_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' SELECTED';
}
$field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
}
$field .= '</select>';
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
}
////
// Hide form elements
function zen_hide_session_id() {
global $session_started;
if ( ($session_started == true) && defined('SID') && zen_not_null(SID) ) {
return zen_draw_hidden_field(zen_session_name(), zen_session_id());
}
}
?>
Gary :smile:
Whooo hooo - sorted! :smile:
Basically, i copied and pasted everything below
// The HTML form submit button wrapper function
from the old file to the new one. It works now.
Well, i've got a right mish mash of forms going on here but, as long as it works, that's the main thing!!! :smile: