/**
 * Converts all accent characters to ASCII characters.
 *
 * If there are no accent characters, then the string given is just returned.
 * Extended for phpwcms, better ISO part
 *
 * @since WordPress 1.2.1
 *
 * @param string $string Text that might have accent characters
 * @return string Filtered string with replaced "nice" characters.
 */
function phpwcms_remove_accents($string)
{
    if (!preg_match('/[\\x80-\\xff]/', $string)) {
        return $string;
    }
    if (phpwcms_seems_utf8($string)) {
        $chars = array(chr(194) . chr(170) => 'a', chr(194) . chr(186) => 'o', chr(195) . chr(128) => 'A', chr(195) . chr(129) => 'A', chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A', chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A', chr(195) . chr(134) => 'AE', chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E', chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E', chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I', chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I', chr(195) . chr(143) => 'I', chr(195) . chr(144) => 'D', chr(195) . chr(145) => 'N', chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O', chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O', chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U', chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U', chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y', chr(195) . chr(158) => 'TH', chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a', chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a', chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a', chr(195) . chr(165) => 'a', chr(195) . chr(166) => 'ae', chr(195) . chr(167) => 'c', chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e', chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e', chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i', chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i', chr(195) . chr(176) => 'd', chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o', chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o', chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o', chr(195) . chr(184) => 'o', chr(195) . chr(185) => 'u', chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u', chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y', chr(195) . chr(190) => 'th', chr(195) . chr(191) => 'y', chr(195) . chr(152) => 'O', chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a', chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a', chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a', chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c', chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c', chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c', chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c', chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd', chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd', chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e', chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e', chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e', chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e', chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e', chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g', chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g', chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g', chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g', chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h', chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h', chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i', chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i', chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i', chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i', chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i', chr(196) . chr(178) => 'IJ', chr(196) . chr(179) => 'ij', chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j', chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k', chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L', chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L', chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L', chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L', chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L', chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N', chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N', chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N', chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N', chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N', chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o', chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o', chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o', chr(197) . chr(146) => 'OE', chr(197) . chr(147) => 'oe', chr(197) . chr(148) => 'R', chr(197) . chr(149) => 'r', chr(197) . chr(150) => 'R', chr(197) . chr(151) => 'r', chr(197) . chr(152) => 'R', chr(197) . chr(153) => 'r', chr(197) . chr(154) => 'S', chr(197) . chr(155) => 's', chr(197) . chr(156) => 'S', chr(197) . chr(157) => 's', chr(197) . chr(158) => 'S', chr(197) . chr(159) => 's', chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's', chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't', chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't', chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't', chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u', chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u', chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u', chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u', chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u', chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u', chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w', chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y', chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z', chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z', chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z', chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's', chr(200) . chr(152) => 'S', chr(200) . chr(153) => 's', chr(200) . chr(154) => 'T', chr(200) . chr(155) => 't', chr(226) . chr(130) . chr(172) => 'E', chr(194) . chr(163) => '', chr(198) . chr(160) => 'O', chr(198) . chr(161) => 'o', chr(198) . chr(175) => 'U', chr(198) . chr(176) => 'u', chr(225) . chr(186) . chr(166) => 'A', chr(225) . chr(186) . chr(167) => 'a', chr(225) . chr(186) . chr(176) => 'A', chr(225) . chr(186) . chr(177) => 'a', chr(225) . chr(187) . chr(128) => 'E', chr(225) . chr(187) . chr(129) => 'e', chr(225) . chr(187) . chr(146) => 'O', chr(225) . chr(187) . chr(147) => 'o', chr(225) . chr(187) . chr(156) => 'O', chr(225) . chr(187) . chr(157) => 'o', chr(225) . chr(187) . chr(170) => 'U', chr(225) . chr(187) . chr(171) => 'u', chr(225) . chr(187) . chr(178) => 'Y', chr(225) . chr(187) . chr(179) => 'y', chr(225) . chr(186) . chr(162) => 'A', chr(225) . chr(186) . chr(163) => 'a', chr(225) . chr(186) . chr(168) => 'A', chr(225) . chr(186) . chr(169) => 'a', chr(225) . chr(186) . chr(178) => 'A', chr(225) . chr(186) . chr(179) => 'a', chr(225) . chr(186) . chr(186) => 'E', chr(225) . chr(186) . chr(187) => 'e', chr(225) . chr(187) . chr(130) => 'E', chr(225) . chr(187) . chr(131) => 'e', chr(225) . chr(187) . chr(136) => 'I', chr(225) . chr(187) . chr(137) => 'i', chr(225) . chr(187) . chr(142) => 'O', chr(225) . chr(187) . chr(143) => 'o', chr(225) . chr(187) . chr(148) => 'O', chr(225) . chr(187) . chr(149) => 'o', chr(225) . chr(187) . chr(158) => 'O', chr(225) . chr(187) . chr(159) => 'o', chr(225) . chr(187) . chr(166) => 'U', chr(225) . chr(187) . chr(167) => 'u', chr(225) . chr(187) . chr(172) => 'U', chr(225) . chr(187) . chr(173) => 'u', chr(225) . chr(187) . chr(182) => 'Y', chr(225) . chr(187) . chr(183) => 'y', chr(225) . chr(186) . chr(170) => 'A', chr(225) . chr(186) . chr(171) => 'a', chr(225) . chr(186) . chr(180) => 'A', chr(225) . chr(186) . chr(181) => 'a', chr(225) . chr(186) . chr(188) => 'E', chr(225) . chr(186) . chr(189) => 'e', chr(225) . chr(187) . chr(132) => 'E', chr(225) . chr(187) . chr(133) => 'e', chr(225) . chr(187) . chr(150) => 'O', chr(225) . chr(187) . chr(151) => 'o', chr(225) . chr(187) . chr(160) => 'O', chr(225) . chr(187) . chr(161) => 'o', chr(225) . chr(187) . chr(174) => 'U', chr(225) . chr(187) . chr(175) => 'u', chr(225) . chr(187) . chr(184) => 'Y', chr(225) . chr(187) . chr(185) => 'y', chr(225) . chr(186) . chr(164) => 'A', chr(225) . chr(186) . chr(165) => 'a', chr(225) . chr(186) . chr(174) => 'A', chr(225) . chr(186) . chr(175) => 'a', chr(225) . chr(186) . chr(190) => 'E', chr(225) . chr(186) . chr(191) => 'e', chr(225) . chr(187) . chr(144) => 'O', chr(225) . chr(187) . chr(145) => 'o', chr(225) . chr(187) . chr(154) => 'O', chr(225) . chr(187) . chr(155) => 'o', chr(225) . chr(187) . chr(168) => 'U', chr(225) . chr(187) . chr(169) => 'u', chr(225) . chr(186) . chr(160) => 'A', chr(225) . chr(186) . chr(161) => 'a', chr(225) . chr(186) . chr(172) => 'A', chr(225) . chr(186) . chr(173) => 'a', chr(225) . chr(186) . chr(182) => 'A', chr(225) . chr(186) . chr(183) => 'a', chr(225) . chr(186) . chr(184) => 'E', chr(225) . chr(186) . chr(185) => 'e', chr(225) . chr(187) . chr(134) => 'E', chr(225) . chr(187) . chr(135) => 'e', chr(225) . chr(187) . chr(138) => 'I', chr(225) . chr(187) . chr(139) => 'i', chr(225) . chr(187) . chr(140) => 'O', chr(225) . chr(187) . chr(141) => 'o', chr(225) . chr(187) . chr(152) => 'O', chr(225) . chr(187) . chr(153) => 'o', chr(225) . chr(187) . chr(162) => 'O', chr(225) . chr(187) . chr(163) => 'o', chr(225) . chr(187) . chr(164) => 'U', chr(225) . chr(187) . chr(165) => 'u', chr(225) . chr(187) . chr(176) => 'U', chr(225) . chr(187) . chr(177) => 'u', chr(225) . chr(187) . chr(180) => 'Y', chr(225) . chr(187) . chr(181) => 'y', chr(201) . chr(145) => 'a', chr(199) . chr(149) => 'U', chr(199) . chr(150) => 'u', chr(199) . chr(151) => 'U', chr(199) . chr(152) => 'u', chr(199) . chr(141) => 'A', chr(199) . chr(142) => 'a', chr(199) . chr(143) => 'I', chr(199) . chr(144) => 'i', chr(199) . chr(145) => 'O', chr(199) . chr(146) => 'o', chr(199) . chr(147) => 'U', chr(199) . chr(148) => 'u', chr(199) . chr(153) => 'U', chr(199) . chr(154) => 'u', chr(199) . chr(155) => 'U', chr(199) . chr(156) => 'u', chr(195) . chr(132) => 'Ae', chr(195) . chr(164) => 'ae', chr(195) . chr(150) => 'Oe', chr(195) . chr(182) => 'oe', chr(195) . chr(156) => 'Ue', chr(195) . chr(188) => 'ue', chr(195) . chr(159) => 'ss', chr(195) . chr(134) => 'Ae', chr(195) . chr(166) => 'ae', chr(195) . chr(152) => 'Oe', chr(195) . chr(184) => 'oe', chr(195) . chr(133) => 'Aa', chr(195) . chr(165) => 'aa');
        $string = strtr($string, $chars);
    } else {
        // Assume ISO-8859-1 if not UTF-8
        $chars_in = array(chr(128), chr(131), chr(138), chr(142), chr(154), chr(158), chr(159), chr(162), chr(195), chr(196), chr(197), chr(199), chr(200), chr(201), chr(202), chr(203), chr(204), chr(205), chr(206), chr(207), chr(209), chr(210), chr(211), chr(212), chr(213), chr(214), chr(216), chr(217), chr(218), chr(219), chr(220), chr(221), chr(224), chr(225), chr(226), chr(227), chr(228), chr(229), chr(231), chr(232), chr(233), chr(234), chr(235), chr(236), chr(237), chr(238), chr(239), chr(241), chr(242), chr(243), chr(244), chr(245), chr(246), chr(248), chr(249), chr(250), chr(251), chr(252), chr(253), chr(255), chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254));
        $chars_out = array('EUR', 'f', 'S', 'Z', 's', 'z', 'Y', 'c', 'A', 'Ae', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'OE', 'O', 'U', 'U', 'U', 'UE', 'Y', 'a', 'a', 'a', 'a', 'ae', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'oe', 'o', 'u', 'u', 'u', 'ue', 'y', 'y', 'OE', 'oe', 'AE', 'D', 'th', 'ss', 'ae', 'o', 'th');
        $string = str_replace($chars_in, $chars_out, $string);
    }
    return $string;
}
Esempio n. 2
0
 function mb_strlen($str = '', $encoding = '')
 {
     return strlen(phpwcms_seems_utf8($str) ? utf8_decode($str) : $str);
 }
