Beispiel #1
0
function replace($content)
{
    global $replace;
    if ($content) {
        $content = clean_html($content);
        if ($content == "") {
            $content = "HTML代码已过滤";
        }
        $bad = explode("|", $replace);
        @reset($bad);
        for ($i = 0; $i < count($bad); $i++) {
            $content = str_replace($bad[$i], "**", $content);
        }
        $suffix = mediasuffix($content);
        if (in_array($suffix, array("jpg", "jpeg", "gif", "bmp", "png"))) {
            $content = preg_replace('`((?:https?|ftp?|http):\\/\\/([a-zA-Z0-9-.?=&_\\/:]*)/?)`sie', 'urlop("[img link=$1]$1[/img]","e")', $content);
        } else {
            $content = preg_replace('`((?:https?|ftp?|http):\\/\\/([a-zA-Z0-9-.?=&_\\/"]*)/?)`si', '[url]$1[/url]', $content);
        }
    }
    return $content;
}
Beispiel #2
0
 tologin();
 $linkdata = array();
 $link = htmlspecialchars(trim($_POST['link']));
 $describe = clean_html($_POST['describe']);
 if (!preg_match("/^http\\:\\/\\/.{4,300}\$/i", $link) || !$link) {
     dsetcookie('setok', 'home4');
     header("location: {$webaddr}/{$my['user_name']}/profile");
     exit;
 } elseif (StrLenW($describe) > 100) {
     dsetcookie('setok', 'home5');
     header("location: {$webaddr}/{$my['user_name']}/profile");
     exit;
 } else {
     // 判断是否视频
     $parseLink = parse_url($link);
     $suffix = mediasuffix($link);
     if (preg_match("/(tudou.com|youku.com|ku6.com)\$/i", strtolower($parseLink['host']), $hosts) && $suffix != "swf") {
         $flashvar = getFlash($link, strtolower($hosts[1]));
         if (!empty($flashvar)) {
             $type = 'video';
             $htmls = getVideoHtml($link, strtolower($hosts[1]));
             $videotitle = $htmls[0];
             $videopic = $htmls[1];
         }
     } else {
         if (in_array($suffix, array("mp3", "wma"))) {
             $type = 'music';
         } else {
             if ($suffix == 'swf') {
                 $type = 'flash';
             } else {