Exemplo n.º 1
0
function CopyImg($text, $copyimg, $copyflash, $classid, $qz, $username, $theid, $cjid, $mark)
{
    global $empire, $public_r, $cjnewsurl, $navtheid, $dbtbpre;
    if (empty($text)) {
        return "";
    }
    if ($copyimg) {
        $text = RepImg($text, $copyflash);
    }
    if ($copyflash) {
        $text = RepFlash($text, $copyflash);
    }
    $exp1 = "[--copyimg--]";
    $exp2 = "[/--copyimg--]";
    $r = explode($exp1, $text);
    for ($i = 1; $i < count($r); $i++) {
        $r1 = explode($exp2, $r[$i]);
        if (strstr($r1[0], "http://") || strstr($r1[0], "https://")) {
            $dourl = $r1[0];
        } else {
            //是否是本地址
            if (!strstr($r1[0], "/") && $cjnewsurl) {
                $fileqz_r = GetPageurlQz($cjnewsurl);
                $fileqz = $fileqz_r['selfqz'];
                $dourl = $fileqz . $r1[0];
            } else {
                $dourl = $qz . $r1[0];
            }
        }
        $return_r = DoTranUrl($dourl, $classid);
        $text = str_replace($exp1 . $r1[0] . $exp2, $return_r[url], $text);
        if ($return_r[tran]) {
            //记录数据库
            $filetime = date("Y-m-d H:i:s");
            //变量处理
            $return_r[filesize] = (int) $return_r[filesize];
            $classid = (int) $classid;
            $return_r[type] = (int) $return_r[type];
            $theid = (int) $theid;
            $cjid = (int) $cjid;
            $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,onclick,fpath) values('{$return_r['filename']}',{$return_r['filesize']},'{$username}','{$return_r['filepath']}','{$filetime}',{$classid},'[URL]" . $return_r[filename] . "',{$return_r['type']},{$theid},{$cjid},0,'{$public_r['fpath']}');");
            //加水
            if ($mark && $return_r[type] == 1) {
                GetMyMarkImg($return_r['yname']);
            }
        }
    }
    return $text;
}
Exemplo n.º 2
0
function CopyImg($text, $copyimg, $copyflash, $classid, $qz, $username, $theid, $cjid, $mark, $fstb = 1)
{
    global $empire, $public_r, $cjnewsurl, $navtheid, $dbtbpre;
    if (empty($text)) {
        return "";
    }
    $navtheid = (int) $navtheid;
    $fstb = (int) $fstb;
    if ($copyimg) {
        $text = RepImg($text, $copyflash);
    }
    if ($copyflash) {
        $text = RepFlash($text, $copyflash);
    }
    $exp1 = "[--copyimg--]";
    $exp2 = "[/--copyimg--]";
    $r = explode($exp1, $text);
    for ($i = 1; $i < count($r); $i++) {
        $r1 = explode($exp2, $r[$i]);
        if (strstr($r1[0], "http://") || strstr($r1[0], "https://")) {
            $dourl = $r1[0];
        } else {
            //是否是本地址
            if (!strstr($r1[0], "/") && $cjnewsurl) {
                $fileqz_r = GetPageurlQz($cjnewsurl);
                $fileqz = $fileqz_r['selfqz'];
                $dourl = $fileqz . $r1[0];
            } else {
                $dourl = $qz . $r1[0];
            }
        }
        $return_r = DoTranUrl($dourl, $classid);
        $text = str_replace($exp1 . $r1[0] . $exp2, $return_r[url], $text);
        if ($return_r[tran]) {
            //记录数据库
            //变量处理
            $return_r[filesize] = (int) $return_r[filesize];
            $classid = (int) $classid;
            $return_r[type] = (int) $return_r[type];
            $theid = (int) $theid;
            $cjid = (int) $cjid;
            eInsertFileTable($return_r[filename], $return_r[filesize], $return_r[filepath], $username, $classid, '[URL]' . $return_r[filename], $return_r[type], $theid, $cjid, $public_r[fpath], 0, 0, $fstb);
            //加水
            if ($mark && $return_r[type] == 1) {
                GetMyMarkImg($return_r['yname']);
            }
        }
    }
    return $text;
}