示例#1
0
function getattach_row($attach, &$attachs, &$imgattachs)
{
    global $_G;
    $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30);
    $attach['attachsize'] = sizecount($attach['filesize']);
    $attach['dateline'] = dgmdate($attach['dateline']);
    $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']);
    if ($attach['isimage'] < 1) {
        if ($attach['isimage']) {
            $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
            $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
        }
        if ($attach['pid']) {
            $attachs['used'][] = $attach;
        } else {
            $attachs['unused'][] = $attach;
        }
    } else {
        $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum';
        $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
        if ($attach['pid']) {
            $imgattachs['used'][] = $attach;
        } else {
            $imgattachs['unused'][] = $attach;
        }
    }
}
示例#2
0
function parseattach($attachpids, $attachtags, &$postlist, $showimages = 1, $skipaids = array())
{
    global $db, $tablepre, $discuz_uid, $skipaidlist, $readaccess, $attachlist, $attachimgpost, $maxchargespan, $timestamp, $forum, $ftp, $attachurl, $dateformat, $timeformat, $timeoffset, $hideattach, $thread, $tradesaids, $trades, $exthtml, $tagstatus, $sid, $authkey, $exempt;
    $query = $db->query("SELECT a.*, af.description, ap.aid AS payed FROM {$tablepre}attachments a LEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid LEFT JOIN {$tablepre}attachpaymentlog ap ON ap.aid=a.aid AND ap.uid='{$discuz_uid}' WHERE a.pid IN ({$attachpids})");
    $attachexists = FALSE;
    while ($attach = $db->fetch_array($query)) {
        $attachexists = TRUE;
        $exthtml = '';
        if ($skipaids && in_array($attach['aid'], $skipaids)) {
            continue;
        }
        $attached = 0;
        $extension = strtolower(fileext($attach['filename']));
        $attach['ext'] = $extension;
        $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
        $attach['attachsize'] = sizecount($attach['filesize']);
        $attach['attachimg'] = $showimages && $attachimgpost && $attach['isimage'] && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
        if ($attach['price']) {
            if ($maxchargespan && $timestamp - $attach['dateline'] >= $maxchargespan * 3600) {
                $db->query("UPDATE {$tablepre}attachments SET price='0' WHERE aid='{$attach['aid']}'");
                $attach['price'] = 0;
            } else {
                if (!$discuz_uid || !$forum['ismoderator'] && $attach['uid'] != $discuz_uid && !$attach['payed']) {
                    $attach['unpayed'] = 1;
                }
            }
        }
        $exemptattachpay = $exempt & 8 ? 1 : 0;
        $attach['payed'] = $attach['payed'] || $forum['ismoderator'] || $attach['uid'] == $discuz_uid ? 1 : 0;
        $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;
        $attach['dateline'] = dgmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600);
        $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
        if (is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
            $findattach[$attach['pid']][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            $replaceattach[$attach['pid']][] = $hideattach[$attach['pid']] ? '[attach]***[/attach]' : attachtag($attach['pid'], $attach['aid'], $postlist);
            $attached = 1;
        }
        if (!$attached || $attach['unpayed']) {
            if ($attach['isimage']) {
                $postlist[$attach['pid']]['imagelist'] .= attachlist($attach);
            } else {
                if (!$skipaidlist || !in_array($attach['aid'], $skipaidlist)) {
                    $postlist[$attach['pid']]['attachlist'] .= attachlist($attach);
                }
            }
        }
    }
    if ($attachexists) {
        foreach ($attachtags as $pid => $aids) {
            if ($findattach[$pid]) {
                $postlist[$pid]['message'] = preg_replace($findattach[$pid], $replaceattach[$pid], $postlist[$pid]['message'], 1);
                $postlist[$pid]['message'] = preg_replace($findattach[$pid], '', $postlist[$pid]['message']);
            }
        }
    } else {
        $db->query("UPDATE {$tablepre}posts SET attachment='0' WHERE pid IN ({$attachpids})", 'UNBUFFERED');
    }
}
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
    global $_G;
    $query = DB::query("SELECT a.*, af.description, l.relatedid AS payed\n\t\tFROM " . DB::table('forum_attachment') . " a\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid\n\t\tLEFT JOIN " . DB::table('common_credit_log') . " l ON l.relatedid=a.aid AND l.uid='{$_G['uid']}' AND l.operation='BAC'\n\t\tWHERE a.pid IN ({$attachpids})");
    $attachexists = FALSE;
    while ($attach = DB::fetch($query)) {
        $attachexists = TRUE;
        if ($skipaids && in_array($attach['aid'], $skipaids)) {
            continue;
        }
        $attached = 0;
        $extension = strtolower(fileext($attach['filename']));
        $attach['ext'] = $extension;
        $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
        $attach['attachsize'] = sizecount($attach['filesize']);
        $attach['attachimg'] = $_G['setting']['attachimgpost'] && $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
        if ($attach['price']) {
            if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
                DB::query("UPDATE " . DB::table('forum_attachment') . " SET price='0' WHERE aid='{$attach['aid']}'");
                $attach['price'] = 0;
            } else {
                if (!$_G['uid'] || !$_G['forum']['ismoderator'] && $attach['uid'] != $_G['uid'] && !$attach['payed']) {
                    $attach['unpayed'] = 1;
                }
            }
        }
        $exemptattachpay = $_G['group']['exempt'] & 8 ? 1 : 0;
        $attach['payed'] = $attach['payed'] || $_G['forum']['ismoderator'] || $attach['uid'] == $_G['uid'] ? 1 : 0;
        $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] . '/' : $_G['setting']['attachurl']) . 'forum/';
        $attach['dateline'] = dgmdate($attach['dateline'], 'u');
        $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
        if (!empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
            $findattach[$attach['pid']][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            $replaceattach[$attach['pid']][] = attachtag($attach['pid'], $attach['aid'], $postlist);
            $attached = 1;
        }
        if (!$attached) {
            if ($attach['isimage']) {
                $postlist[$attach['pid']]['imagelist'] .= attachlist($attach);
            } else {
                if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
                    $postlist[$attach['pid']]['attachlist'] .= attachlist($attach);
                }
            }
        }
    }
    if ($attachexists) {
        foreach ($attachtags as $pid => $aids) {
            if ($findattach[$pid]) {
                $postlist[$pid]['message'] = preg_replace($findattach[$pid], $replaceattach[$pid], $postlist[$pid]['message'], 1);
                $postlist[$pid]['message'] = preg_replace($findattach[$pid], '', $postlist[$pid]['message']);
            }
        }
    } else {
        updatepost(array('attachment' => '0'), "pid IN ({$attachpids})", true);
    }
}
示例#4
0
function getattach($pid, $posttime = 0)
{
    global $_G;
    require_once libfile('function/attachment');
    $attachs = $imgattachs = array();
    $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : '';
    $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : '';
    $query = DB::query("SELECT a.*, af.description\r\n\t\tFROM " . DB::table('forum_attachment') . " a\r\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af USING(aid)\r\n\t\tWHERE (a.uid='{$_G['uid']}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY a.aid DESC");
    if (!empty($_G['fid']) && $_G['forum']['attachextensions']) {
        $allowext = str_replace(' ', '', $_G['forum']['attachextensions']);
        $allowext = explode(',', $allowext);
    } else {
        $allowext = '';
    }
    while ($attach = DB::fetch($query)) {
        $attach['filenametitle'] = $attach['filename'];
        $attach['ext'] = fileext($attach['filename']);
        if ($allowext && !in_array($attach['ext'], $allowext)) {
            continue;
        }
        $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30);
        $attach['attachsize'] = sizecount($attach['filesize']);
        $attach['dateline'] = dgmdate($attach['dateline']);
        $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']);
        if ($attach['isimage'] < 1) {
            if ($attach['isimage']) {
                $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
            }
            if ($attach['pid']) {
                $attachs['used'][] = $attach;
            } else {
                $attachs['unused'][] = $attach;
            }
        } else {
            $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum';
            $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
            if ($attach['pid']) {
                $imgattachs['used'][] = $attach;
            } else {
                $imgattachs['unused'][] = $attach;
            }
        }
    }
    return array('attachs' => $attachs, 'imgattachs' => $imgattachs);
}
function getswfattach($getcount = 1)
{
    global $db, $tablepre, $discuz_uid, $dateformat, $timeformat, $timeoffset;
    require_once DISCUZ_ROOT . './include/attachment.func.php';
    $swfattachs = array();
    if ($getcount) {
        $swfattachs = $db->result_first("SELECT count(*) FROM {$tablepre}attachments WHERE tid='0' AND pid='0' AND uid='{$discuz_uid}' ORDER BY dateline");
    } else {
        $query = $db->query("SELECT aid, filename, description, isimage, thumb, attachment, dateline, filesize, width FROM {$tablepre}attachments WHERE tid='0' AND pid='0' AND uid='{$discuz_uid}' ORDER BY dateline");
        while ($swfattach = $db->fetch_array($query)) {
            $swfattach['filenametitle'] = $swfattach['filename'];
            $swfattach['filename'] = cutstr($swfattach['filename'], 30);
            $swfattach['attachsize'] = sizecount($swfattach['filesize']);
            $swfattach['dateline'] = gmdate("{$dateformat} {$timeformat}", $swfattach['dateline'] + $timeoffset * 3600);
            $swfattach['filetype'] = attachtype(fileext($swfattach['attachment']) . "\t" . $swfattach['filetype']);
            $swfattachs[] = $swfattach;
        }
    }
    return $swfattachs;
}
示例#6
0
function getattach($pid, $posttime = 0)
{
    global $_G;
    require_once libfile('function/attachment');
    $attachs = $imgattachs = array();
    $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : '';
    $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : '';
    $query = DB::query("SELECT a.*, af.description\n\t\tFROM " . DB::table('forum_attachment') . " a\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid\n\t\tWHERE (a.uid='{$_G['uid']}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY dateline");
    while ($attach = DB::fetch($query)) {
        $attach['filenametitle'] = $attach['filename'];
        $attach['ext'] = fileext($attach['filename']);
        $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30);
        $attach['attachsize'] = sizecount($attach['filesize']);
        $attach['dateline'] = dgmdate($attach['dateline']);
        $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']);
        if ($attach['isimage'] < 1) {
            if ($attach['isimage']) {
                $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width'];
            }
            if ($attach['pid']) {
                $attachs['used'][] = $attach;
            } else {
                $attachs['unused'][] = $attach;
            }
        } else {
            $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum';
            $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width'];
            if ($attach['pid']) {
                $imgattachs['used'][] = $attach;
            } else {
                $imgattachs['unused'][] = $attach;
            }
        }
    }
    return array('attachs' => $attachs, 'imgattachs' => $imgattachs);
}
示例#7
0
                if ($thread['attachment']) {
                    $attachtable = getattachtableid($thread['tid']);
                    $attachtablearr[$attachtable][$thread['tid']] = $thread['tid'];
                } else {
                    $thread['attach'] = '';
                }
                if ($thread['sortid']) {
                    require_once libfile('function/threadsort');
                    $threadsortshow = threadsortshow($thread['sortid'], $thread['tid']);
                    foreach ($threadsortshow['optionlist'] as $option) {
                        $thread['sortinfo'] .= $option['title'] . ' ' . $option['value'] . "<br />";
                    }
                } else {
                    $thread['sortinfo'] = '';
                }
                $postlist[$post['tid']] = $thread;
            }
        }
        if (!empty($attachtablearr)) {
            require_once libfile('function/attachment');
            foreach ($attachtablearr as $attachtable => $tids) {
                foreach (C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'tid', $tids) as $attach) {
                    $tid = $attach['tid'];
                    $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                    $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                    $postlist[$tid]['attach'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
                }
            }
        }
    }
}
function recyclebinpostshowpostlist($sql, $start_limit, $lpp)
{
    global $_G, $lang, $posttableid;
    $tids = $fids = array();
    $query = DB::query("SELECT message, useip, attachment, htmlon, smileyoff, bbcodeoff, pid, tid, fid, author, dateline, subject, authorid, anonymous FROM " . DB::table(getposttable($posttableid)) . "\r\n\t\tWHERE invisible='-5' {$sql} ORDER BY dateline DESC LIMIT {$start_limit}, {$lpp}");
    while ($post = DB::fetch($query)) {
        $postlist[] = $post;
    }
    if (empty($postlist)) {
        return false;
    }
    foreach ($postlist as $key => $post) {
        $tids[$post['tid']] = $post['tid'];
        $fids[$post['fid']] = $post['fid'];
    }
    $query = DB::query("SELECT tid, subject as tsubject FROM " . DB::table('forum_thread') . " WHERE tid IN (" . dimplode($tids) . ")");
    while ($thread = DB::fetch($query)) {
        $threadlist[$thread['tid']] = $thread;
    }
    $query = DB::query("SELECT fid, name AS forumname, allowsmilies, allowhtml, allowbbcode, allowimgcode FROM " . DB::table('forum_forum') . " WHERE fid IN (" . dimplode($fids) . ")");
    while ($forum = DB::fetch($query)) {
        $forumlist[$forum['fid']] = $forum;
    }
    foreach ($postlist as $key => $post) {
        $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']);
        $post['dateline'] = dgmdate($post['dateline']);
        if ($post['attachment']) {
            require_once libfile('function/attachment');
            $queryattach = DB::query("SELECT aid, filename, filesize, attachment, isimage, remote FROM " . DB::table(getattachtablebytid($post['tid'])) . " WHERE pid='{$post['pid']}'");
            while ($attach = DB::fetch($queryattach)) {
                $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
            }
        }
        showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$post['pid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"undelete\" /><label for=\"mod_{$post['pid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" /><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">" . $forumlist[$post['fid']]['forumname'] . "</a> &raquo; <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">" . $threadlist[$post['tid']]['tsubject'] . "</a>" . ($post['subject'] ? ' &raquo; ' . $post['subject'] : '') . "</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} &nbsp;&nbsp; IP: {$post['useip']}</p>"));
        showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $post['message'] . '</div>');
        showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['isanonymous']}: " . ($post['anonymous'] ? $lang['yes'] : $lang['no']) . " &nbsp;&nbsp; {$lang['ishtmlon']}: " . ($post['htmlon'] ? $lang['yes'] : $lang['no']));
    }
    return true;
}
    }
    if ($aid) {
        C::t('portal_article_title')->update($aid, array('pic' => ''));
    }
    C::t('portal_attachment')->delete($id);
    pic_delete($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
    showmessage('portal_image_noexist');
} elseif ($operation == 'getattach') {
    require_once libfile('function/attachment');
    if ($attach['isimage']) {
        require_once libfile('function/home');
        $smallimg = pic_get($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
        $bigimg = pic_get($attach['attachment'], 'portal', 0, $attach['remote']);
        $coverstr = addslashes(serialize(array('pic' => 'portal/' . $attach['attachment'], 'thumb' => $attach['thumb'], 'remote' => $attach['remote'])));
    }
    $attach['filetype'] = attachtype($attach['filetype'] . "\t" . $attach['filetype']);
    $attach['filesize'] = sizecount($attach['filesize']);
    include template('portal/portal_attachment');
    exit;
} else {
    $filename = $_G['setting']['attachdir'] . '/portal/' . $attach['attachment'];
    if (!$attach['remote'] && !is_readable($filename)) {
        showmessage('attachment_nonexistence');
    }
    $readmod = 2;
    //read local file's function: 1=fread 2=readfile 3=fpassthru 4=fpassthru+multiple
    $range = 0;
    if ($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
        list($range) = explode('-', str_replace('bytes=', '', $_SERVER['HTTP_RANGE']));
    }
    if ($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $attach['isimage']) {
示例#10
0
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
    global $_G;
    if (!$attachpids) {
        return;
    }
    $attachpids = is_array($attachpids) ? $attachpids : array($attachpids);
    $attachexists = FALSE;
    $skipattachcode = $aids = $payaids = $findattach = array();
    foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_G['tid'], 'pid', $attachpids) as $attach) {
        $attachexists = TRUE;
        if ($skipaids && in_array($attach['aid'], $skipaids)) {
            $skipattachcode[$attach[pid]][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            continue;
        }
        $attached = 0;
        $extension = strtolower(fileext($attach['filename']));
        $attach['ext'] = $extension;
        $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
        $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
        $attach['attachsize'] = sizecount($attach['filesize']);
        if ($attach['isimage'] && !$_G['setting']['attachimgpost']) {
            $attach['isimage'] = 0;
        }
        $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
        if ($attach['attachimg']) {
            $GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
        }
        if ($attach['price']) {
            if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
                C::t('forum_attachment_n')->update('tid:' . $_G['tid'], $attach['aid'], array('price' => 0));
                $attach['price'] = 0;
            } elseif (!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
                $payaids[$attach['aid']] = $attach['pid'];
            }
        }
        $attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
        $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
        $attach['dbdateline'] = $attach['dateline'];
        $attach['dateline'] = dgmdate($attach['dateline'], 'u');
        $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
        if (!defined('IN_MOBILE_API') && !empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
            $findattach[$attach['pid']][$attach['aid']] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            $attached = 1;
        }
        if (!$attached) {
            if ($attach['isimage']) {
                $postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
                $postlist[$attach['pid']]['imagelistcount']++;
                if ($postlist[$attach['pid']]['first']) {
                    $GLOBALS['firstimgs'][] = $attach['aid'];
                }
            } else {
                if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
                    $postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
                }
            }
        }
        $aids[] = $attach['aid'];
    }
    if ($aids) {
        $attachs = C::t('forum_attachment')->fetch_all($aids);
        foreach ($attachs as $aid => $attach) {
            if ($postlist[$attach['pid']]) {
                $postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
            }
        }
    }
    if ($payaids) {
        foreach (C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($payaids)) as $creditlog) {
            $postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
        }
    }
    if (!empty($skipattachcode)) {
        foreach ($skipattachcode as $pid => $findskipattach) {
            foreach ($findskipattach as $findskip) {
                $postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
            }
        }
    }
    if ($attachexists) {
        foreach ($attachtags as $pid => $aids) {
            if ($findattach[$pid]) {
                foreach ($findattach[$pid] as $aid => $find) {
                    $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
                    $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
                }
            }
        }
    } else {
        loadcache('posttableids');
        $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
        foreach ($posttableids as $id) {
            C::t('forum_post')->update($id, $attachpids, array('attachment' => '0'), true);
        }
    }
}
function supe_xspace2forum($itemid, &$subject, &$message, &$special, &$iconid, &$trade)
{
    global $timestamp, $timeoffset, $dateformat, $timeformat, $supe;
    include_once language('misc');
    supe_dbconnect();
    $query = $supe['db']->query("SELECT * FROM {$supe[tablepre]}spaceitems WHERE itemid='{$itemid}'");
    if (!($item = $supe['db']->fetch_array($query))) {
        return array();
    }
    $subject .= str_replace('"', '&quot;', $item['subject']);
    switch ($item['type']) {
        case 'blog':
            $special = 0;
            $query = $supe['db']->query("SELECT message, postip, weather, mood, customfieldid, customfieldtext FROM {$supe[tablepre]}spaceblogs WHERE itemid='{$itemid}'");
            $item += $supe['db']->fetch_array($query);
            $message .= supe_html2bbcode($item['message']);
            break;
        case 'image':
            $special = 0;
            $query = $supe['db']->query("SELECT message, postip, customfieldid, customfieldtext FROM {$supe[tablepre]}spaceimages WHERE itemid='{$itemid}'");
            $item += $supe['db']->fetch_array($query);
            $message .= "[b]{$language['supe_picture_story']}:[/b]  \r\n " . supe_html2bbcode($item[message]);
            break;
        case 'goods':
            $special = 2;
            $query = $supe['db']->query("SELECT * FROM {$supe[tablepre]}spacegoods WHERE itemid='{$itemid}'");
            $item += $supe['db']->fetch_array($query);
            $message .= supe_html2bbcode($item['message']);
            $trade['trade_expiration'] = $timestamp + 30 * 86400;
            $trade['seller'] = $item['alipay'];
            $trade['item_name'] = $item['subject'];
            $trade['item_price'] = $item['price'];
            $trade['item_number'] = $item['salednum'] ? $item['salednum'] : 1;
            $trade['item_quality'] = $item['quality'] == 'new' ? 1 : 2;
            $trade['item_locus'] = $item['province'] . ' ' . $item['city'];
            $trade['item_transport'] = $item['chargemode'] == 'buy' ? 2 : 1;
            $trade['postage_mail'] = $item['chargemail'];
            $trade['postage_express'] = $item['chargeexpress'];
            $trade['postage_ems'] = $item['chargeems'];
            $trade['item_type'] = 1;
            break;
        case 'file':
            $special = 0;
            $query = $supe['db']->query("SELECT message, relativetags, postip, relativeitemids, customfieldid, customfieldtext, includetags, filesize, filesizeunit, version, producer, downfrom, language, permission, system, remoteurl FROM {$supe[tablepre]}spacefiles WHERE itemid='{$itemid}'");
            $item += $supe['db']->fetch_array($query);
            $message .= '[list]';
            $message .= "[*][b]{$language['supe_software_size']}:[/b] {$item['filesize']}\r\n";
            $message .= "[*][b]{$language['supe_software_version']}:[/b] {$item['version']}\r\n";
            $message .= "[*][b]{$language['supe_software_producer']}:[/b] {$item['producer']}\r\n";
            $message .= "[*][b]{$language['supe_software_downfrom']}:[/b] {$item['downfrom']}\r\n";
            $message .= "[*][b]{$language['supe_software_language']}:[/b] {$item['language']}\r\n";
            $message .= "[*][b]{$language['supe_software_permission']}:[/b] {$item['permission']} \r\n";
            $message .= "[*][b]{$language['supe_software_system']}:[/b] {$item['system']}\r\n";
            $item['digest'] = $language['supe_digest_' . intval($item['digest'])];
            $message .= "[*][b]{$language['supe_digest_level']}:[/b] {$item['digest']} \r\n";
            $message .= "[*][b]{$language['supe_software_introduce']}:[/b]\r\n" . supe_html2bbcode($item[message]) . "\r\n\r\n";
            if ($item['remoteurl'] = unserialize($item['remoteurl'])) {
                $message .= "[*][b]{$language['supe_download_from_remote']}:[/b]\r\n";
                foreach ($item['remoteurl'] as $val) {
                    $message .= "[url={$val['remoteurl']}][/b]{$val[remoteurlname]}[/b][/url]\r\n";
                }
            }
            $message .= '[/list]';
            break;
        case 'link':
            $special = 0;
            $query = $supe['db']->query("SELECT url, message, postip, customfieldid, customfieldtext FROM {$supe[tablepre]}spacelinks WHERE itemid='{$itemid}'");
            $item += $supe['db']->fetch_array($query);
            $message .= '[list]';
            $message .= "[*][b]{$language['supe_linkurl']}:[/b] [url]{$item[url]}[/url]\r\n";
            $message .= "[*][b]{$language['supe_snapshot']}:[/b] [url={$supe[siteurl]}/batch.snapshot.php?itemid={$item['itemid']}]{$language['supe_viewsnapshot']}[/url] \r\n";
            $message .= "[*][b]{$language['supe_urldescription']}:[/b]\r\n";
            $message .= supe_html2bbcode($item['message']);
            $message .= '[/list]';
            break;
        default:
            $special = 0;
    }
    $message_customfield = '';
    if ($item['customfieldid'] && $item['customfieldtext']) {
        $customfielddata = unserialize($item['customfieldtext']);
        $query = $supe['db']->query("SELECT name, customfieldtext FROM {$supe[tablepre]}customfields WHERE customfieldid='{$item['customfieldid']}'");
        $querydata = $supe['db']->fetch_array($query);
        $customfieldname = $querydata['name'];
        $customfieldstruct = unserialize($querydata['customfieldtext']);
        unset($querydata);
        $len = count($customfieldstruct);
        $message_customfield .= "[quote][b]{$customfieldname}[/b]:\r\n";
        for ($i = 0; $i < $len; $i++) {
            switch ($customfieldstruct[$i]['type']) {
                case 'input':
                case 'textarea':
                case 'select':
                    $message_customfield .= "[*][b]{$customfieldstruct[$i][name]}[/b] : {$customfielddata[$i]} \r\n";
                    break;
                case 'checkbox':
                    $message_customfield .= "[*][b]{$customfieldstruct[$i][name]}[/b] : " . join(',', $customfielddata[$i]) . "\r\n";
                    break;
            }
        }
        unset($customfieldstruct, $customfieldname, $len);
        $message_customfield .= "[/quote]\r\n";
    }
    $message_attachments = '';
    if ($item['haveattach']) {
        $message_attachments = $item['type'] != 'file' ? "\r\n[b]{$language['attach']}:[/b]\r\n" : "[b]{$language['supe_donwload_from_local']}:[/b]  \r\n";
        $query = $supe['db']->query("SELECT aid, dateline, filename, subject, attachtype, isimage, size, filepath, thumbpath, downloads FROM {$supe[tablepre]}attachments WHERE hash='{$item['hash']}'");
        while ($attach = $supe['db']->fetch_array($query)) {
            if ($attach['isimage']) {
                $attach['dateline'] = gmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600);
                if ($item['message'] && !preg_match("/src=\"[^\"]*" . preg_quote($attach[filepath], '/') . "\"/is", $item['message'])) {
                    $message_attachments .= "[url={$supe[siteurl]}/attachments/{$attach['filepath']}][img]{$supe[siteurl]}/attachments/{$attach[thumbpath]}[/img][/url]\r\n";
                    $message_attachments .= "[b]{$attach[subject]}[/b]  [{$language['supe_dateline']}:{$attach['dateline']}]\r\n";
                }
            } else {
                require_once DISCUZ_ROOT . './include/attachment.func.php';
                $attach['dateline'] = gmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600);
                $attach['filesize'] = sizecount($attach['filesize']);
                $attach['filetype'] = supe_html2bbcode(attachtype(fileext($attach['attachment']) . "\t" . $attach['filetype']));
                $message_attachments .= "{$attach['filetype']} [url={$supe[siteurl]}/batch.download.php?aid={$attach['aid']}][b]{$attach[filename]}[/b][/url]\r\n";
                $message_attachments .= "[{$language['supe_dateline']}:{$attach['dateline']} - {$language['supe_download_count']}:{$attach['downloads']}]\r\n";
            }
        }
    }
    $message .= $message_customfield . $message_attachments;
    return $item;
}
示例#12
0
        $modcount = $db->result($query, 0);
        $multipage = multi($modcount, $ppp, $page, "admincp.php?action=modreplies&filter={$filter}&modfid={$modfid}");
        $posts = '';
        $query = $db->query("SELECT f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode,\r\n\t\t\tp.pid, p.fid, p.tid, p.author, p.authorid, p.subject, p.dateline, p.message, p.useip, p.attachment,\r\n\t\t\tp.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject\r\n\t\t\tFROM {$tablepre}posts p\r\n\t\t\tLEFT JOIN {$tablepre}threads t ON t.tid=p.tid\r\n\t\t\tLEFT JOIN {$tablepre}forums f ON f.fid=p.fid\r\n\t\t\tWHERE p.invisible='{$displayorder}' AND p.first='0' {$fidadd['and']}{$fidadd['p']}{$fidadd['fids']}\r\n\t\t\tORDER BY p.dateline DESC LIMIT {$start_limit}, {$ppp}");
        while ($post = $db->fetch_array($query)) {
            $post['dateline'] = gmdate("{$dateformat} {$timeformat}", $post['dateline'] + $timeoffset * 3600);
            $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>';
            $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']);
            $thisbg = $thisbg == 'altbg2' ? 'altbg1' : 'altbg2';
            $posts .= "<tr><td colspan=2 style=\"height: 2px\"></td></tr><tr class=\"altbg1\" id=\"mod_{$post['pid']}_row1\"><td width=\"15%\" height=\"100%\">\n" . "<b>{$post['author']}</b>({$post['useip']})</td>\n" . "<td><a href=\"forumdisplay.php?fid={$post['fid']}\" target=\"_blank\">{$post['forumname']}</a> <b>&raquo;</b> " . "<a href=\"viewthread.php?tid={$post['tid']}\" target=\"_blank\">{$post['tsubject']}</a> <b>&raquo;</b> {$post['subject']}</a></td></tr>\n" . "<tr class=\"altbg2\" id=\"mod_{$post['pid']}_row2\"><td valign=\"middle\" >" . "<input class=\"radio\" type=\"radio\" name=\"mod[{$post['pid']}]\" value=\"validate\" id=\"mod_{$post['pid']}_1\" checked  onclick=\"mod_setbg({$post['pid']}, 'validate');\">{$lang['validate']}<br />\n" . "<input class=\"radio\" type=\"radio\" name=\"mod[{$post['pid']}]\" value=\"delete\" id=\"mod_{$post['pid']}_2\" onclick=\"mod_setbg({$post['pid']}, 'delete');\">{$lang['delete']}<br />\n" . "<input class=\"radio\" type=\"radio\" name=\"mod[{$post['pid']}]\" value=\"ignore\" id=\"mod_{$post['pid']}_3\" onclick=\"mod_setbg({$post['pid']}, 'ignore');\">{$lang['ignore']}<br />\n" . "</td>" . "<td style=\"border-left: 1px #BBDCF1 solid; padding: 4px;\"><div style=\"overflow: auto; overflow-x: hidden; height:120px; word-break: break-all\">{$post['message']}";
            if ($post['attachment']) {
                require_once DISCUZ_ROOT . './include/attachment.func.php';
                $queryattach = $db->query("SELECT aid, filename, filetype, filesize, attachment, isimage FROM {$tablepre}attachments WHERE pid='{$post['pid']}'");
                while ($attach = $db->fetch_array($queryattach)) {
                    $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"{$attachurl}/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"{$attachurl}/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                    $posts .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t" . $attach['filetype']) . $attach['url'];
                }
            }
            $posts .= "</div></td></tr><tr class=altbg2 id=\"mod_{$post['pid']}_row3\"><td style=\"text-align: center; padding: 0px;\">{$post['dateline']}</td><td style=\"border-left: 1px #BBDCF1 solid; padding: 2px 10px 2px 10px;\">\n" . "<a href=\"post.php?action=edit&fid={$thread['fid']}&tid={$post['tid']}&pid={$post['pid']}&page=1&mod=edit\" target=\"_blank\">" . $lang['moderate_edit_post'] . "</a> " . "&nbsp;&nbsp;|&nbsp;&nbsp; " . $lang['moderate_reasonpm'] . "&nbsp; <input type=text size=30 name=pm_{$post['pid']} id=pm_{$post['pid']} style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"\$('pm_{$post['pid']}').value=this.value\">{$modreasonoptions}</select>" . "</td></tr>\n";
        }
        $posts = $posts ? $posts : '<tr><td colspan="2" class="altbg1"><a href="admincp.php?action=modthreads">' . $lang['moderate_posts_none'] . '</a></td></tr>';
        shownav('menu_moderate_modreplies');
        ?>
