Skip to content

Commit

Permalink
UNDO
Browse files Browse the repository at this point in the history
  • Loading branch information
acidvertigo committed Aug 16, 2011
1 parent 775b356 commit 6e05958
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 41 deletions.
4 changes: 2 additions & 2 deletions catalog/admin/includes/functions/general.php
Expand Up @@ -265,7 +265,7 @@ function tep_values_name($values_id) {
}

function tep_info_image($image, $alt, $width = '', $height = '') {
if (tep_not_null($image) && (file_exists(DIR_FS_CATALOG_IMAGES . $image)) ) {
if (tep_not_null($image) && (file_exists(DIR_FS_CATALOG_IMAGES . $image)) ) {
$image = tep_image(DIR_WS_CATALOG_IMAGES . $image, $alt, $width, $height);
} else {
$image = TEXT_IMAGE_NONEXISTENT;
Expand Down Expand Up @@ -887,7 +887,7 @@ function tep_generate_category_path($id, $from = 'category', $categories_array =
$category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query);
$categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']);
if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
}

return $categories_array;
Expand Down
27 changes: 16 additions & 11 deletions catalog/admin/includes/functions/html_output.php
Expand Up @@ -96,7 +96,7 @@ function tep_image_submit($image, $alt = '', $parameters = '') {

if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;

$image_submit .= ' />';

Expand Down Expand Up @@ -175,6 +175,7 @@ function tep_draw_form($name, $action, $parameters = '', $method = 'post', $para
////
// Output a form input field
function tep_draw_input_field($name, $value = '', $parameters = '', $required = false, $type = 'text', $reinsert_value = true) {
global $_GET, $_POST;

$field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

Expand All @@ -186,11 +187,11 @@ function tep_draw_input_field($name, $value = '', $parameters = '', $required =
}
}

if (isset($value)) {
if (tep_not_null($value)) {
if (tep_not_null($value)) {
$field .= ' value="' . tep_output_string($value) . '"';
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= ' />';

Expand Down Expand Up @@ -218,12 +219,13 @@ function tep_draw_file_field($name, $required = false) {
////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '') {

global $_GET, $_POST;

$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

if ( ($checked == true) || (isset($_GET[$name]) && is_string($_GET[$name]) && (($_GET[$name] == 'on') || (stripslashes($_GET[$name]) == $value))) || (isset($_POST[$name]) && is_string($_POST[$name]) && (($_POST[$name] == 'on') || (stripslashes($_POST[$name]) == $value))) || (tep_not_null($compare) && ($value == $compare)) ) {
if ( ($checked == true) || (isset($_GET[$name]) && is_string($_GET[$name]) && (($_GET[$name] == 'on') || (stripslashes($_GET[$name]) == $value))) || (isset($_POST[$name]) && is_string($_POST[$name]) && (($_POST[$name] == 'on') || (stripslashes($_POST[$name]) == $value))) || (tep_not_null($compare) && ($value == $compare)) ) {
$selection .= ' checked="checked"';
}

Expand All @@ -248,10 +250,11 @@ function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '
// Output a form textarea field
// The $wrap parameter is no longer used in the core xhtml template
function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
global $_GET, $_POST;

$field = '<textarea name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

Expand All @@ -273,7 +276,8 @@ function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $par
////
// Output a form hidden field
function tep_draw_hidden_field($name, $value = '', $parameters = '') {

global $_GET, $_POST;

$field = '<input type="hidden" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) {
Expand All @@ -286,7 +290,7 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') {
}
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= ' />';

Expand All @@ -308,7 +312,8 @@ function tep_hide_session_id() {
////
// Output a form pull down menu
function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {

global $_GET, $_POST;

$field = '<select name="' . tep_output_string($name) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
Expand Down Expand Up @@ -415,4 +420,4 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =

return $button;
}
?>
?>
8 changes: 4 additions & 4 deletions catalog/includes/functions/general.php
Expand Up @@ -450,7 +450,7 @@ function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {
$address_format = tep_db_fetch_array($address_format_query);

$company = tep_output_string_protected($address['company']);
if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
$firstname = tep_output_string_protected($address['firstname']);
$lastname = tep_output_string_protected($address['lastname']);
} elseif (isset($address['name']) && tep_not_null($address['name'])) {
Expand All @@ -467,10 +467,10 @@ function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {
if (isset($address['country_id']) && tep_not_null($address['country_id'])) {
$country = tep_get_country_name($address['country_id']);

if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
$state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);
}
} elseif (isset($address['country']) && isset($address['country'])) {
} elseif (isset($address['country']) && tep_not_null($address['country'])) {
$country = tep_output_string_protected($address['country']['title']);
} else {
$country = '';
Expand Down Expand Up @@ -1366,4 +1366,4 @@ function tep_convert_linefeeds($from, $to, $string) {
return str_replace($from, $to, $string);
}
}
?>
?>
48 changes: 24 additions & 24 deletions catalog/includes/functions/html_output.php
Expand Up @@ -17,7 +17,7 @@ function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $ad

$page = tep_output_string($page);

if (!tep_not_null($page)) {
if (!isset($page)) {
$PHP_SELF = $_SERVER['PHP_SELF'];
if ( empty($PHP_SELF) )
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
Expand Down Expand Up @@ -48,7 +48,7 @@ function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $ad

// 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 (tep_not_null($SID)) {
if (isset($SID)) {
$_sid = $SID;
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
Expand Down Expand Up @@ -85,16 +85,16 @@ function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '')
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) {
if (isset($alt)) {
$image .= ' title=" ' . tep_output_string($alt) . ' "';
}

if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
if ($image_size = @getimagesize($src)) {
if (empty($width) && tep_not_null($height)) {
if (empty($width) && isset($height)) {
$ratio = $height / $image_size[1];
$width = (int)($image_size[0] * $ratio);
} elseif (tep_not_null($width) && empty($height)) {
} elseif (isset($width) && empty($height)) {
$ratio = $width / $image_size[0];
$height = (int)($image_size[1] * $ratio);
} elseif (empty($width) && empty($height)) {
Expand All @@ -106,11 +106,11 @@ function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '')
}
}

if (tep_not_null($width) && tep_not_null($height)) {
if (isset($width) && isset($height)) {
$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}

if (tep_not_null($parameters)) $image .= ' ' . $parameters;
if (isset($parameters)) $image .= ' ' . $parameters;

$image .= ' />';

Expand All @@ -125,9 +125,9 @@ function tep_image_submit($image, $alt = '', $parameters = '') {

$image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';
if (isset($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
if (isset($parameters)) $image_submit .= ' ' . $parameters;

$image_submit .= ' />';

Expand Down Expand Up @@ -155,7 +155,7 @@ function tep_draw_form($name, $action, $method = 'post', $parameters = '', $toke

$form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';

if (tep_not_null($parameters)) $form .= ' ' . $parameters;
if (isset($parameters)) $form .= ' ' . $parameters;

$form .= '>';

Expand All @@ -180,11 +180,11 @@ function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'tex
}
}

if (tep_not_null($value)) {
if (isset($value)) {
$field .= ' value="' . tep_output_string($value) . '"';
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (isset($parameters)) $field .= ' ' . $parameters;

$field .= ' />';

Expand All @@ -203,13 +203,13 @@ function tep_draw_selection_field($name, $type, $value = '', $checked = false, $

$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';
if (isset($value)) $selection .= ' value="' . tep_output_string($value) . '"';

if ( ($checked == true) || (isset($_GET[$name]) && is_string($_GET[$name]) && (($_GET[$name] == 'on') || (stripslashes($_GET[$name]) == $value))) || (isset($_POST[$name]) && is_string($_POST[$name]) && (($_POST[$name] == 'on') || (stripslashes($_POST[$name]) == $value))) ) {
$selection .= ' checked="checked"';
}

if (tep_not_null($parameters)) $selection .= ' ' . $parameters;
if (isset($parameters)) $selection .= ' ' . $parameters;

$selection .= ' />';

Expand All @@ -235,8 +235,8 @@ function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $par

$field = '<textarea name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (isset($parameters)) $field .= ' ' . $parameters;

$field .= '>';

if ( ($reinsert_value == true) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
Expand All @@ -245,7 +245,7 @@ function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $par
} elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
$field .= tep_output_string_protected(stripslashes($_POST[$name]));
}
} elseif (tep_not_null($text)) {
} elseif (isset($text)) {
$field .= tep_output_string_protected($text);
}

Expand All @@ -260,7 +260,7 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') {

$field = '<input type="hidden" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) {
if (isset($value)) {
$field .= ' value="' . tep_output_string($value) . '"';
} elseif ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) {
if ( (isset($_GET[$name]) && is_string($_GET[$name])) ) {
Expand All @@ -270,8 +270,8 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') {
}
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (isset($parameters)) $field .= ' ' . $parameters;

$field .= ' />';

return $field;
Expand All @@ -282,7 +282,7 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') {
function tep_hide_session_id() {
global $session_started, $SID;

if (($session_started == true) && tep_not_null($SID)) {
if (($session_started == true) && isset($SID)) {
return tep_draw_hidden_field(tep_session_name(), tep_session_id());
}
}
Expand All @@ -293,7 +293,7 @@ function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = ''

$field = '<select name="' . tep_output_string($name) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;
if (isset($parameters)) $field .= ' ' . $parameters;

$field .= '>';

Expand Down Expand Up @@ -412,4 +412,4 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =

return $button;
}
?>
?>

0 comments on commit 6e05958

Please sign in to comment.