当前位置: 首页>>代码示例>>PHP>>正文


PHP attachtype函数代码示例

本文整理汇总了PHP中attachtype函数的典型用法代码示例。如果您正苦于以下问题:PHP attachtype函数的具体用法?PHP attachtype怎么用?PHP attachtype使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了attachtype函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getattach_row

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;
        }
    }
}
开发者ID:v998,项目名称:discuzx-en,代码行数:27,代码来源:function_post.php

示例2: parseattach

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');
    }
}
开发者ID:lilhorse,项目名称:cocoa,代码行数:58,代码来源:attachment.func.php

示例3: parseattach

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);
    }
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:57,代码来源:function_attachment.php

示例4: getattach

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);
}
开发者ID:v998,项目名称:discuzx-en,代码行数:46,代码来源:function_post.php

示例5: getswfattach

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;
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:20,代码来源:swfupload.func.php

示例6: getattach

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);
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:37,代码来源:function_post.php

示例7: getattachtableid

                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'];
                }
            }
        }
    }
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:31,代码来源:modcp_moderate.php

示例8: recyclebinpostshowpostlist

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;
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:41,代码来源:admincp_recyclebinpost.php

示例9: array

    }
    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']) {
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:portal_attachment.php

示例10: parseattach

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);
        }
    }
}
开发者ID:softhui,项目名称:discuz,代码行数:97,代码来源:function_attachment.php

示例11: supe_xspace2forum


//.........这里部分代码省略.........
            $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;
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:101,代码来源:supesite.func.php

示例12: multi

        $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') {
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:moderate.inc.php

示例13: recyclebinpostshowpostlist

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;
}
开发者ID:softhui,项目名称:discuz,代码行数:42,代码来源:admincp_recyclebinpost.php

示例14: array

     $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']);
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:editpost.inc.php

示例15: procthread

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;
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:53,代码来源:misc.func.php


注:本文中的attachtype函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。