<style type="text/css">
.mod_validate td{ background: #FFFFFF; }
.mod_delete td{	background: #FFEBE7; }
.mod_ignore td{ background: #EEEEEE; }
</style>
<script type="text/javascript">
function mod_setbg(tid, value) {
	if(value == 'validate') {
示例#13
0
function recyclebinpostshowpostlist($fid, $authors, $starttime, $endtime, $keywords, $start_limit, $lpp)
{
    global $_G, $lang, $posttableid, $security;
    $tids = $fids = array();
    if ($security) {
        $postlist = C::t('#security#security_evilpost')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
    } else {
        $postlist = C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
    }
    if (empty($postlist)) {
        return false;
    }
    foreach ($postlist as $key => $post) {
        $tids[$post['tid']] = $post['tid'];
        $fids[$post['fid']] = $post['fid'];
    }
    foreach (C::t('forum_thread')->fetch_all_by_tid($tids) as $thread) {
        $thread['tsubject'] = $thread['subject'];
        $threadlist[$thread['tid']] = $thread;
    }
    $query = C::t('forum_forum')->fetch_all_by_fid($fids);
    foreach ($query as $val) {
        $forum = array('fid' => $val['fid'], 'forumname' => $val['name'], 'allowsmilies' => $val['allowsmilies'], 'allowhtml' => $val['allowhtml'], 'allowbbcode' => $val['allowbbcode'], 'allowimgcode' => $val['allowimgcode']);
        $forumlist[$forum['fid']] = $forum;
    }
    foreach ($postlist as $key => $post) {
        $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']);
        $post['dateline'] = dgmdate($post['dateline']);
        if ($post['attachment']) {
            require_once libfile('function/attachment');
            foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $post['tid'], 'pid', $post['pid']) as $attach) {
                $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
            }
        }
        showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$post['pid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"undelete\" /><label for=\"mod_{$post['pid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" /><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">" . $forumlist[$post['fid']]['forumname'] . "</a> &raquo; <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">" . $threadlist[$post['tid']]['tsubject'] . "</a>" . ($post['subject'] ? ' &raquo; ' . $post['subject'] : '') . "</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} &nbsp;&nbsp; IP: {$post['useip']}</p>"));
        showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $post['message'] . '</div>');
        showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['isanonymous']}: " . ($post['anonymous'] ? $lang['yes'] : $lang['no']) . " &nbsp;&nbsp; {$lang['ishtmlon']}: " . ($post['htmlon'] ? $lang['yes'] : $lang['no']));
    }
    return true;
}
示例#14
0
     $videolist = array();
     $query = $db->query("SELECT vid, vthumb, vtitle, displayorder FROM {$tablepre}videos WHERE tid='{$tid}'");
     while ($videoinfo = $db->fetch_array($query)) {
         $videolist[] = $videoinfo;
     }
 }
 if ($postinfo['attachment']) {
     require_once DISCUZ_ROOT . './include/attachment.func.php';
     $attachfind = $attachreplace = $attachments = array();
     $query = $db->query("SELECT * FROM {$tablepre}attachments WHERE pid='{$postinfo['pid']}'");
     while ($attach = $db->fetch_array($query)) {
         $attach['filenametitle'] = $attach['filename'];
         $attach['filename'] = cutstr($attach['filename'], 30);
         $attach['dateline'] = gmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600);
         $attach['filesize'] = sizecount($attach[filesize]);
         $attach['filetype'] = attachtype(fileext($attach['attachment']) . "\t" . $attach['filetype']);
         if ($attach['isimage']) {
             $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;
             $attachfind[] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
             $attachreplace[] = '[attachimg]' . $attach['aid'] . '[/attachimg]';
         }
         if ($special == 2 && $trade['aid'] == $attach['aid']) {
             $tradeattach = $attach;
             continue;
         }
         $attachments[] = $attach;
     }
 }
 $postinfo['subject'] = str_replace('"', '&quot;', $postinfo['subject']);
 $postinfo['message'] = dhtmlspecialchars($postinfo['message']);
 $postinfo['message'] = preg_replace($language['post_edit_regexp'], '', $postinfo['message']);
