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(' ', ' ', $string); $string = preg_replace('/\\s+/', ' ', $string); $string = cleanUpSpecialHtmlEntities($string); return $string; }
// read template 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;
function make_cloud($matches) { global $phpwcms, $content; // use $matches for // $rendermode,$which_ID,$setLP,$landing $rendermode = trim($matches[1]); $which_ID = trim($matches[2]); $setLP = trim($matches[3]); $landing = isset($matches[4]) ? intval($matches[4]) : 0; $conf =& $content['tagcloud']; // check integrity of user_settings --- else use defaults +++ OG new style if (empty($conf['min'])) { $conf['min'] = 4; } if (empty($conf['min_chars'])) { $conf['min_chars'] = 4; } if (!isset($conf['sort'])) { $conf['sort'] = false; } if (empty($conf['inc_or_ex'])) { $conf['inc_or_ex'] = 0; } // avoid php notice: undefined variable if (empty($allmyhds)) { $allmyhds = ''; } if (empty($allmycps)) { $allmycps = ''; } if (empty($at)) { $at = ''; } if (empty($ast)) { $ast = ''; } if (empty($asm)) { $asm = ''; } // avoid php notice: undefined index //if(isset($conf['add_t'])) {$auswert_t = $conf['add_t'];} // NOW, FINALLY IT'S TIME TO LET A FRESH BREEZE BLOWING UP PRETTY CLOUDS if (!empty($landing)) { // check if landing page has an article alias ( only versions > 1.3.5 else use fallback ) // original code has been deleted because +++ o-ton OG: "so geht es schneller" $landalias = _dbGet('phpwcms_article', 'article_alias', "article_id=" . $landing . " AND article_alias != ''"); // "So muss weitermachen...". Hey, here we are: if (!empty($landalias[0]['article_alias'])) { $aliasfound = $landalias[0]['article_alias']; } // second BREEZE BLOWING if (!empty($setLP)) { switch ($setLP) { case 'L': if (isset($aliasfound)) { $landing = 'index.php?' . $aliasfound . '#'; } else { $landing = 'index.php?aid=' . $landing . '#'; //fallback for older versions //$old_style $landing = 'index.php?id=0,'. $landing . ',0,0,1,0#'; //much older versions } break; case 'S': if (isset($aliasfound)) { $landing = 'index.php?' . $aliasfound . '&searchwords='; } else { $landing = 'index.php?aid=' . $landing . '&searchwords='; //fallback for older versions //$old_style $landing = 'index.php?id=0,'. $landing . ',0,0,1,0&searchwords='; //much older versions } break; } } else { $landing = 'index.php#'; echo "TagCloud ERROR: Wrong setup of RT! MISSING --> (L) = Landing page OR --> (S) = Search page"; } } else { //die("TagCloud ERROR: Article_ID of your (L)Landing Page or your (S)Search Page is missing!"); echo "TagCloud ERROR: Wrong setup of RT! Article ID of (L) = Landing Page or (S) = Search Page MISSING!"; $landing = 'index.php#'; } switch ($rendermode) { case 'E': //exclude array stuff by marcus@localhorst $excludeid = explode(',', $which_ID); $struct = array_keys($content['struct']); $only_cat_id = array_diff($struct, $excludeid); break; case 'I': $only_cat_id = explode(',', $which_ID); break; default: echo "TagCloud ERROR: Rendermode not defined! (I) = match all articles withIN named categories or vice versa (E) = exclude categories!"; break; } if (is_array($only_cat_id)) { foreach ($only_cat_id as $slid) { $sql = "SELECT SQL_CACHE article_id"; if ($conf['add_t']) { $sql .= ",article_title"; } if ($conf['add_st']) { $sql .= ",article_subtitle"; } if ($conf['add_sm']) { $sql .= ",article_summary"; } $sql .= " FROM " . DB_PREPEND . "phpwcms_article WHERE article_cid={$slid}"; $sql .= " AND article_public=1 AND article_aktiv=1 AND article_deleted=0"; $sql .= " AND article_begin < NOW() AND article_end > NOW()"; $result = _dbQuery($sql); foreach ($result as $row) { $ai = $row['article_id']; if ($conf['add_t']) { $at = $row['article_title']; } if ($conf['add_st']) { $ast = $row['article_subtitle']; } if ($conf['add_sm']) { $asm = $row['article_summary']; } $allmyhds .= $at . ' ' . $ast . ' ' . $asm . ' '; $sec_sql = "SELECT SQL_CACHE acontent_html"; if ($conf['add_cpt']) { $sec_sql .= ",acontent_title"; } if ($conf['add_cpst']) { $sec_sql .= ",acontent_subtitle"; } if ($conf['add_cptximg']) { $sec_sql .= ",acontent_text"; } $sec_sql .= " FROM " . DB_PREPEND . "phpwcms_articlecontent WHERE acontent_aid={$ai}"; $sec_sql .= " AND acontent_visible=1 AND acontent_trash=0"; $scd_result = _dbQuery($sec_sql); foreach ($scd_result as $scd_row) { $allmycps .= $scd_row['acontent_html'] . ' '; if ($conf['add_cpt']) { $allmycps .= $scd_row['acontent_title'] . ' '; } if ($conf['add_cpst']) { $allmycps .= $scd_row['acontent_subtitle'] . ' '; } if ($conf['add_cptximg']) { $allmycps .= $scd_row['acontent_text'] . ' '; } } } } /***************************************************************** * JOIN ALL the text of content --> Titles, Summary, CPs *****************************************************************/ $tagtext = $allmyhds . $allmycps; /***************************************************************** * add NEWS when set =1 *****************************************************************/ if ($conf['news_to_cloud'] == 1) { $news_sql = "SELECT SQL_CACHE cnt_title, "; $news_sql .= "cnt_subtitle, cnt_teasertext, cnt_text"; $news_sql .= " FROM " . DB_PREPEND . "phpwcms_content WHERE cnt_status=1"; $news_sql .= " AND cnt_livedate < NOW() AND cnt_killdate > NOW()"; $news_result = _dbQuery($news_sql); foreach ($news_result as $news_row) { $newscontent .= $news_row['cnt_title'] . ' '; $newscontent .= $news_row['cnt_subtitle'] . ' '; $newscontent .= $news_row['cnt_teasertext'] . ' '; $newscontent .= $news_row['cnt_text'] . ' '; } //article content plus news $tagtext = $tagtext . $newscontent; } /***************************************************************** and do some convertions *****************************************************************/ $tagtext = clean_replacement_tags($tagtext); $tagtext = stripped_cache_content($tagtext); //delete not wantend and then str_all to lower if (phpwcms_seems_utf8($tagtext)) { $tagtext = strtolower_utf8(str_replace($conf['del_signs'], '', $tagtext)); } else { $tagtext = strtolower(str_replace($conf['del_signs'], '', $tagtext)); } $tagtext = explode(' ', $tagtext); //split in separate words $anzahl = array_count_values($tagtext); //count the words -- into new array $tags = array(); switch ($conf['inc_or_ex']) { case '0': foreach ($anzahl as $key => $tagword) { if ($tagword >= $conf['min'] && !in_array($key, $conf['exclude'])) { //look if the word counts the required minimum and is not in the exclude list if (strlen($key) >= $conf['min_chars']) { //ignore words on web site that are NOT longer than (chief inspector even longer) defined in: var min_chars $tags[$key] = $tagword; //put them in a new array } // else { $this_word_out[$key] = $tagword; } } } break; case '1': foreach ($anzahl as $key => $tagword) { if ($tagword >= $conf['min'] && in_array($key, $conf['include'])) { //look if the word counts the required minimum and is not in the exclude list if (strlen($key) >= $conf['min_chars']) { //ignore words on web site that are NOT longer than (chief inspector even longer) defined in: var min_chars $tags[$key] = $tagword; //now put them in a new array } // else { $this_word_out[$key] = $tagword; } } } break; default: break; } if (!empty($tags)) { //unset($tags['phpwcms']); //if you want to override the value of words (in this case 'phpwcms'), uncomment it and put in your word //$weight = count($tags); $max_hits = max($tags); //tag with most hits if (!empty($max_hits)) { //$tags['phpwcms']=8; // put in again your deleted word and value from 4 lines above switch ($conf['sort']) { case 'asc': ksort($tags); //sort them alphabetically break; case 'desc': krsort($tags); //sort them reverse alphabetically break; case 'random': $keys = array_keys($tags); shuffle($keys); $random_words = array(); foreach ($keys as $key) { $random_words[$key] = $tags[$key]; } $tags = $random_words; break; default: break; } // FULL BLOWN CLOUDS LIKE HORNBLOWER $tag_cloud = '<div class="' . $conf['class'] . '">'; foreach ($tags as $key => $tagword) { $key = html_specialchars($key); // new maths by Heiko H. $percent = round(100 * $tagword / $max_hits, 0); $size = ceil($percent / 10); // prepare TC font size for CSS $tag_cloud .= '<a class="tcfs' . $size . '" href="' . PHPWCMS_URL . $landing . urlencode($key) . '">' . $key . '</a>'; if ($conf['showCount']) { $tag_cloud .= $conf['SC_before'] . $tagword . $conf['SC_after']; } $tag_cloud .= ' ' . LF; } $tag_cloud .= '</div>'; } } } return $tag_cloud; }
die("You Cannot Access This Script Directly, Have a Nice Day."); } //bxslider //header additions: _a=js, _b=overall css, _[theme]=theme related css $mod_sliderjs['head']['br_sliderjs_bxslider_a'] = ' <script type="text/javascript" src="' . $phpwcms['modules'][$crow["acontent_module"]]['dir'] . 'plugins/bxslider/js/jquery.bxslider.min.js"></script>'; $mod_sliderjs['head']['br_sliderjs_bxslider_' . $content['br_sliderjs']['bxslider']['jqs_theme']] = ' <link rel="stylesheet" type="text/css" href="' . $phpwcms['modules'][$crow["acontent_module"]]['dir'] . 'plugins/bxslider/themes/' . $content['br_sliderjs']['bxslider']['jqs_theme'] . '/' . $content['br_sliderjs']['bxslider']['jqs_theme'] . '.css" />'; //get the imagelist $mod_sliderjs['br_sliderjs']['imglist'] = ''; foreach ($mod_sliderjs['br_sliderjs']['data'] as $key => $value) { if ($value['jqs_image'] != false) { $mod_sliderjs['br_sliderjs']['imglist'] .= '<li>'; $mod_sliderjs['br_sliderjs']['imglist'] .= ' <img src="' . PHPWCMS_IMAGES . $value['jqs_image'][0] . '" '; //when captions enabled if ($content['br_sliderjs']['bxslider']['jqs_caption'] == 1) { //clean all RT's - this function also strips all HTML tags $mod_sliderjs['br_sliderjs']['imglist'] .= 'title="' . clean_replacement_tags($value['jqs_descr'], '') . '" alt="' . clean_replacement_tags($value['jqs_title'], '') . '"'; } //$mod_sliderjs['br_sliderjs']['imglist'] .= $value['jqs_image'][3].' alt="'.$img_desc.'" border="0" />'.LF; $mod_sliderjs['br_sliderjs']['imglist'] .= ' />' . LF; $mod_sliderjs['br_sliderjs']['imglist'] .= '</li>'; } } //add html $mod_sliderjs['br_sliderjs']['output'] .= ' <div class="sliderjsmodule"'; if ($content['br_sliderjs']['bxslider']['jqs_cssadv'] == 0) { $mod_sliderjs['br_sliderjs']['output'] .= ' style="position:relative;width:' . $mod_sliderjs['br_sliderjs']['jqs_imgwidth'] . 'px;overflow:hidden;"'; } $mod_sliderjs['br_sliderjs']['output'] .= '><ul class="bxslider bxloader' . $crow['acontent_id'] . '"'; if ($content['br_sliderjs']['bxslider']['jqs_cssadv'] == 0) { $mod_sliderjs['br_sliderjs']['output'] .= ' style="margin:0;padding:0;"'; }
} $alink_sql .= ' ORDER BY ' . $ao[2]; if ($result = mysql_query($alink_sql, $db) or die("error while getting link article list: " . $alink_sql)) { $alinkmenu['count'] = 0; while ($row = mysql_fetch_row($result)) { $tempRowSpan = ''; $row[3] = preg_replace('/<br[^>]*?>$/i', '', $row[3]); $row['article_id'] = $row[0]; $row['article_alias'] = $row[4]; $row['article_title'] = html_specialchars($row[1]); $alinkmenu['count']++; $row['article_menutitle'] = empty($alinkmenu["titleasnumber"]) ? html_specialchars(empty($row[5]) ? $row[1] : $row[5]) : $alinkmenu['count']; if ($alinkmenu['headertext'] && !empty($row[3])) { $alinkmenu['sum'] = $row[3]; if (!empty($alinkmenu['maxchar'])) { $alinkmenu['sum'] = clean_replacement_tags($alinkmenu['sum']); $alinkmenu['sum'] = remove_unsecure_rptags($alinkmenu['sum']); $alinkmenu['sum'] = preg_replace('/\\s/i', ' ', $alinkmenu['sum']); $alinkmenu['sum'] = preg_replace('/\\s{2,}/i', ' ', $alinkmenu['sum']); $alinkmenu['sum'] = trim(decode_entities($alinkmenu['sum'])); $alinkmenu['sum'] = wordwrap($alinkmenu['sum'], $alinkmenu['maxchar'], "\n"); list($alinkmenu['sum']) = explode("\n", $alinkmenu['sum']); $alinkmenu['sum'] = trim($alinkmenu['sum']); $alinkmenu['sum'] = html_specialchars($alinkmenu['sum']); if (!empty($alinkmenu['morelink'])) { $alinkmenu['sum'] .= '<a href="index.php?' . setGetArticleAid($row) . '" title="' . $row['article_title'] . '">'; $alinkmenu['sum'] .= $alinkmenu['morelink']; $alinkmenu['sum'] .= '</a>'; } } } else {
function combinedParser($string, $charset = 'utf-8', $allowed_tags = '') { $string = html_parser($string); $string = clean_replacement_tags($string, $allowed_tags); $string = str_replace(' ', ' ', $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; }
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'] .= '&bm_url=' . $bm['url']; $bm['service']['wong']['url'] .= '&bm_description=' . $bm['title']; $bm['service']['wong']['alt'] = 'Wong It!'; $bm['service']['furl']['url'] = 'http://www.furl.net/savedialog.jsp?p=1&t=' . $bm['title'] . '&u=' . $bm['url'] . '&c=&r='; $bm['service']['furl']['alt'] = 'Furl It'; $bm['service']['spurl']['url'] = 'http://www.spurl.net/spurl.php?title=' . $bm['title'] . '&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'] . '&title=' . $bm['title'] . '&jump=no'; $bm['service']['delicious']['alt'] = 'Del.icio.us'; $bm['service']['digg']['url'] = 'http://digg.com/submit?phase=2&url=' . $bm['url'] . '&title=' . $bm['title']; $bm['service']['digg']['url'] .= '&bodytext=' . $bm['bodytext'] . '&topic='; $bm['service']['digg']['alt'] = 'DiggIt!'; $bm['service']['yahoo']['url'] = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?t=' . $bm['title'] . '&u=' . $bm['url'] . '&d=' . $bm['bodytext'] . '&ei=' . PHPWCMS_CHARSET; $bm['service']['yahoo']['alt'] = 'Save to Yahoo! My Web'; $bm['service']['google']['url'] = 'http://www.google.com/bookmarks/mark?op=add&bkmk=' . $bm['url'] . '&title=' . $bm['title'] . '&annotation=' . $bm['bodytext']; $bm['service']['google']['alt'] = 'Google Bookmark'; $bm['service']['magnolia']['url'] = 'http://ma.gnolia.com/bookmarklet/add?url=' . $bm['url'] . '&title=' . $bm['title'] . '&description=' . $bm['bodytext']; $bm['service']['magnolia']['alt'] = 'Ma.gnolia'; $bm['service']['newsvine']['url'] = 'http://www.newsvine.com/_tools/seed&save?url=' . $bm['url'] . '&title=' . $bm['title']; $bm['service']['newsvine']['alt'] = 'Newsvine'; $bm['service']['reddit']['url'] = 'http://reddit.com/submit?url=' . $bm['url'] . '&title=' . $bm['title']; $bm['service']['reddit']['alt'] = 'Reddit'; $bm['service']['webnews']['url'] = 'http://www.webnews.de/einstellen?url=' . $bm['url'] . '&title=' . $bm['title'] . '&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'] . '&exttitle=' . $bm['title'] . '&extdesc=' . $bm['bodytext']; $bm['service']['yigg']['alt'] = 'YiGG it'; $bm['service']['facebook']['url'] = 'http://www.facebook.com/sharer.php?u=' . $bm['url'] . '&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'] . '&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]; }