Exemplo n.º 1
0
    require dirname(__FILE__) . "/template/post.htm";
    require ROOT_PATH . "member/foot.php";
} elseif ($action == "edit") {
    $rsdb = $db->get_one("SELECT A.*,B.* FROM `{$_pre}content` A LEFT JOIN `{$_pre}content_1` B ON A.id=B.id WHERE A.id='{$id}' LIMIT 1");
    if ($rsdb[uid] != $lfjuid && !$web_admin) {
        showerr("你无权修改");
    }
    if ($isiframe == 1) {
        $postdb[jumpurl] = '';
    } elseif ($isiframe == 2) {
        $postdb[iframeurl] = '';
    } else {
        $postdb[iframeurl] = $postdb[jumpurl] = '';
    }
    //设法生成缩略图
    if (!$postdb[picurl] && ($file_db = get_content_attachment($postdb[content]))) {
        if ($file_db[0] && eregi("(jpg|gif)\$", $file_db[0]) && !eregi("sysimage\\/file", $file_db[0])) {
            $postdb[picurl] = $file_db[0];
            if ($webdb[if_gdimg]) {
                $postdb[picurl] = str_replace(".", "_", $file_db[0]) . '.gif';
                $Newpicpath = ROOT_PATH . "{$webdb['updir']}/{$postdb['picurl']}";
                gdpic(ROOT_PATH . "{$webdb['updir']}/{$file_db['0']}", $Newpicpath, 200, 150);
                if (!file_exists($Newpicpath)) {
                    $postdb[picurl] = $file_db[0];
                }
            }
        }
    }
    if ($postdb[picurl]) {
        $postdb[ispic] = 1;
    } else {
Exemplo n.º 2
0
     query_article_module($mid, '', $post_db, '');
 }
 //采集外部图片
 $postdb[content] = get_outpic($postdb[content], $fid, $GetOutPic);
 //去除超级链接
 $DelLink && ($postdb[content] = preg_replace("/<a([^<>]*) href=\\\\\"([^\"]+)\\\\\"/is", "<a", $postdb[content]));
 //附件目录转移
 $downloadDIR = "article/{$fid}";
 if ($webdb[ArticleDownloadDirTime]) {
     $downloadDIR .= "/" . date($webdb[ArticleDownloadDirTime], $timestamp);
 }
 $postdb[content] = move_attachment($lfjuid, $postdb[content], $downloadDIR, 'PostArticle');
 //对于太大的图片要做处理自动缩放比例
 //$postdb[content]=str_replace("<img ","<img onload=\'if(this.width>600)makesmallpic(this,600,1800);\' ",$postdb[content]);
 //获取附件
 $file_db = get_content_attachment($postdb[content]);
 //不存在本地图片时,就获取远程的图片做为缩略图
 if (!$file_db) {
     preg_match_all("/http:\\/\\/([^ '\"<>]+)\\.(gif|jpg|png)/is", $postdb[content], $array);
     $file_db = $array[0];
 }
 //当不存在缩略图时,获取图片,如果系统设置允许自动,才做处理
 if ($webdb[autoGetSmallPic] && !$postdb[picurl] && ($job == "postnew" || $job == "edit")) {
     //发表图片,如果没有缩略图,就获取第一张
     if ($file_db) {
         foreach ($file_db as $key => $value) {
             if ((eregi("jpg\$", $value) || eregi("gif\$", $value) || eregi("png\$", $value)) && !eregi("ewebeditor\\/", $value)) {
                 $postdb[picurl] = $value;
                 break;
             }
         }
Exemplo n.º 3
0
function move_attachment($uid, $str, $newdir, $type = '')
{
    global $webdb, $db, $pre, $id, $aid, $fid, $timestamp, $webdb, $Fid_db;
    if (!$str || !$uid || !$newdir) {
        return $str;
    }
    $_id = $id ? $id : $aid;
    //Ä¿Ç°½ö¶ÔÎÄÕÂ×÷´¦Àí,з¢ÎÄÕÂʱ,Éè·¨»ñÈ¡ID
    if (!$webdb[module_id] && !$_id) {
        $erp = $Fid_db[iftable][$fid];
        $rs = $db->get_one("SHOW TABLE STATUS LIKE '{$pre}article{$erp}'");
        $_id = $rs[Auto_increment];
    }
    $filedb = get_content_attachment($str);
    foreach ($filedb as $key => $value) {
        $name = basename($value);
        if ($rs = $db->get_one("SELECT * FROM {$pre}upfile WHERE filename='{$name}'")) {
            if ($_id && !in_array($_id, explode(",", $rs[ids]))) {
                $db->query("UPDATE `{$pre}upfile` SET `num`=`num`+1,ids='{$rs['ids']},{$_id}' WHERE filename='{$name}'");
            }
            continue;
        }
        $detail = explode("_", $name);
        //»ñÈ¡ÎļþµÄUIDÓëÓû§µÄUIDÒ»Ñùʱ.²Åɾ³ý.²»ÒªÂÒɾ³ý
        if ($detail[0] && $detail[0] == $uid) {
            $turepath = ROOT_PATH . $webdb[updir] . "/" . $value;
            if (!is_dir(ROOT_PATH . $webdb[updir] . "/" . $newdir)) {
                makepath(ROOT_PATH . $webdb[updir] . "/" . $newdir);
            }
            //×Ô¶¯ËõС̫´óÕŵÄͼƬ
            if ($webdb[ArticlePicWidth] && $webdb[ArticlePicHeight] && (eregi(".gif\$", $turepath) || eregi(".jpg\$", $turepath))) {
                $img_array = getimagesize($turepath);
                if ($img_array[0] > $webdb[ArticlePicWidth] || $img_array[1] > $webdb[ArticlePicHeight]) {
                    gdpic($turepath, $turepath, $webdb[ArticlePicWidth], $webdb[ArticlePicHeight], 1);
                }
            }
            //ͼƬ¼Óˮӡ
            if ($type != 'small' && $webdb[is_waterimg] && (eregi(".gif\$", $turepath) || eregi(".jpg\$", $turepath))) {
                include_once ROOT_PATH . "inc/waterimage.php";
                imageWaterMark($turepath, $webdb[waterpos], ROOT_PATH . $webdb[waterimg]);
            }
            if (@rename($turepath, ROOT_PATH . $webdb[updir] . "/{$newdir}/{$name}")) {
                $str = str_replace("{$value}", "{$newdir}/{$name}", $str);
                $db->query("INSERT INTO `{$pre}upfile` ( `module_id` , `ids` , `fid` , `uid` , `posttime` , `url` , `filename` , `num` ) VALUES ('{$webdb['module_id']}','{$_id}','{$fid}','{$uid}','{$timestamp}','{$newdir}/{$name}','{$name}','1')");
            }
        }
    }
    return $str;
}