示例#15
0
function procthread($thread)
{
    global $dateformat, $timeformat, $timeoffset, $ppp, $colorarray;
    if (empty($colorarray)) {
        $colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
    }
    $thread['icon'] = isset($GLOBALS['_DCACHE']['icons'][$thread['iconid']]) ? '<img src="images/icons/' . $GLOBALS['_DCACHE']['icons'][$thread['iconid']] . '" alt="Icon' . $thread['iconid'] . '" class="icon" />' : '&nbsp;';
    $thread['forumname'] = $GLOBALS['_DCACHE']['forums'][$thread['fid']]['name'];
    $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
    $thread['lastpost'] = dgmdate("{$dateformat} {$timeformat}", $thread['lastpost'] + $timeoffset * 3600);
    $thread['lastposterenc'] = rawurlencode($thread['lastposter']);
    if ($thread['replies'] > $thread['views']) {
        $thread['views'] = $thread['replies'];
    }
    $postsnum = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1;
    $thread['special'] == 3 && $thread['price'] < 0 && $thread['replies']--;
    $pagelinks = '';
    if ($postsnum > $ppp) {
        $posts = $postsnum;
        $topicpages = ceil($posts / $ppp);
        for ($i = 1; $i <= $topicpages; $i++) {
            $pagelinks .= '<a href="viewthread.php?tid=' . $thread['tid'] . '&page=' . $i . '" target="_blank">' . $i . '</a> ';
            if ($i == 6) {
                $i = $topicpages + 1;
            }
        }
        if ($topicpages > 6) {
            $pagelinks .= ' .. <a href="viewthread.php?tid=' . $thread['tid'] . '&page=' . $topicpages . '" target="_blank">' . $topicpages . '</a> ';
        }
        $thread['multipage'] = '... ' . $pagelinks;
    } else {
        $thread['multipage'] = '';
    }
    if ($thread['highlight']) {
        $string = sprintf('%02d', $thread['highlight']);
        $stylestr = sprintf('%03b', $string[0]);
        $thread['highlight'] = 'style="';
        $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
        $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
        $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
        $thread['highlight'] .= $string[1] ? 'color: ' . $colorarray[$string[1]] : '';
        $thread['highlight'] .= '"';
    } else {
        $thread['highlight'] = '';
    }
    if ($thread['attachment']) {
        require_once DISCUZ_ROOT . './include/attachment.func.php';
        $thread['attachment'] = attachtype($thread['attachment']) . ' ';
    } else {
        $thread['attachment'] = '';
    }
    return $thread;
}
示例#16
0
         $censor->check($post['message']);
     }
     $post_censor_words = $censor->words_found;
     if (count($post_censor_words) > 3) {
         $post_censor_words = array_slice($post_censor_words, 0, 3);
     }
     $post['censorwords'] = implode(', ', $post_censor_words);
     $post['modthreadkey'] = modauthkey($post['tid']);
     $post['useip'] = $post['useip'] . '-' . convertip($post['useip']);
     if ($post['attachment']) {
         require_once libfile('function/attachment');
         $queryattach = DB::query("SELECT aid, filename, filesize, attachment, isimage, remote FROM " . DB::table(getattachtablebytid($post['tid'])) . " WHERE pid='{$post['pid']}'");
         while ($attach = DB::fetch($queryattach)) {
             $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
             $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
             $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename'])) . $attach['url'];
         }
     }
     if (count($post_censor_words)) {
         $post_censor_text = "<span style=\"color: red;\">({$post['censorwords']})</span>";
     } else {
         $post_censor_text = '';
     }
     showtagheader('tbody', '', true, 'hover');
     showtablerow("id=\"mod_{$post['pid']}_row1\"", array("id=\"mod_{$post['pid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"validate\" onclick=\"mod_setbg({$post['pid']}, 'validate');\"><label for=\"mod_{$post['pid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"delete\" onclick=\"mod_setbg({$post['pid']}, 'delete');\"><label for=\"mod_{$post['pid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$post['pid']}, 'ignore');\"><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$post['pid']}');\">{$post['tsubject']}</a> {$post_censor_text}</h3><p>{$post['useip']}</p>", "<a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\">{$post['forumname']}</a>", "<p><a target=\"_blank\" href=\"" . ADMINSCRIPT . "?action=members&operation=search&uid={$post['authorid']}&submit=yes\">{$post['author']}</a></p> <p>{$post['dateline']}</p>", "<a target=\"_blank\" href=\"forum.php?mod=redirect&goto=findpost&ptid={$post['tid']}&pid={$post['pid']}\">{$lang['view']}</a>&nbsp;<a href=\"forum.php?mod=viewthread&tid={$post['tid']}&modthreadkey={$post['modthreadkey']}\" target=\"_blank\">{$lang['edit']}</a>"));
     showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">' . $post['message'] . '</div>');
     showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=validate&page={$page}&posttableid={$posttable}&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=delete&page={$page}&posttableid={$posttable}&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=ignore&page={$page}&posttableid={$posttable}&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>&nbsp;&nbsp;|&nbsp;&nbsp; " . $lang['moderate_reasonpm'] . "&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$post['pid']}\" id=\"pm_{$post['pid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"\$('pm_{$post['pid']}').value=this.value\">{$modreasonoptions}</select>");
     showtagfooter('tbody');
 }
 showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">' . cplang('moderate_all_validate') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">' . cplang('moderate_all_delete') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">' . cplang('moderate_all_ignore') . '</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">' . cplang('moderate_all_cancel') . '</a> &nbsp;<label><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all"  value="1" disabled="disabled" />' . cplang('moderate_apply_all') . '</label>', $multipage, false);
 showtablefooter();
