Пример #1
0
function tep_infopage_format($text)
{
    $text = tep_get_bb_code($text);
    $text = tep_infopage_to_seourls($text);
    $text = tep_get_gallery_in_infopage($text);
    $text = tep_get_module_in_infopage($text);
    return $text;
}
            $li_class = "odd";
        } else {
            $li_class = "even";
        }
        $parent_query = tep_db_query("SELECT i.infopages_id, it.infopages_title FROM infopages i JOIN infopages_text it USING (infopages_id) WHERE i.infopages_status = 1 AND i.infopages_id = '" . $results_infopages['parent_id'] . "' AND it.language_id = " . (int) $languages_id);
        $parent = tep_db_fetch_array($parent_query);
        $ip_content .= '<li class="' . $li_class . '"><a href="' . tep_href_link(FILENAME_INFOPAGE, 'page=' . $results_infopages['infopages_id'], 'SSL') . '" title="';
        if ($parent['infopages_title'] != '') {
            $ip_content .= $parent['infopages_title'] . ' - ';
        }
        $ip_content .= $results_infopages['infopages_title'];
        $ip_content .= '"><span><strong>' . $results_infopages['infopages_title'] . '</strong></span></a>';
        if ($parent['infopages_title'] != '') {
            $ip_content .= ' &nbsp;<i>(' . $parent['infopages_title'] . ')</i>';
        }
        $ip_content .= '<div class="ips_preview">' . substr(strip_tags(tep_infopage_to_seourls($results_infopages['infopages_description'])), 0, 320) . '...</div></li>';
    }
    $ip_content .= '</ul>';
} else {
    //log
    $check_log_query = tep_db_query("SELECT id, count FROM search_log WHERE keyword = '" . $keywords . "'");
    if (tep_db_num_rows($check_log_query) > 0) {
        $check_log = tep_db_fetch_array($check_log_query);
        $newcount = $check_log['count'] + 1;
        tep_db_query("UPDATE search_log SET count = '" . $newcount . "', results = '0' WHERE id = '" . (int) $check_log['id'] . "'");
    } else {
        tep_db_query("INSERT INTO search_log (id, keyword, count, results) VALUES ('', '" . $keywords . "', 1, 0)");
    }
    //log
}
//infopages search
Пример #3
0
function tep_get_module($block, $replace_space = true)
{
    global $languages_id, $sts, $currencies, $cart;
    $page = str_replace(DIR_WS_HTTP_CATALOG, '', $_SERVER['PHP_SELF']);
    if ($page == 'index.php' && (isset($_GET['cPath']) || isset($_GET['manufacturers_id']))) {
        $page = 'blablabla';
    }
    $limit_query = " AND (m.elements LIKE '%;i_" . $_GET['page'] . ";%' OR m.elements LIKE '%;p_" . $_GET['products_id'] . ";%' OR m.elements LIKE '%;" . $page . ";%' OR m.elements = ';' OR m.elements = '')";
    $get_module_query = tep_db_query("SELECT m.modules_id, mt.modules_title, mt.modules_description FROM modules m JOIN modules_text mt USING (modules_id) WHERE m.modules_status = '1'" . $limit_query . " AND m.block = '" . $block . "' AND mt.language_id = '" . (int) $languages_id . "' ORDER BY m.sort_order");
    while ($get_module = tep_db_fetch_array($get_module_query)) {
        /*language fallback*/
        if (LANGUAGE_FALLBACK == 'true' && $get_module['modules_description'] == '') {
            $language_fallback_query = tep_db_query("select modules_description from modules_text where modules_id = '" . (int) $get_module['modules_id'] . "' and language_id = '1'");
            $language_fallback = tep_db_fetch_array($language_fallback_query);
            $get_module['modules_description'] = $language_fallback['modules_description'];
        }
        /*language fallback*/
        if ($replace_space == true) {
            $get_module['modules_description'] = str_replace('&nbsp;', ' ', $get_module['modules_description']);
        }
        if ($get_module['modules_description'] == '<br />') {
            $get_module['modules_description'] = '';
        }
        $text = tep_infopage_to_seourls($get_module['modules_description']);
        if (strstr($text, '[box]')) {
            $text = str_replace('<p>', '', $text);
            $text = str_replace('</p>', '', $text);
            $text = trim($text);
            preg_match_all('/\\[box\\]([^\\[]*)\\[\\/box\\]/', $text, $matches);
            foreach ($matches[0] as $modulekey => $modulevalue) {
                $content = '';
                ob_start();
                if (USE_CACHE == 'true' && empty($SID)) {
                    if ($matches[1][$modulekey] == 'categories.php') {
                        echo tep_cache_categories_box();
                    } elseif ($matches[1][$modulekey] == 'manufacturers.php') {
                        echo tep_cache_manufacturers_box();
                    } else {
                        include DIR_FS_CATALOG . 'includes/boxes/' . $matches[1][$modulekey];
                    }
                } else {
                    include DIR_FS_CATALOG . 'includes/boxes/' . $matches[1][$modulekey];
                }
                $thisblockcontent = ob_get_contents();
                ob_end_clean();
                if ($matches[1][$modulekey] == 'compare.php') {
                    if (PRODUCT_COMPARE == 'true' && ($_GET['cPath'] || strstr($_SERVER['PHP_SELF'], FILENAME_PRODUCT_INFO))) {
                        $content = $thisblockcontent;
                    } else {
                        $content = '';
                    }
                } else {
                    $content = '<div class="box ' . str_replace('.php', '', $matches[1][$modulekey]) . '">' . $thisblockcontent . '</div>';
                }
                $text = str_replace($modulevalue, $content, $text);
            }
        } else {
            if ($text != '') {
                $text = '<div class="box ' . tep_get_module_class($get_module['modules_id']) . '">' . $text . '</div>';
            }
        }
        echo $text;
    }
}