$fxsg = 0;
while ($file = @readdir($handle)) {
    if ($file != "." && $file != ".." && $file[0] != '.') {
        if (!is_dir($file) && ($fxs = filesize(PHPWCMS_ROOT . $phpwcms["ftp_path"] . $file))) {
            // test if the file should be deleted
            $file_base64 = base64_encode($file);
            if (isset($deleteFiles[$file_base64])) {
                if (@unlink(PHPWCMS_ROOT . $phpwcms["ftp_path"] . $file)) {
                    continue;
                }
            }
            $fxb = $fx % 2 ? " bgColor=\"#F9FAFB\"" : "";
            $fxsg += $fxs;
            $fxe = extimg(which_ext($file));
            // there is a big problem with special chars on Mac OS X and seems Windows too
            $filename = PHPWCMS_CHARSET != 'utf-8' && phpwcms_seems_utf8($file) ? str_replace('?', '', utf8_decode($file)) : $file;
            $filename = html($filename);
            ?>
          <tr<?php 
            echo $fxb;
            ?>
>
            <td align="center"><input name="ftp_mark[<?php 
            echo $fx;
            ?>
]" type="checkbox" id="ftp_mark_<?php 
            echo $fx;
            ?>
" value="1" class="ftp_mark" /></td>
            <td bgcolor="#D9DEE3"><img src="img/leer.gif" alt="" width="1" height="17" /></td>
            <td align="center"><img src="img/icons/small_<?php 
Esempio n. 4
0
echo $BL['be_ftptakeover_status'];
?>
&nbsp;&nbsp;</td>
		</tr>
		<tr bgcolor="#92A1AF"><td colspan="6" bgcolor="#D9DEE3"><img src="img/leer.gif" alt="" width="1" height="1" /></td>
	</tr>
<?php 
//Browse files in selected folder
$fx = 0;
$file_sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_file WHERE f_pid=" . $file_action["file_dir"] . " AND f_trash=0 AND f_kid = 1 AND f_uid = " . $_SESSION["wcs_user_id"] . " ORDER BY f_name;";
if ($file_result = mysql_query($file_sql, $db) or die("error while listing files")) {
    while ($file_row = mysql_fetch_array($file_result)) {
        $fxb = $fx % 2 ? " bgColor=\"#F9FAFB\"" : "";
        //$fxsg += $fxs;
        // there is a big problem with special chars on Mac OS X and seems Windows too
        if (PHPWCMS_CHARSET != 'utf-8' && phpwcms_seems_utf8($file_row["f_name"])) {
            $filename = str_replace('?', '', utf8_decode($file_row["f_name"]));
        } else {
            $filename = $file_row["f_name"];
        }
        $filename = html($filename);
        ?>
	<tr<?php 
        echo $fxb;
        ?>
>
		<td align="center"><input name="ftp_mark[<?php 
        echo $file_row["f_id"];
        ?>
]" type="checkbox" id="ftp_mark_<?php 
        echo $file_row["f_id"];
Esempio n. 5
0
// reset cart session error var to allow cart listing
if (isset($_getVar['shop_cart']) && $_getVar['shop_cart'] == 'show') {
    unset($_SESSION[CART_KEY]['error'], $_getVar['cart'], $_GET['cart']);
}
if ($_shop_load_cat !== false || $_shop_load_list !== false || $_shop_load_order !== false || $_shop_load_cart_small !== false) {
    $_shop_parsed = true;
    // load template
    $_tmpl = array('config' => array(), 'source' => '', 'lang' => $phpwcms['default_lang']);
    // Check against language specific shop template
    if (is_file($phpwcms['modules']['shop']['path'] . 'template/' . $phpwcms['default_lang'] . '.html')) {
        $_tmpl['source'] = @file_get_contents($phpwcms['modules']['shop']['path'] . 'template/' . $phpwcms['default_lang'] . '.html');
    } else {
        $_tmpl['source'] = @file_get_contents($phpwcms['modules']['shop']['path'] . 'template/default.html');
    }
    if ($_tmpl['source']) {
        if (PHPWCMS_CHARSET !== 'utf-8' && phpwcms_seems_utf8($_tmpl['source'])) {
            $_tmpl['source'] = mb_convert_encoding($_tmpl['source'], PHPWCMS_CHARSET, 'utf-8');
        }
        $_tmpl['config'] = parse_ini_str(get_tmpl_section('CONFIG', $_tmpl['source']), false);
        $_tmpl['config']['cat_list_products'] = empty($_tmpl['config']['cat_list_products']) ? false : phpwcms_boolval($_tmpl['config']['cat_list_products']);
        $_tmpl['config']['image_list_lightbox'] = empty($_tmpl['config']['image_list_lightbox']) ? false : phpwcms_boolval($_tmpl['config']['image_list_lightbox']);
        $_tmpl['config']['image_detail_lightbox'] = empty($_tmpl['config']['image_detail_lightbox']) ? false : phpwcms_boolval($_tmpl['config']['image_detail_lightbox']);
        $_tmpl['config']['image_detail_crop'] = empty($_tmpl['config']['image_detail_crop']) ? false : phpwcms_boolval($_tmpl['config']['image_detail_crop']);
        $_tmpl['config']['image_list_crop'] = empty($_tmpl['config']['image_list_crop']) ? false : phpwcms_boolval($_tmpl['config']['image_list_crop']);
        // Classes
        $_tmpl['config'] = array_merge(array('class_form_product_cart_option' => 'product-cart-option', 'class_shop_amount' => 'shop-amount', 'class_cart_add_button' => 'cart-add-button', 'class_product_option_1' => 'product-option-1', 'class_product_option_2' => 'product-option-2', 'class_form_cart' => 'cart-form'), $_tmpl['config']);
        if (empty($_tmpl['config']['class_prefix_shop_mode'])) {
            $_tmpl['config']['class_prefix_shop_mode'] = 'shopmode-';
        }
        // handle custom fields
        $_tmpl['config']['shop_field'] = array();
Esempio n. 6
0
/**
 * Check referrer string for search engine related information
 * and log those fetched data in database
 * Basic idea: http://www.tellinya.com/read/2007/07/11/34.html
 *
 * @return	array
 * @param	string	referrer string
 *
 **/
function seReferrer($ref = false)
{
    if (!empty($ref) && is_string($ref)) {
        $SeReferer = trim($ref);
    } elseif (isset($_SERVER['HTTP_REFERER'])) {
        $SeReferer = trim($_SERVER['HTTP_REFERER']);
    } else {
        return false;
    }
    $SePos = 0;
    $SeDomain = '';
    //Check against Google, Yahoo, MSN, Ask and others
    if ($SeReferer && preg_match('/[&\\?](q|p|w|s|qry|searchfor|as_q|as_epq|query|qt|keyword|keywords|encquery)=([^&]+)/i', $SeReferer, $pcs)) {
        if (preg_match("/https?:\\/\\/([^\\/]+)\\//i", $SeReferer, $SeDomain)) {
            $SeDomain = trim(strtolower($SeDomain[1]));
            $SeQuery = $pcs[2];
            if (preg_match("/[&\\?](start|b|first|stq)=([0-9]*)/i", $SeReferer, $pcs)) {
                $SePos = (int) trim($pcs[2]);
            }
        }
    }
    if (!isset($SeQuery)) {
        //Check against DogPile
        if (preg_match('/\\/search\\/web\\/([^\\/]+)\\//i', $SeReferer, $pcs)) {
            if (preg_match("/https?:\\/\\/([^\\/]+)\\//i", $SeReferer, $SeDomain)) {
                $SeDomain = trim(strtolower($SeDomain[1]));
                $SeQuery = $pcs[1];
            }
        }
        // We Do Not have a query
        if (!isset($SeQuery)) {
            return false;
        }
    }
    $OldQ = $SeQuery;
    $SeQuery = urldecode($SeQuery);
    // The Multiple URLDecode Trick to fix DogPile %XXXX Encodes
    while ($SeQuery != $OldQ) {
        $OldQ = $SeQuery;
        $SeQuery = urldecode($SeQuery);
    }
    // check given query and decode utf-8
    if (PHPWCMS_CHARSET != 'utf-8' && phpwcms_seems_utf8($SeQuery)) {
        $SeQuery = makeCharsetConversion($SeQuery, 'utf-8', PHPWCMS_CHARSET, false);
    }
    return array("domain" => $SeDomain, "query" => $SeQuery, "pos" => $SePos, "referrer" => $SeReferer);
}
Esempio n. 7
0
$row_count = 0;
$sql = 'SELECT *, COUNT(*) AS occurance FROM ' . DB_PREPEND . 'phpwcms_log_seo ';
if ($_entry['query']) {
    $sql .= 'WHERE ' . $_entry['query'] . ' ';
}
$sql .= 'GROUP BY hash ORDER BY occurance DESC ';
$sql .= 'LIMIT ' . ($_SESSION['seolog_page'] - 1) * $_SESSION['list_user_count'] . ',' . $_SESSION['list_user_count'];
$data = _dbQuery($sql);
if ($data) {
    foreach ($data as $row) {
        echo '<tr' . ($row_count % 2 ? ' bgcolor="#F3F5F8"' : '') . '>';
        echo '<td class="tdbottom3 tdtop3" align="center">&nbsp;';
        echo $row['occurance'];
        echo '&nbsp;</td>';
        echo '<td class="tdbottom3 tdtop3"><a href="';
        echo html($row['referrer']) . '" target="_blank">' . html($row['domain']);
        echo '</a></td>';
        echo '<td class="tdbottom3 tdtop3">';
        echo html(PHPWCMS_CHARSET != 'utf-8' && phpwcms_seems_utf8($row['query']) ? makeCharsetConversion($row['query'], 'utf-8', PHPWCMS_CHARSET, false) : $row['query']);
        echo '</td>';
        echo "</tr>\n";
        $row_count++;
    }
    echo '<tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>';
} else {
    echo '<tr><td colspan="3" class="tdtop5">' . $BL['be_empty_search_result'] . '</td></tr>';
}
?>

	<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="15"></td></tr>
</table>
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 . '&amp;searchwords=';
                    } else {
                        $landing = 'index.php?aid=' . $landing . '&amp;searchwords=';
                        //fallback for older versions
                        //$old_style		$landing = 'index.php?id=0,'. $landing . ',0,0,1,0&amp;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;
}