示例#17
0
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
    global $_G;
    $query = DB::query("SELECT * FROM " . DB::table(getattachtablebytid($_G['tid'])) . " a WHERE a.pid IN ({$attachpids})");
    $attachexists = FALSE;
    $skipattachcode = $aids = $payaids = $findattach = array();
    while ($attach = DB::fetch($query)) {
        $attachexists = TRUE;
        if ($skipaids && in_array($attach['aid'], $skipaids)) {
            $skipattachcode[$attach[pid]][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            continue;
        }
        $attached = 0;
        $extension = strtolower(fileext($attach['filename']));
        $attach['ext'] = $extension;
        $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
        $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
        $attach['attachsize'] = sizecount($attach['filesize']);
        if ($attach['isimage'] && !$_G['setting']['attachimgpost']) {
            $attach['isimage'] = 0;
        }
        $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
        if ($attach['attachimg']) {
            $GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
        }
        if ($attach['price']) {
            if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
                DB::query("UPDATE " . DB::table(getattachtablebytid($_G['tid'])) . " SET price='0' WHERE aid='{$attach['aid']}'");
                $attach['price'] = 0;
            } elseif (!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
                $payaids[$attach['aid']] = $attach['pid'];
            }
        }
        $attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
        $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
        $attach['dateline'] = dgmdate($attach['dateline'], 'u');
        $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
        if (!empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
            $findattach[$attach['pid']][$attach['aid']] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            $attached = 1;
        }
        if (!$attached) {
            if ($attach['isimage']) {
                $postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
                $postlist[$attach['pid']]['imagelistcount']++;
                if ($postlist[$attach['pid']]['first']) {
                    $GLOBALS['firstimgs'][] = $attach['aid'];
                }
            } else {
                if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
                    $postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
                }
            }
        }
        $aids[] = $attach['aid'];
    }
    if ($aids) {
        $query = DB::query("SELECT aid, pid, downloads FROM " . DB::table('forum_attachment') . " WHERE aid IN (" . dimplode($aids) . ")");
        while ($attach = DB::fetch($query)) {
            $postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
        }
    }
    if ($payaids) {
        $query = DB::query("SELECT relatedid FROM " . DB::table('common_credit_log') . " WHERE relatedid IN (" . dimplode(array_keys($payaids)) . ") AND uid='{$_G['uid']}' AND operation='BAC'");
        while ($creditlog = DB::fetch($query)) {
            $postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
        }
    }
    if (!empty($skipattachcode)) {
        foreach ($skipattachcode as $pid => $findskipattach) {
            foreach ($findskipattach as $findskip) {
                $postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
            }
        }
    }
    if ($attachexists) {
        foreach ($attachtags as $pid => $aids) {
            if ($findattach[$pid]) {
                foreach ($findattach[$pid] as $aid => $find) {
                    $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]['first']), $postlist[$pid]['message'], 1);
                    $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
                }
            }
        }
    } else {
        updatepost(array('attachment' => '0'), "pid IN ({$attachpids})", true);
    }
}
示例#18
0
function getattach($posttime = 0)
{
    global $db, $tablepre, $discuz_uid, $dateformat, $timeformat, $timeoffset, $pid, $ftp, $attachurl;
    require_once DISCUZ_ROOT . './include/attachment.func.php';
    $attachs = $imgattachs = array();
    $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : '';
    $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : '';
    $query = $db->query("SELECT a.*, af.description\r\n\t\tFROM {$tablepre}attachments a\r\n\t\tLEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid\r\n\t\tWHERE (a.uid='{$discuz_uid}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY dateline");
    while ($attach = $db->fetch_array($query)) {
        $attach['filenametitle'] = $attach['filename'];
        $attach['ext'] = fileext($attach['filename']);
        $attach['filename'] = cutstr($attach['filename'], 30);
        $attach['attachsize'] = sizecount($attach['filesize']);
        $attach['dateline'] = gmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600);
        $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']);
        if ($attach['isimage'] < 1) {
            if ($attach['isimage']) {
                $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;
                $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width'];
            }
            if ($attach['pid']) {
                $attachs['used'][] = $attach;
            } else {
                $attachs['unused'][] = $attach;
            }
        } else {
            $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;
            $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width'];
            if ($attach['pid']) {
                $imgattachs['used'][] = $attach;
            } else {
                $imgattachs['unused'][] = $attach;
            }
        }
    }
    return array('attachs' => $attachs, 'imgattachs' => $imgattachs);
}
示例#19
0
 *
 *      $Id: thread_album.php 28709 2012-11-08 08:53:48Z liulanbo $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
