notify('NOTIFY_SEFU_INTERCEPT', array(), $link, $page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
if($link !== null) return $link;
if (!zen_not_null($page)) {
die('
Error!
Unable to determine the page link!
');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == 'true') {
$link = HTTPS_SERVER ;
} else {
$link = HTTP_SERVER;
}
} else {
die('
Error!
Unable to determine connection method on a link!
Known methods: NONSSL SSL
');
}
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(constant('SID'))) {
$sid = constant('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 = preg_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 = 'notify('NOTIFY_HANDLE_IMAGE', array($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 = ' $height) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} else {
$height = $image_size[1] * $ratio;
}
// only use proportional image when image is larger than proportional size
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 if (substr($src, 0, 4) != 'http') {
$image .= ' width="' . intval(SMALL_IMAGE_WIDTH) . '" height="' . intval(SMALL_IMAGE_HEIGHT) . '"';
}
}
// inject rollover class if one is defined. NOTE: This could end up with 2 "class" elements if $parameters contains "class" already.
if (defined('IMAGE_ROLLOVER_CLASS') && IMAGE_ROLLOVER_CLASS != '') {
$parameters .= (zen_not_null($parameters) ? ' ' : '') . 'class="rollover"';
}
// add $parameters to the tag output
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 = '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 = '') {
global $css_button_text, $css_button_opts, $template, $current_page_base, $language;
$button_name = basename($image, '.gif');
// if no secondary class is set use the image name for the sec_class
if (empty($sec_class)) $sec_class = $button_name;
if(!empty($sec_class)) $sec_class = ' ' . $sec_class;
if(!empty($parameters))$parameters = ' ' . $parameters;
$mouse_out_class = 'cssButton ' . (($type == 'submit') ? 'submit_button button ' : 'normal_button button ') . $sec_class;
$mouse_over_class = 'cssButtonHover ' . (($type == 'button') ? 'normal_button button ' : '') . $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 (defined('CSS_BUTTON_POPUPS_IS_ARRAY') && CSS_BUTTON_POPUPS_IS_ARRAY == 'true') {
$popuptext = (!empty($css_button_text[$button_name])) ? $css_button_text[$button_name] : ($button_name . CSSBUTTONS_CATALOG_POPUPS_SHOW_BUTTON_NAMES_TEXT);
$tooltip = ' title="' . $popuptext . '"';
} else {
$tooltip = '';
}
$css_button = '';
if ($type == 'submit'){
// form input button
if ($parameters != '') {
// If the input parameters include a "name" attribute, need to emulate an return value by adding a _x to the name parameter (creds to paulm)
if (preg_match('/name="([a-zA-Z0-9\-_]+)"/', $parameters, $matches)) {
$parameters = str_replace('name="' . $matches[1], 'name="' . $matches[1] . '_x', $parameters);
}
// If the input parameters include a "value" attribute, remove it since that attribute will be set to the input text string.
if (preg_match('/(value="[a-zA-Z0=9\-_]+")/', $parameters, $matches)) {
$parameters = str_replace($matches[1], '', $parameters);
}
}
$css_button = '';
}
if ($type=='button'){
// link button
$css_button = ' ' . $text . ' ';
}
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 = '