$key_str .= " )"; } $group_str = ''; $order_str = ' order by gt.gtext_title'; $listing_sql = $select_str . $from_str . $where_str . $key_str . $group_str . $order_str; $listing_split = new postPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'gt.gtext_id'); if (!$listing_split->number_of_rows && isset($keywords_array) && count($keywords_array) > 0) { $max_threshold = DEFAULT_SEARCH_SENSITIVITY; for ($i = 0, $n = sizeof($keywords_array); $i < $n; $i++) { $found_flag = false; switch ($keywords_array[$i]) { default: if (isset($score_array[md5($keywords_array[$i])])) { continue; } $key_len = tep_string_length($keywords_array[$i]); if ($key_len <= $max_threshold) { break; } unset($left_str, $left_count, $listing_left_split, $right_str, $right_count, $listing_right_split); for ($iterations = DEFAULT_SEARCH_ITERATIONS, $left_threshold = $key_len - 1; $left_threshold > $max_threshold && $iterations > 0; $left_threshold--, $iterations--) { $key_str = " and ("; //$keyword = $g_db->prepare_input($keywords_array[$i]); $keyword = $keywords_array[$i]; $keyword = substr($keyword, 0, $left_threshold); $key_str .= "(gt.gtext_title like '%" . $g_db->input($keyword) . "%' or gt.gtext_description like '%" . $g_db->input($keyword) . "%'"; $key_str .= ')'; $key_str .= " )"; $listing_sql = $select_str . $from_str . $where_str . $key_str . $group_str . $order_str; $listing_left_split = new postPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'gt.gtext_id'); if ($listing_left_split->number_of_rows > 0) {
$content_array[] = ''; } foreach ($zones_array as $id => $zone) { if (!$cSuper->is_enabled($id)) { continue; } $zone_class = $cSuper->get_zone_class($id); $module = DIR_WS_MODULES . $zone_class . '_mod.php'; $module_class = $zone_class . '_mod'; if (file_exists($module)) { require_once $module; $cModule = new $module_class($id); $result = $cModule->output(); // Execute a simple best fit routine to balance the columns $index = key($length_array); $length_array[$index] += tep_string_length(strip_tags($result)); $content_array[$index] .= '<div class="splitColumn">' . $result . '</div>' . "\n"; asort($length_array, SORT_NUMERIC); } } ?> <div class="cleaner" style="padding-top: 4px;"> <?php foreach ($content_array as $key => $value) { ?> <div class="colsplit floater"><?php echo $content_array[$key]; ?> </div> <?php }
function get_mixed_css_tree($id, &$max_drop, &$max_width) { $sub_array = array(); $count = $swidth = 0; $cSuper = new super_front(); $super_entries = $cSuper->get_entries($id, true); if (!count($super_entries)) { return $sub_array; } foreach ($super_entries as $key => $value) { $value['sub_alt_title'] = strtoupper($value['sub_alt_title']); $tmp_value = str_replace(' ', '', $value['sub_alt_title']); $awidth = tep_string_length($tmp_value) * 9 + 16; $value['sub_alt_title'] = htmlspecialchars(stripslashes($value['sub_alt_title'])); if ($awidth > $max_width) { $string_length = (int) ($max_width / 9); $value['sub_alt_title'] = substr($value['sub_alt_title'], 0, $string_length) . '...'; $awidth = $max_width; } if ($awidth > $swidth) { $swidth = $awidth; } $zone_class = $cSuper->get_zone_class($key); $script = FILENAME_COLLECTIONS; switch ($zone_class) { case 'image_zones': $process_function = 'tep_get_image_css_tree'; break; case 'super_zones': $process_function = 'tep_get_mixed_css_tree'; break; default: $process_function = 'tep_get_text_css_tree'; break; } $sub_array[] = '<div class="css_sub floater"[<<<MAX_WIDTH>>>]><a href="' . tep_href_link($script, 'abz_id=' . $value['subzone_id']) . '">' . $value['sub_alt_title'] . '</a></div>' . "\n"; $count++; if ($count > $max_drop) { $max_drop = $count; //$max_width = $swidth; //return $sub_array; } } $max_width = $swidth; return $sub_array; }
function post_validate($input_array) { extract(tep_load('sessions')); $result_array = array(); if (!is_array($input_array) || !count($input_array)) { return $result_array; } $default_array = array('max' => 1000, 'min' => 10, 'filter' => $this->default_filter, 'type' => 'string'); foreach ($input_array as $key => $value) { $result_array[$key] = array(); $property_array = $default_array; if (is_array($value)) { foreach ($value as $property => $pvalue) { if (isset($property_array[$property])) { $property_array[$property] = $pvalue; } } } if (isset($_POST[$key])) { $handled = false; switch ($property_array['type']) { case 'range': if ($_POST[$key] < $property_array['min']) { $result_array[$key]['min'] = $property_array['min']; } if ($_POST[$key] > $property_array['max']) { $result_array[$key]['max'] = $property_array['max']; } break; case 'string': default: settype($_POST[$key], "string"); $_POST[$key] = $this->convert_chars(stripslashes($_POST[$key])); if (tep_string_length($_POST[$key]) > $property_array['max']) { $result_array[$key]['max'] = $property_array['max']; } if (tep_string_length($_POST[$key]) < $property_array['min']) { $result_array[$key]['min'] = $property_array['min']; } $handled = true; break; } if (!$handled) { $_POST[$key] = $this->common_validate($_POST[$key], $property_array['filter']); } // In case a parameter conflicts with a session one skip if (!$cSessions->is_registered($_POST[$key])) { $GLOBALS[$key] = $_POST[$key]; } } else { $result_array[$key]['check'] = false; } } return $result_array; }