Ejemplo n.º 1
0
function optimizeForSearch()
{
    // used to build a string optimized for search
    $numargs = func_num_args();
    $text = '';
    if ($numargs) {
        for ($i = 0; $i < $numargs; $i++) {
            $text .= ' ' . func_get_arg($i);
        }
        $text = stripped_cache_content($text);
        $text = cleanUpSpecialHtmlEntities($text);
        $text = decode_entities($text);
        $text = str_replace(array('!', '"', "'", '.', '#', ';', '~', '+', '*', '%', '&', '$', '§', ':', '@', ',', '|'), ' ', $text);
        $text = preg_replace('/\\[.*?\\]/', '', $text);
        $text = preg_replace('/\\{.*?\\}/', '', $text);
        $text = strtoupper($text);
        $text = implode(' ', convertStringToArray($text, ' ', 'UNIQUE', false));
    }
    return $text;
}
Ejemplo n.º 2
0
if (empty($crow["acontent_template"]) && is_file(PHPWCMS_TEMPLATE . 'inc_default/search.tmpl')) {
    $crow["acontent_template"] = render_device(@file_get_contents(PHPWCMS_TEMPLATE . 'inc_default/search.tmpl'));
} elseif (is_file(PHPWCMS_TEMPLATE . 'inc_cntpart/search/' . $crow["acontent_template"])) {
    $crow["acontent_template"] = render_device(@file_get_contents(PHPWCMS_TEMPLATE . 'inc_cntpart/search/' . $crow["acontent_template"]));
} else {
    $crow["acontent_template"] = '';
}
$crow['template'] = array('header' => get_tmpl_section('SEARCH_HEADER', $crow["acontent_template"]), 'footer' => get_tmpl_section('SEARCH_FOOTER', $crow["acontent_template"]), 'item_space' => get_tmpl_section('SEARCH_ITEM_SPACER', $crow["acontent_template"]), 'item' => get_tmpl_section('SEARCH_ITEM', $crow["acontent_template"]), 'pagination' => trim(get_tmpl_section('SEARCH_PAGINATE', $crow["acontent_template"])), 'text' => '', 'form' => '', 'image_render' => false);
if (!empty($_POST["search_input_field"]) || !empty($_GET['searchwords'])) {
    $s_run = 0;
    // check search
    // remove unsecure replacement tags
    $content["search_word"] = empty($_POST["search_input_field"]) ? rawurldecode($_GET['searchwords']) : $_POST["search_input_field"];
    $content["search_word"] = clean_slweg($content["search_word"]);
    $content["search_word"] = clean_replacement_tags($content["search_word"]);
    $content["search_word"] = cleanUpSpecialHtmlEntities($content["search_word"]);
    // split all search words
    $content["search_word"] = explode(' ', $content["search_word"]);
    $content["search_word"] = array_unique($content["search_word"]);
    $content['search']['highlight_result'] = empty($content["search"]['highlight_result']) ? false : true;
    $content['search']['wordlimit'] = isset($content["search"]['wordlimit']) && is_intval($content["search"]['wordlimit']) ? intval($content["search"]['wordlimit']) : 35;
    $content["search"]["result_per_page"] = empty($content["search"]['result_per_page']) ? 15 : $content["search"]['result_per_page'];
    if ($content["search"]["result_per_page"] == -1) {
        $content["search"]["result_per_page"] = 100000;
    }
    if (!isset($content["search"]["show_always"])) {
        $content["search"]["show_always"] = 1;
    }
    if (!isset($content["search"]["show_top"])) {
        $content["search"]["show_top"] = 1;
    }
Ejemplo n.º 3
0
function clean_search_text($string = '')
{
    $string = strip_tags($string);
    $string = strip_bbcode($string);
    $string = clean_replacement_tags($string);
    $string = remove_unsecure_rptags($string);
    $string = str_replace('&nbsp;', ' ', $string);
    $string = preg_replace('/\\s+/', ' ', $string);
    $string = cleanUpSpecialHtmlEntities($string);
    return $string;
}
Ejemplo n.º 4
0
$_Tracking_StatCounterCode = '000000';
$_Tracking_StatCounterSecCode = 'aaaaaaaaa';
$_Tracking_StatCounterPartition = 5;
$_Tracking_StatCounterSSL = false;
/*
 * eTracker
 * eTracker is a widely used tracking solution in Germany
 */
$_Tracking_eTracker = false;
$_Tracking_eTrackerCode = '000000';
$_Tracking_eTrackerSSL = false;
/// some minor things ////////////////////////////////////////////////////////////////////////////
$_TrackingCategory = array();
if (is_array($LEVEL_STRUCT) && count($LEVEL_STRUCT)) {
    $_TrackingCategory['phpwcmscategory'] = implode('%%%', $LEVEL_STRUCT);
    $_TrackingCategory['phpwcmscategory'] = cleanUpSpecialHtmlEntities($_TrackingCategory['phpwcmscategory']);
    $_TrackingCategory['phpwcmscategory'] = str_replace(array("'", '"', '/', ' ', '%%%'), array('', '', '-', '_', '/'), $_TrackingCategory['phpwcmscategory']);
}
$_TrackingAlias = PHPWCMS_ALIAS;
if ($_TrackingAlias == '') {
    if ($aktion[1]) {
        $_TrackingAlias = 'aid=' . $aktion[1];
    } elseif ($aktion[0]) {
        $_TrackingAlias = 'id=' . $aktion[0];
    }
}
$_TrackingPageName = abs_url($_TrackingCategory, array(), $_TrackingAlias, 'rawurlencode');
/// phpMyVisites /////////////////////////////////////////////////////////////////////////////////
if ($_Tracking_phpMyVisites) {
    $_TrackingCode = '<script type="text/javascript">' . LF;
    $_TrackingCode .= SCRIPT_CDATA_START . LF;
Ejemplo n.º 5
0
function combinedParser($string, $charset = 'utf-8', $allowed_tags = '')
{
    $string = html_parser($string);
    $string = clean_replacement_tags($string, $allowed_tags);
    $string = str_replace('&nbsp;', ' ', $string);
    $string = decode_entities($string);
    $string = cleanUpSpecialHtmlEntities($string);
    if (!empty($string) && PHPWCMS_CHARSET != $charset) {
        $string = makeCharsetConversion($string, PHPWCMS_CHARSET, $charset);
    } else {
        $string = html_specialchars($string);
    }
    // Strip away unwanted UTF-8 chars to avoid XML fatal parsing error
    // http://www.phpwact.org/php/i18n/charsets#common_problem_areas_with_utf-8
    if ($charset == 'utf-8') {
        $string = preg_replace('/[^\\x{0009}\\x{000a}\\x{000d}\\x{0020}-\\x{D7FF}\\x{E000}-\\x{FFFD}]+/u', ' ', $string);
    }
    return $string;
}
Ejemplo n.º 6
0
function createSocialBookmark($matches)
{
    if (empty($matches[1])) {
        return '';
    }
    if (strpos($matches[1], '<!--DETAIL_ONLY-->') === false) {
        if (empty($GLOBALS['aktion'][1])) {
            $bm['url'] = PHPWCMS_URL . 'index.php?id=' . $GLOBALS['aktion'][0];
        } else {
            $bm['url'] = PHPWCMS_URL . 'index.php?aid=' . $GLOBALS['aktion'][1];
        }
    } else {
        if (empty($GLOBALS['aktion'][1])) {
            return '';
        }
        $bm['url'] = PHPWCMS_URL . 'index.php?aid=' . $GLOBALS['aktion'][1];
        $matches[1] = str_replace('<!--DETAIL_ONLY-->', '', $matches[1]);
    }
    $bm['uurl'] = $bm['url'];
    $bm['url'] = rawurlencode($bm['url']);
    $bm['title'] = clean_replacement_tags(empty($GLOBALS['content']['article_title']) ? $GLOBALS['content']["pagetitle"] : $GLOBALS['content']['article_title'], '');
    $bm['title'] = cleanUpSpecialHtmlEntities($bm['title']);
    $bm['title'] = rawurlencode($bm['title']);
    $bm['bodytext'] = empty($GLOBALS['content']['article_summary']) ? '' : clean_replacement_tags($GLOBALS['content']['article_summary'], '');
    $bm['bodytext'] = cleanUpSpecialHtmlEntities($bm['bodytext']);
    $bm['bodytext'] = getCleanSubString($bm['bodytext'], 25, '…', 'word');
    $bm['bodytext'] = rawurlencode($bm['bodytext']);
    $bm['topic'] = rawurlencode($GLOBALS['content']['struct'][$GLOBALS['aktion'][0]]['acat_name']);
    // now set all sepcific data
    $bm['service']['wong']['url'] = 'http://www.mister-wong.de/index.php?action=addurl';
    $bm['service']['wong']['url'] .= '&amp;bm_url=' . $bm['url'];
    $bm['service']['wong']['url'] .= '&amp;bm_description=' . $bm['title'];
    $bm['service']['wong']['alt'] = 'Wong It!';
    $bm['service']['furl']['url'] = 'http://www.furl.net/savedialog.jsp?p=1&amp;t=' . $bm['title'] . '&amp;u=' . $bm['url'] . '&amp;c=&amp;r=';
    $bm['service']['furl']['alt'] = 'Furl It';
    $bm['service']['spurl']['url'] = 'http://www.spurl.net/spurl.php?title=' . $bm['title'] . '&amp;url=' . $bm['url'];
    //&blocked=__tags__s';
    $bm['service']['spurl']['alt'] = 'Spurl!';
    $bm['service']['technorati']['url'] = 'http://technorati.com/faves?add=' . rawurlencode(PHPWCMS_URL);
    $bm['service']['technorati']['alt'] = 'TechnoratiFaves';
    $bm['service']['delicious']['url'] = 'http://del.icio.us/post?url=' . $bm['url'] . '&amp;title=' . $bm['title'] . '&amp;jump=no';
    $bm['service']['delicious']['alt'] = 'Del.icio.us';
    $bm['service']['digg']['url'] = 'http://digg.com/submit?phase=2&amp;url=' . $bm['url'] . '&amp;title=' . $bm['title'];
    $bm['service']['digg']['url'] .= '&amp;bodytext=' . $bm['bodytext'] . '&amp;topic=';
    $bm['service']['digg']['alt'] = 'DiggIt!';
    $bm['service']['yahoo']['url'] = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?t=' . $bm['title'] . '&amp;u=' . $bm['url'] . '&amp;d=' . $bm['bodytext'] . '&amp;ei=' . PHPWCMS_CHARSET;
    $bm['service']['yahoo']['alt'] = 'Save to Yahoo! My Web';
    $bm['service']['google']['url'] = 'http://www.google.com/bookmarks/mark?op=add&amp;bkmk=' . $bm['url'] . '&amp;title=' . $bm['title'] . '&amp;annotation=' . $bm['bodytext'];
    $bm['service']['google']['alt'] = 'Google Bookmark';
    $bm['service']['magnolia']['url'] = 'http://ma.gnolia.com/bookmarklet/add?url=' . $bm['url'] . '&amp;title=' . $bm['title'] . '&amp;description=' . $bm['bodytext'];
    $bm['service']['magnolia']['alt'] = 'Ma.gnolia';
    $bm['service']['newsvine']['url'] = 'http://www.newsvine.com/_tools/seed&amp;save?url=' . $bm['url'] . '&amp;title=' . $bm['title'];
    $bm['service']['newsvine']['alt'] = 'Newsvine';
    $bm['service']['reddit']['url'] = 'http://reddit.com/submit?url=' . $bm['url'] . '&amp;title=' . $bm['title'];
    $bm['service']['reddit']['alt'] = 'Reddit';
    $bm['service']['webnews']['url'] = 'http://www.webnews.de/einstellen?url=' . $bm['url'] . '&amp;title=' . $bm['title'] . '&amp;desc=' . $bm['bodytext'];
    $bm['service']['webnews']['alt'] = 'Diese Nachricht bei Webnews einstellen';
    $bm['service']['wikio']['url'] = 'http://www.wikio.com/vote?url=' . $bm['url'];
    $bm['service']['wikio']['alt'] = 'Wikio';
    $bm['service']['yigg']['url'] = 'http://yigg.de/neu?exturl=' . $bm['url'] . '&amp;exttitle=' . $bm['title'] . '&amp;extdesc=' . $bm['bodytext'];
    $bm['service']['yigg']['alt'] = 'YiGG it';
    $bm['service']['facebook']['url'] = 'http://www.facebook.com/sharer.php?u=' . $bm['url'] . '&amp;t=' . $bm['title'];
    $bm['service']['facebook']['alt'] = 'Share on Facebook';
    $bm['service']['folkd']['url'] = 'http://www.folkd.com/submit/' . $bm['uurl'];
    $bm['service']['folkd']['alt'] = 'folk it!';
    $bm['service']['oneview']['url'] = 'http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL=' . $bm['url'] . '&amp;title=' . $bm['title'];
    $bm['service']['oneview']['alt'] = 'oneview - das merk ich mir!';
    foreach ($bm['service'] as $key => $value) {
        $bmt = '<a href="' . $bm['service'][$key]['url'] . '" title="' . $bm['service'][$key]['alt'] . '" ';
        $bmt .= 'target="_blank" rel="nofollow"><img src="' . TEMPLATE_PATH . 'img/bookmarklets/' . $key . '.gif" ';
        $bmt .= 'alt="' . $bm['service'][$key]['alt'] . '" border="0" /></a>';
        $matches[1] = str_replace('{' . strtoupper($key) . '}', $bmt, $matches[1]);
    }
    return $matches[1];
}