require_once libfile('function/attachment');
$imglist = array();
foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_G['tid'], 'tid', $_G['tid'], 'aid') as $attach) {
    if ($attach['uid'] != $_G['forum_thread']['authorid']) {
        continue;
    }
    $extension = strtolower(fileext($attach['filename']));
    $attach['ext'] = $extension;
    $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
    $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
    $attach['attachsize'] = sizecount($attach['filesize']);
    if ($attach['isimage'] && !$_G['setting']['attachimgpost']) {
        $attach['isimage'] = 0;
    }
    $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
    if (!$attach['attachimg']) {
        continue;
    }
    $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
    $attach['dbdateline'] = $attach['dateline'];
    $attach['dateline'] = dgmdate($attach['dateline'], 'u');
    $imglist['aid'][] = $attach['aid'];
    $imglist['url'][] = $attach['url'] . $attach['attachment'];
    $apids[] = $attach['pid'];
}
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
    global $_G;
    if (!$attachpids) {
        return;
    }
    $attachpids = is_array($attachpids) ? $attachpids : array($attachpids);
    $attachexists = FALSE;
    $skipattachcode = $aids = $payaids = $findattach = array();
    //start
    foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_G['tid'], 'pid', $attachpids) as $attach) {
        $attachexists = TRUE;
        if ($skipaids && in_array($attach['aid'], $skipaids)) {
            $skipattachcode[$attach[pid]][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            continue;
        }
        $attached = 0;
        $extension = strtolower(fileext($attach['filename']));
        $attach['ext'] = $extension;
        $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
        $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
        $attach['attachsize'] = sizecount($attach['filesize']);
        if ($attach['isimage'] && !$_G['setting']['attachimgpost']) {
            $attach['isimage'] = 0;
        }
        $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
        if ($attach['attachimg']) {
            $GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
        }
        if ($attach['price']) {
            if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
                C::t('forum_attachment_n')->update('tid:' . $_G['tid'], $attach['aid'], array('price' => 0));
                $attach['price'] = 0;
            } elseif (!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
                $payaids[$attach['aid']] = $attach['pid'];
            }
        }
        $attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
        $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
        $attach['dbdateline'] = $attach['dateline'];
        $attach['dateline'] = dgmdate($attach['dateline'], 'u');
        $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
        if (!defined('IN_MOBILE_API') && !empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
            $findattach[$attach['pid']][$attach['aid']] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
            $attached = 1;
        }
        if (!$attached) {
            if ($attach['isimage']) {
                $postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
                $postlist[$attach['pid']]['imagelistcount']++;
                if ($postlist[$attach['pid']]['first']) {
                    $GLOBALS['firstimgs'][] = $attach['aid'];
                }
            } else {
                if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
                    $postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
                }
            }
        }
        $aids[] = $attach['aid'];
    }
    //end
    if ($aids) {
        $attachs = C::t('forum_attachment')->fetch_all($aids);
        foreach ($attachs as $aid => $attach) {
            if ($postlist[$attach['pid']]) {
                $postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
            }
        }
    }
    if ($payaids) {
        foreach (C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($payaids)) as $creditlog) {
            $postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
        }
    }
    if (!empty($skipattachcode)) {
        foreach ($skipattachcode as $pid => $findskipattach) {
            foreach ($findskipattach as $findskip) {
                $postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
            }
        }
    }
    if ($attachexists) {
        foreach ($attachtags as $pid => $aids) {
            if ($findattach[$pid]) {
                foreach ($findattach[$pid] as $aid => $find) {
                    // 嵌入录像解析代码 by BangZ 20160202
                    //debug($postlist[$pid]['message']);
                    if (preg_match("/^cnc4replay\$|^ra3replay\$|^kwreplay\$|^cnc3replay\$|^rep\$|^rec\$\t/", $postlist[$pid]['attachments'][$aid]['ext'])) {
                        if (in_array('replay_tool', $_G['setting']['plugins']['available'])) {
                            //判断插件是否启用
                            @(include_once DISCUZ_ROOT . './source/plugin/replay_tool/core.func.php');
                            // showmessage(function_exists('resolve_replay'));
                            // debug($postlist[$pid]['attachments'][$aid]);
                            $aidencode = packaids($postlist[$pid]['attachments'][$aid]);
                            $is_archive = $_G['forum_thread']['is_archived'] ? '&fid=' . $_G['fid'] . '&archiveid=' . $_G[forum_thread][archiveid] : '';
                            $resolve = resolve_replay($aid, $postlist[$pid]['attachments'][$aid], $aidencode, $is_archive);
                            $postlist[$pid]['message'] = preg_replace($find, $resolve, $postlist[$pid]['message'], 1);
                            $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
                            continue;
                        }
                    }
                    //end
                    $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
                    $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
                }
            }
        }
    } else {
        loadcache('posttableids');
        $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
        foreach ($posttableids as $id) {
            C::t('forum_post')->update($id, $attachpids, array('attachment' => '0'), true);
        }
    }
}
示例#21
0
function parseforumattach(&$post, $aids)
{
    global $_G;
    if ($aids = array_unique($aids)) {
        require_once libfile('function/attachment');
        $finds = $replaces = array();
        foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $post['tid'], 'aid', $aids) as $attach) {
            $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
            $attach['dateline'] = dgmdate($attach['dateline'], 'u');
            $extension = strtolower(fileext($attach['filename']));
            $attach['ext'] = $extension;
            $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
            $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
            $attach['attachsize'] = sizecount($attach['filesize']);
            $attach['refcheck'] = !$attach['remote'] && $_G['setting']['attachrefcheck'] || $attach['remote'] && ($_G['setting']['ftp']['hideurl'] || $attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp');
            $aidencode = packaids($attach);
            $widthcode = attachwidth($attach['width']);
            $is_archive = $_G['forum_thread']['is_archived'] ? "&fid=" . $_G['fid'] . "&archiveid=" . $_G['forum_thread']['archiveid'] : '';
            if ($attach['isimage']) {
                $attachthumb = getimgthumbname($attach['attachment']);
                if ($_G['setting']['thumbstatus'] && $attach['thumb']) {
                    $replaces[$attach['aid']] = "<a href=\"javascript:;\"><img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\" onclick=\"zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[forum][showexif]}')\"\n\t\t\t\t\t\tzoomfile=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes&nothumb=yes" : $attach['url'] . $attach['attachment']) . "\"\n\t\t\t\t\t\tsrc=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}" : $attach['url'] . $attachthumb) . "\" alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" /></a>";
                } else {
                    $replaces[$attach['aid']] = "<img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\"\n\t\t\t\t\t\tzoomfile=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes&nothumb=yes" : $attach['url'] . $attach['attachment']) . "\"\n\t\t\t\t\t\tsrc=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes " : $attach['url'] . $attach['attachment']) . "\" {$widthcode} alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" />";
                }
            } else {
                $replaces[$attach['aid']] = "{$attach['attachicon']}<a href=\"forum.php?mod=attachment{$is_archive}&aid={$aidencode}\" onmouseover=\"showMenu({'ctrlid':this.id,'pos':'12'})\" id=\"aid{$attach['aid']}\" target=\"_blank\">{$attach['filename']}</a>";
            }
            $finds[$attach['aid']] = '[attach]' . $attach['aid'] . '[/attach]';
        }
        if ($finds && $replaces) {
            $post['message'] = str_ireplace($finds, $replaces, $post['message']);
        }
    }
}
示例#22
0
			}

			$thread['dateline'] = gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);

			$thread['message'] = nl2br(dhtmlspecialchars($thread['message']));

			if($thread['attachment']) {
				require_once DISCUZ_ROOT.'./include/attachment.func.php';

				$queryattach = $db->query("SELECT aid, filename, filetype, filesize, attachment, isimage, remote FROM {$tablepre}attachments WHERE tid='$thread[tid]'");
				while($attach = $db->fetch_array($queryattach)) {
					$attachurl = $attach['remote'] ? $ftp['attachurl'] : $attachurl;
					$attach['url'] = $attach['isimage']
					? " $attach[filename] (".sizecount($attach['filesize']).")<br /><br /><img src=\"$attachurl/$attach[attachment]\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
					: "<a href=\"$attachurl/$attach[attachment]\" target=\"_blank\">$attach[filename]</a> (".sizecount($attach['filesize']).")";
					$thread['attach'] .= "<br /><br />$lang[attachment]: ".attachtype(fileext($thread['filename'])."\t".$attach['filetype']).$attach['url'];
				}
			} else {
				$thread['attach'] = '';
			}

			$optiondata = $optionlist = array();
			if($thread['sortid']) {
				if(@include_once DISCUZ_ROOT.'./forumdata/cache/threadsort_'.$thread['sortid'].'.php') {
					$sortquery = $db->query("SELECT optionid, value FROM {$tablepre}typeoptionvars WHERE tid='$thread[tid]'");
					while($option = $db->fetch_array($sortquery)) {
						$optiondata[$option['optionid']] = $option['value'];
					}

					foreach($_DTYPE as $optionid => $option) {
						$optionlist[$option['identifier']]['title'] = $_DTYPE[$optionid]['title'];
示例#23
0
                 if (isset($issettids[$thread['tid']])) {
                     $disabledstr = 'disabled';
                 } else {
                     $issettids[$thread['tid']] = $thread['tid'];
                 }
                 $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
                 $thread = array_merge($thread, $post);
                 $thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);
                 $thread['moddateline'] = dgmdate($thread['moddateline']);
                 $thread['dateline'] = dgmdate($thread['dateline']);
                 if ($thread['attachment']) {
                     require_once libfile('function/attachment');
                     foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']) as $attach) {
                         $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                         $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                         $thread['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
                     }
                 }
                 showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" " . (empty($disabledstr) ? "checked=\"checked\"" : '') . " {$disabledstr} /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">{$thread['forumname']}</a> &raquo; {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} &nbsp;&nbsp; {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>"));
                 showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $thread['message'] . '</div>');
                 showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"home.php?mod=space&uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> &nbsp;&nbsp; {$lang['recyclebin_delete_time']}: {$thread['moddateline']}&nbsp;&nbsp; {$lang['reason']}: {$thread['reason']}");
             }
         }
         showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">' . cplang('recyclebin_all_delete') . '</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">' . cplang('recyclebin_all_undelete') . '</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">' . cplang('recyclebin_all_ignore') . '</a> &nbsp;', $multi);
         showtablefooter();
         showformfooter();
         echo '<iframe name="rbframe" style="display:none"></iframe>';
         showtagfooter('div');
     }
 } else {
     $moderate = $_GET['moderate'];
         }
         $query = $db->query("SELECT f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode,\r\n\t\t\t\tt.tid, t.fid, t.authorid, t.author, t.subject, t.views, t.replies, t.dateline,\r\n\t\t\t\tp.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff,\r\n\t\t\t\ttm.uid AS moduid, tm.username AS modusername, tm.dateline AS moddateline, tm.action AS modaction\r\n\t\t\t\tFROM {$tablepre}threads t\r\n\t\t\t\tLEFT JOIN {$tablepre}posts p ON p.tid=t.tid AND p.first='1'\r\n\t\t\t\tLEFT JOIN {$tablepre}threadsmod tm ON tm.tid=t.tid\r\n\t\t\t\tLEFT JOIN {$tablepre}forums f ON f.fid=t.fid\r\n\t\t\t\tWHERE t.displayorder='-1' {$sql}\r\n\t\t\t\tGROUP BY t.tid ORDER BY t.dateline DESC");
         $threadcount = $db->num_rows($query);
         echo '<script type="text/JavaScript">function attachimg() {}</script>';
         showtagheader('div', 'threadlist', $searchsubmit);
         showformheader('recyclebin', '', 'rbform');
         showtableheader(lang('recyclebin_result') . ' ' . $threadcount . ' <a href="#" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';" class="act lightlink normal">' . lang('research') . '</a>', 'fixpadding');
         while ($thread = $db->fetch_array($query)) {
             $thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);
             $thread['moddateline'] = gmdate("{$dateformat} {$timeformat}", $thread['moddateline'] + $timeoffset * 3600);
             $thread['dateline'] = gmdate("{$dateformat} {$timeformat}", $thread['dateline'] + $timeoffset * 3600);
             if ($thread['attachment']) {
                 require_once DISCUZ_ROOT . './include/attachment.func.php';
                 $queryattach = $db->query("SELECT aid, filename, filetype, filesize FROM {$tablepre}attachments WHERE tid='{$thread['tid']}'");
                 while ($attach = $db->fetch_array($queryattach)) {
                     $thread['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($thread['filename']) . "\t" . $attach['filetype']) . " {$attach['filename']} (" . sizecount($attach['filesize']) . ")";
                 }
             }
             showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"mod[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"mod[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" /><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"mod[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" /><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forumdisplay.php?fid={$thread['fid']}\" target=\"_blank\">{$thread['forumname']}</a> &raquo; {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"space.php?uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} &nbsp;&nbsp; {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>"));
             showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $thread['message'] . '</div>');
             showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"space.php?uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> &nbsp;&nbsp; {$lang['recyclebin_delete_time']}: {$thread['moddateline']}");
         }
         showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">' . lang('recyclebin_all_delete') . '</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">' . lang('recyclebin_all_undelete') . '</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">' . lang('recyclebin_all_ignore') . '</a> &nbsp;');
         showtablefooter();
         showformfooter();
         showtagfooter('div');
     }
 } else {
     $moderation = array('delete' => array(), 'undelete' => array(), 'ignore' => array());
     if (is_array($mod)) {
         foreach ($mod as $tid => $action) {