Ejemplo n.º 1
0
function textFilter($text, $size, $wrap, $urls, $bbcodes, $eofs, $admin, $shorten = 0)
{
    if (get_magic_quotes_gpc() == 0) {
        $text = addslashes($text);
    }
    if (($admin == 1 or isset($GLOBALS['isMod']) and $GLOBALS['isMod'] == 1) and isset($GLOBALS['adminHTML']) and $GLOBALS['adminHTML']) {
        $text = trim($text);
    } else {
        $text = htmlspecialchars(trim($text), ENT_QUOTES);
    }
    $text = str_replace(array('\\'', '\\"', chr(92) . chr(92) . chr(92) . chr(92), chr(92) . chr(92), '&#', '$'), array(''', '"', '\\', '\', '&#', '$'), $text);
    $text = convert_entities($text);
    if (isset($GLOBALS['l_meta']) and substr_count(strtolower($GLOBALS['l_meta']), 'utf-8') == 0) {
        $text = str_replace(array('“', '”', '‘', '’', '…'), array('"', '"', ''', ''', '...'), $text);
    }
    if (substr_count($text, '&#9') > 0) {
        $text = preg_replace("@&#9[0-9]{2,};@", '', $text);
    }
    if (!$bbcodes) {
        $text = enCodeBB($text, $admin);
        $text = str_replace('><img src=', '> <img src=', $text);
    }
    if ($urls and !$bbcodes) {
        $text = urlMaker($text);
    }
    $text = wrapText($wrap, $text);
    $sce = FALSE;
    if (isset($GLOBALS['simpleCodes'])) {
        foreach ($GLOBALS['simpleCodes'] as $e) {
            if (substr_count($text, $e) > 0) {
                $sce = TRUE;
                break;
            }
        }
    }
    if (trim(strip_tags($text)) == '' and !$sce) {
        return '';
    }
    if ($size and strlen($text) > $size) {
        $text = special_substr($text, $size);
        if ($shorten > 0 and strlen($text) > $shorten) {
            $text = substr($text, 0, $shorten);
        }
        if (substr_count($text, '&') > 0) {
            /* Avoid special symbols extract */
            $tmpArr = explode('&', $text);
            $last = sizeof($tmpArr) - 1;
            if ($last > 0) {
                if (substr_count($tmpArr[$last], ';') == 0) {
                    array_pop($tmpArr);
                }
                $text = implode('&', $tmpArr);
            }
        }
    }
    if ($eofs and !isset($GLOBALS['disableLineBreaks'])) {
        while (substr_count($text, "\r\n\r\n\r\n\r\n") > 4) {
            $text = str_replace("\r\n\r\n\r\n\r\n", "\r\n", $text);
        }
        while (substr_count($text, "\n\n\n\n") > 4) {
            $text = str_replace("\n\n\n\n", "\n", $text);
        }
        $text = str_replace(array("\r\n", "\n"), '<br />', $text);
    }
    while (substr($text, -1) == chr(92)) {
        $text = substr($text, 0, strlen($text) - 1);
    }
    return $text;
}
Ejemplo n.º 2
0
     include $pathToFiles . "lang/{$lang}.php";
     $errorMSG = $l_signIn;
     $title .= $l_forbidden;
     $loginError = 2;
     $displayFormElements = array('userData' => 1, 'topicTitle' => 1, 'postText' => 1);
     $antiWarn = $l_fixData;
     include $pathToFiles . 'bb_func_posthold.php';
     return;
 } else {
     require_once $pathToFiles . 'bb_func_txt.php';
     $reqTxt = 1;
     if (get_magic_quotes_gpc() == 1) {
         $user_usr = stripslashes($user_usr);
     }
     $user_usr = str_replace(array('|', '&amp;#'), array('', '&#'), $user_usr);
     $user_usr = special_substr($user_usr, 35);
     $user_usr = wrapText(15, $user_usr);
     $fake = 0;
     if (isset($disallowNames) and is_array($disallowNames)) {
         foreach ($disallowNames as $dn) {
             if (strtolower($user_usr) == strtolower($dn)) {
                 $fake = 1;
                 include $pathToFiles . "lang/{$lang}.php";
                 $user_usr = $l_anonymous;
                 break;
             }
         }
     }
     if ($fake == 0) {
         if (isset($disallowNamesIndex) and is_array($disallowNamesIndex)) {
             foreach ($disallowNamesIndex as $dn) {