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


PHP getattachtableid函数代码示例

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


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

示例1: getranklist_activity

function getranklist_activity($num = 20, $view = 'heats', $orderby = 'all')
{
    global $_G;
    $dateline = $timestamp = '';
    if ($orderby == 'today') {
        $timestamp = TIMESTAMP - 86400;
        $dateline = "AND t.dateline>='{$timestamp}'";
    } elseif ($orderby == 'thisweek') {
        $timestamp = TIMESTAMP - 604800;
        $dateline = "AND t.dateline>='{$timestamp}'";
    } elseif ($orderby == 'thismonth') {
        $timestamp = TIMESTAMP - 2592000;
        $dateline = "AND t.dateline>='{$timestamp}'";
    }
    $data = array();
    $query = DB::query("SELECT t.tid, t.subject, t.views, t.author, t.authorid, t.replies, t.heats, t.sharetimes, t.favtimes, act.aid, act.starttimefrom, act.starttimeto, act.place, act.class, act.applynumber, act.expiration\n\t\tFROM " . DB::table('forum_thread') . " t\n\t\tLEFT JOIN " . DB::table('forum_activity') . " act ON act.tid=t.tid\n\t\tWHERE t.special='4' AND t.isgroup='0' AND t.closed='0' {$dateline} AND t.displayorder>='0'\n\t\tORDER BY t.{$view} DESC\n\t\tLIMIT 0, {$num}");
    $rank = 0;
    $attachtables = array();
    while ($thread = DB::fetch($query)) {
        ++$rank;
        $thread['rank'] = $rank;
        $thread['starttimefrom'] = dgmdate($thread['starttimefrom']);
        if ($thread['starttimeto']) {
            $thread['starttimeto'] = dgmdate($thread['starttimeto']);
        } else {
            $thread['starttimeto'] = '';
        }
        if ($thread['expiration'] && TIMESTAMP > $thread['expiration']) {
            $thread['has_expiration'] = true;
        } else {
            $thread['has_expiration'] = false;
        }
        $data[$thread['tid']] = $thread;
        $attachtables[getattachtableid($thread['tid'])][] = $thread['aid'];
    }
    foreach ($attachtables as $attachtable => $aids) {
        $attachtable = 'forum_attachment_' . $attachtable;
        $query = DB::query("SELECT tid, attachment, remote FROM " . DB::table($attachtable) . " WHERE aid IN (" . dimplode($aids) . ")");
        while ($attach = DB::fetch($query)) {
            $attach['attachurl'] = ($thread['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
            $data[$attach['tid']] = array_merge($data[$attach['tid']], $attach);
        }
    }
    return $data;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:45,代码来源:misc_ranklist.php

示例2: convertunusedattach

function convertunusedattach($aid, $tid, $pid)
{
    if (!$aid) {
        return;
    }
    global $_G;
    $attach = C::t('forum_attachment_n')->fetch_by_aid_uid(127, $aid, $_G['uid']);
    if (!$attach) {
        return;
    }
    $attach = daddslashes($attach);
    $attach['tid'] = $tid;
    $attach['pid'] = $pid;
    C::t('forum_attachment_n')->insert('tid:' . $tid, $attach);
    C::t('forum_attachment')->update($attach['aid'], array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)));
    C::t('forum_attachment_unused')->delete($attach['aid']);
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:17,代码来源:function_forum.php

示例3: getnews

 private function getnews($tid, $news)
 {
     $data = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
     $tableid = getattachtableid($tid);
     $img = C::t('forum_attachment_n')->fetch_max_image($tableid, 'tid', $tid);
     $news['title'] = $data['subject'];
     $message = preg_replace('/\\[attach\\].+\\[\\/attach\\]/is', '', $data['message']);
     $message = preg_replace('/\\[hide\\].*?\\[\\/hide\\]/is', '', $message);
     $message = preg_replace('/\\{\\:soso_e(\\d+)\\:\\}/is', '', $message);
     $message = preg_replace('/\\[img\\].*?\\[\\/img\\]/is', '', $message);
     $news['description'] = cutstr(strip_tags($message), 250);
     if ($img['aid']) {
         $news['picurl'] = getforumimg($img['aid'], '', '360', '200');
     }
     $news['url'] = $_G['siteurl'] . 'forum.php?mod=viewthread&mobile=2&tid=' . $tid . '&openid=' . $postObj->FromUserName;
     return $news;
 }
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:17,代码来源:aljwsq.inc.php

示例4: dgmdate

         $thread['author'] = "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">UID {$thread['uid']}</a>";
     } else {
         $thread['author'] = 'guest';
     }
     $thread['dateline'] = dgmdate($thread['dateline']);
     $posttable = $thread['posttableid'] ? (string) $thread['posttableid'] : '0';
     $posttablearr[$posttable][$thread['tid']] = $thread['tid'];
     $postlist[$thread['tid']] = $thread;
 }
 $attachtablearr = array();
 foreach ($posttablearr as $posttable => $tids) {
     foreach (C::t('forum_post')->fetch_all_by_tid($posttable, $tids, true, '', 0, 0, 1) as $post) {
         $thread = $postlist[$post['tid']] + $post;
         $thread['message'] = nl2br(dhtmlspecialchars($thread['message']));
         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;
     }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:31,代码来源:modcp_moderate.php

示例5: getdata

 function getdata($style, $parameter)
 {
     global $_G;
     $parameter = $this->cookparameter($parameter);
     loadcache('grouptype');
     $typeids = array();
     if (!empty($parameter['gtids'])) {
         if ($parameter['gtids'][0] == '0') {
             unset($parameter['gtids'][0]);
         }
         $typeids = $parameter['gtids'];
     }
     $tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
     $fids = !empty($parameter['fids']) ? explode(',', $parameter['fids']) : array();
     $uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
     $startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
     $items = isset($parameter['items']) ? intval($parameter['items']) : 10;
     $digest = isset($parameter['digest']) ? $parameter['digest'] : 0;
     $stick = isset($parameter['stick']) ? $parameter['stick'] : 0;
     $orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('dateline', 'todayhots', 'weekhots', 'monthhots')) ? $parameter['orderby'] : 'dateline' : 'dateline';
     $titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
     $summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
     $recommend = !empty($parameter['recommend']) ? 1 : 0;
     $keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
     $highlight = !empty($parameter['highlight']) ? 1 : 0;
     $bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
     $gviewperm = isset($parameter['gviewperm']) ? intval($parameter['gviewperm']) : -1;
     $gviewwhere = $gviewperm == -1 ? '' : " AND ff.gviewperm='{$gviewperm}'";
     $groups = array();
     if (empty($fids) && $typeids) {
         $query = DB::query('SELECT f.fid, f.name, ff.description FROM ' . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff ON f.fid = ff.fid WHERE f.fup IN (" . dimplode($typeids) . ") AND threads > 0{$gviewwhere}");
         while ($value = DB::fetch($query)) {
             $groups[$value['fid']] = $value;
             $fids[] = intval($value['fid']);
         }
         if (empty($fids)) {
             return array('html' => '', 'data' => '');
         }
     }
     require_once libfile('function/post');
     require_once libfile('function/search');
     $datalist = $list = $listpids = $threadpids = $aid2pid = $attachtables = array();
     $keyword = $keyword ? searchkey($keyword, "tr.subject LIKE '%{text}%'") : '';
     $sql = ($fids ? ' AND t.fid IN (' . dimplode($fids) . ')' : '') . ($tids ? ' AND t.tid IN (' . dimplode($tids) . ')' : '') . ($digest ? ' AND t.digest IN (' . dimplode($digest) . ')' : '') . ($stick ? ' AND t.displayorder IN (' . dimplode($stick) . ')' : '');
     if (empty($fids)) {
         $sql .= " AND t.isgroup='1'";
         if ($gviewwhere) {
             $sql .= $gviewwhere;
         }
     }
     $where = '';
     if (in_array($orderby, array('todayhots', 'weekhots', 'monthhots'))) {
         $historytime = 0;
         switch ($orderby) {
             case 'todayhots':
                 $historytime = mktime(0, 0, 0, date('m', TIMESTAMP), date('d', TIMESTAMP), date('Y', TIMESTAMP));
                 break;
             case 'weekhots':
                 $week = dgmdate(TIMESTAMP, 'w', getglobal('setting/timeformat')) - 1;
                 $week = $week != -1 ? $week : 6;
                 $historytime = mktime(0, 0, 0, date('m', TIMESTAMP), date('d', TIMESTAMP) - $week, date('Y', TIMESTAMP));
                 break;
             case 'monthhots':
                 $historytime = mktime(0, 0, 0, date('m', TIMESTAMP), 1, date('Y', TIMESTAMP));
                 break;
         }
         $where = ' AND tr.dateline>=' . $historytime;
         $orderby = 'totalitems';
     }
     $where .= ($uids ? ' AND tr.sellerid IN (' . dimplode($uids) . ')' : '') . $keyword;
     $where .= $bannedids ? ' AND tr.pid NOT IN (' . dimplode($bannedids) . ')' : '';
     $where = "{$sql} AND t.displayorder>='0' {$where}";
     $sqlfrom = " INNER JOIN `" . DB::table('forum_thread') . "` t ON t.tid=tr.tid ";
     $joinmethod = empty($tids) ? 'INNER' : 'LEFT';
     if ($recommend) {
         $sqlfrom .= " {$joinmethod} JOIN `" . DB::table('forum_forumrecommend') . "` fc ON fc.tid=tr.tid";
     }
     $sqlfield = '';
     if (empty($fids)) {
         $sqlfield = ', f.name groupname';
         $sqlfrom .= ' LEFT JOIN ' . DB::table('forum_forum') . ' f ON t.fid=f.fid LEFT JOIN ' . DB::table('forum_forumfield') . ' ff ON f.fid = ff.fid';
     }
     $sqlfield = $highlight ? ', t.highlight' : '';
     $query = DB::query("SELECT tr.pid, tr.tid, tr.aid, tr.price, tr.credit, tr.subject, tr.totalitems, tr.seller, tr.sellerid{$sqlfield}\n\t\t\tFROM " . DB::table('forum_trade') . " tr {$sqlfrom}\n\t\t\tWHERE 1{$where}\n\t\t\tORDER BY tr.{$orderby} DESC\n\t\t\tLIMIT {$startrow},{$items};");
     require_once libfile('block_thread', 'class/block/forum');
     $bt = new block_thread();
     while ($data = DB::fetch($query)) {
         if ($style['getsummary']) {
             $threadpids[$data['posttableid']][] = $data['pid'];
         }
         if ($data['aid']) {
             $aid2pid[$data['aid']] = $data['pid'];
             $attachtable = getattachtableid($data['tid']);
             $attachtables[$attachtable][] = $data['aid'];
         }
         $listpids[] = $data['pid'];
         $list[$data['pid']] = array('id' => $data['pid'], 'idtype' => 'pid', 'title' => cutstr(str_replace('\\\'', '&#39;', addslashes($data['subject'])), $titlelength, ''), 'url' => 'forum.php?mod=viewthread&do=tradeinfo&tid=' . $data['tid'] . '&pid=' . $data['pid'], 'pic' => $data['aid'] ? '' : $_G['style']['imgdir'] . '/nophoto.gif', 'picflag' => '0', 'fields' => array('fulltitle' => str_replace('\\\'', '&#39;', addslashes($data['subject'])), 'totalitems' => $data['totalitems'], 'author' => $data['seller'] ? $data['seller'] : $_G['setting']['anonymoustext'], 'authorid' => $data['sellerid'] ? $data['sellerid'] : 0, 'price' => ($data['price'] > 0 ? '&yen; ' . $data['price'] : '') . ($data['credit'] > 0 ? ($data['price'] > 0 ? lang('block/grouptrade', 'grouptrade_price_add') : '') . $data['credit'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title'] : '')));
         if ($highlight && $data['highlight']) {
             $list[$data['tid']]['fields']['showstyle'] = $bt->getthreadstyle($data['highlight']);
         }
//.........这里部分代码省略.........
开发者ID:softhui,项目名称:discuz,代码行数:101,代码来源:block_grouptrade.php

示例6: setattachment

function setattachment($bid, $caid, $tid, $pid)
{
    global $_G;
    $attachment = C::t('#sanree_brand#sanree_brand_attachment')->fetch_firstbyaid($caid);
    if ($attachment) {
        $aid = getattachnewaid($attachment['uid']);
        $insert = array('aid' => $aid, 'tid' => $tid, 'pid' => $pid, 'dateline' => $attachment['dateline'], 'filename' => $attachment['filename'], 'filesize' => $attachment['filesize'], 'attachment' => $attachment['attachment'], 'isimage' => $attachment['isimage'], 'uid' => $attachment['uid'], 'thumb' => $attachment['thumb'], 'remote' => $attachment['remote'], 'width' => $attachment['width']);
        $target = getglobal('setting/attachdir') . './forum/' . $attachment['attachment'];
        list($one, $tow) = explode("/", $attachment['attachment']);
        $appVer = $_G['setting']['version'];
        if ($appVer == 'X2') {
            require_once libfile('class/upload');
        }
        discuz_upload::make_dir(getglobal('setting/attachdir') . './forum/' . $one);
        discuz_upload::make_dir(getglobal('setting/attachdir') . './forum/' . $one . '/' . $tow);
        $source = getglobal('setting/attachdir') . './category/' . $attachment['attachment'];
        !file_exists($target) && @copy($source, $target);
        $tableid = getattachtableid($tid);
        DB::update('forum_attachment_' . $tableid, array('tid' => 0, 'pid' => 0), "tid=" . $tid);
        DB::update('forum_attachment', array('tid' => 0, 'pid' => 0), "tid=" . $tid);
        C::t('#sanree_brand#forum_attachment_n')->insert($tableid, $insert);
        DB::update('forum_attachment', array('tid' => $tid, 'pid' => $pid, 'uid' => $attachment['uid'], 'tableid' => $tableid), "aid=" . $aid);
        C::t('#sanree_brand#sanree_brand_businesses')->update($bid, array('aid' => $aid));
        $tidata = C::t('#sanree_brand#forum_post')->fetch_threadpost_by_tid_invisible($tid);
        $message = $tidata['message'];
        $message = preg_replace('/\\[poster\\]/is', '[attach]' . $aid . '[/attach]', $message);
        C::t('#sanree_brand#forum_post')->update(0, $pid, array('message' => $message, 'attachment' => 1), TRUE);
        $data = array('tid' => $tid, 'attachment' => $attachment['attachment'], 'remote' => 0);
        C::t('#sanree_brand#forum_threadimage')->delete($tid);
        C::t('#sanree_brand#forum_threadimage')->insert($data);
    }
}
开发者ID:herosrx,项目名称:shops,代码行数:32,代码来源:function_core.php

示例7: updateattachtid

function updateattachtid($where, $oldtid, $newtid)
{
    $oldattachtable = getattachtablebytid($oldtid);
    $newattachtable = getattachtablebytid($newtid);
    if ($oldattachtable != $newattachtable) {
        $query = DB::query("SELECT * FROM " . DB::table($oldattachtable) . " WHERE {$where}");
        while ($attach = DB::fetch($query)) {
            $attach = daddslashes($attach);
            $attach['tid'] = $newtid;
            DB::insert($newattachtable, $attach);
        }
        DB::delete($oldattachtable, $where);
    }
    DB::query("UPDATE " . DB::table('forum_attachment') . " SET tid='{$newtid}',tableid='" . getattachtableid($newtid) . "' WHERE {$where}");
}
开发者ID:v998,项目名称:discuzx-en,代码行数:15,代码来源:function_forum.php

示例8: updateattach

function updateattach($modnewthreads, $tid, $pid, $attachnew, $attachupdate = array(), $uid = 0)
{
    global $_G;
    $uid = $uid ? $uid : $_G['uid'];
    $uidadd = $_G['forum']['ismoderator'] ? '' : " AND uid='{$uid}'";
    if ($attachnew) {
        $newaids = array_keys($attachnew);
        $newattach = $newattachfile = $albumattach = array();
        $query = DB::query("SELECT * FROM " . DB::table('forum_attachment_unused') . " WHERE aid IN (" . dimplode($newaids) . "){$uidadd}");
        while ($attach = DB::fetch($query)) {
            $newattach[$attach['aid']] = daddslashes($attach);
            if ($attach['isimage']) {
                $newattachfile[$attach['aid']] = $attach['attachment'];
            }
        }
        if ($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
            require_once libfile('class/image');
            $image = new image();
        }
        if (!empty($_G['gp_albumaid'])) {
            array_unshift($_G['gp_albumaid'], '');
            $_G['gp_albumaid'] = array_unique($_G['gp_albumaid']);
            unset($_G['gp_albumaid'][0]);
            foreach ($_G['gp_albumaid'] as $aid) {
                if (isset($newattach[$aid])) {
                    $albumattach[$aid] = $newattach[$aid];
                }
            }
        }
        foreach ($attachnew as $aid => $attach) {
            $update = array();
            $update['readperm'] = $_G['group']['allowsetattachperm'] ? $attach['readperm'] : 0;
            $update['price'] = $_G['group']['maxprice'] ? intval($attach['price']) <= $_G['group']['maxprice'] ? intval($attach['price']) : $_G['group']['maxprice'] : 0;
            $update['tid'] = $tid;
            $update['pid'] = $pid;
            $update['uid'] = $uid;
            $update['description'] = cutstr(dhtmlspecialchars($attach['description']), 100);
            DB::update(getattachtablebytid($tid), $update, "aid='{$aid}'");
            if (!$newattach[$aid]) {
                continue;
            }
            $update = array_merge($update, $newattach[$aid]);
            if (!empty($newattachfile[$aid])) {
                if ($_G['setting']['thumbstatus'] && $_G['forum']['disablethumb']) {
                    $update['thumb'] = 0;
                    @unlink($_G['setting']['attachdir'] . '/forum/' . getimgthumbname($newattachfile[$aid]));
                    if (!empty($albumattach[$aid])) {
                        $albumattach[$aid]['thumb'] = 0;
                    }
                }
                if ($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
                    $image->Watermark($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid], '', 'forum');
                    $update['filesize'] = $image->imginfo['size'];
                }
            }
            if (!empty($_G['gp_albumaid']) && isset($albumattach[$aid])) {
                $newalbum = 0;
                if (!$_G['gp_uploadalbum']) {
                    require_once libfile('function/spacecp');
                    $_G['gp_uploadalbum'] = album_creat(array('albumname' => $_G['gp_newalbum']));
                    $newalbum = 1;
                }
                $picdata = array('albumid' => $_G['gp_uploadalbum'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $albumattach[$aid]['dateline'], 'postip' => $_G['clientip'], 'filename' => $albumattach[$aid]['filename'], 'title' => cutstr(dhtmlspecialchars($attach['description']), 100), 'type' => fileext($albumattach[$aid]['attachment']), 'size' => $albumattach[$aid]['filesize'], 'filepath' => $albumattach[$aid]['attachment'], 'thumb' => $albumattach[$aid]['thumb'], 'remote' => $albumattach[$aid]['remote'] + 2);
                $update['picid'] = DB::insert('home_pic', $picdata, 1);
                if ($newalbum) {
                    require_once libfile('function/home');
                    require_once libfile('function/spacecp');
                    album_update_pic($_G['gp_uploadalbum']);
                }
            }
            DB::insert(getattachtablebytid($tid), $update, false, true);
            DB::update('forum_attachment', array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)), "aid='{$aid}'");
            DB::delete('forum_attachment_unused', "aid='{$aid}'");
        }
        if (!empty($_G['gp_albumaid'])) {
            $albumdata = array('picnum' => DB::result_first("SELECT count(*) FROM " . DB::table('home_pic') . " WHERE albumid='{$_G['gp_uploadalbum']}'"), 'updatetime' => $_G['timestamp']);
            DB::update('home_album', $albumdata, "albumid='{$_G['gp_uploadalbum']}'");
        }
        if ($newattach) {
            ftpupload($newaids, $uid);
        }
    }
    if (!$modnewthreads && $newattach && $uid == $_G['uid']) {
        updatecreditbyaction('postattach', $uid, array(), '', count($newattach), 1, $_G['fid']);
    }
    if ($attachupdate) {
        $query = DB::query("SELECT pid, aid, attachment, thumb, remote FROM " . DB::table(getattachtablebytid($tid)) . " WHERE aid IN (" . dimplode(array_keys($attachupdate)) . ")");
        while ($attach = DB::fetch($query)) {
            if (array_key_exists($attach['aid'], $attachupdate) && $attachupdate[$attach['aid']]) {
                dunlink($attach);
            }
        }
        $uaids = dimplode($attachupdate);
        $query = DB::query("SELECT aid, width, filename, filesize, attachment, isimage, thumb, remote FROM " . DB::table('forum_attachment_unused') . " WHERE aid IN ({$uaids}){$uidadd}");
        DB::query("DELETE FROM " . DB::table('forum_attachment_unused') . " WHERE aid IN ({$uaids}){$uidadd}");
        $attachupdate = array_flip($attachupdate);
        while ($attach = DB::fetch($query)) {
            $update = $attach;
            $update['dateline'] = TIMESTAMP;
            $update['remote'] = 0;
//.........这里部分代码省略.........
开发者ID:v998,项目名称:discuzx-en,代码行数:101,代码来源:function_post.php

示例9: getranklist_activity

function getranklist_activity($num = 20, $view = 'heats', $orderby = 'all')
{
    global $_G;
    $dateline = '';
    $timestamp = 0;
    if ($orderby == 'today') {
        $timestamp = TIMESTAMP - 86400;
    } elseif ($orderby == 'thisweek') {
        $timestamp = TIMESTAMP - 604800;
    } elseif ($orderby == 'thismonth') {
        $timestamp = TIMESTAMP - 2592000;
    }
    $data = array();
    $rank = 0;
    $attachtables = array();
    $notfid = $_G['setting']['ranklist']['ignorefid'] ? explode(',', $_G['setting']['ranklist']['ignorefid']) : array();
    foreach (C::t('forum_thread')->fetch_all_rank_activity($timestamp, $notfid, $view, $num) as $thread) {
        ++$rank;
        $thread['rank'] = $rank;
        $thread['starttimefrom'] = dgmdate($thread['starttimefrom']);
        if ($thread['starttimeto']) {
            $thread['starttimeto'] = dgmdate($thread['starttimeto']);
        } else {
            $thread['starttimeto'] = '';
        }
        if ($thread['expiration'] && TIMESTAMP > $thread['expiration']) {
            $thread['has_expiration'] = true;
        } else {
            $thread['has_expiration'] = false;
        }
        $data[$thread['tid']] = $thread;
        $attachtables[getattachtableid($thread['tid'])][] = $thread['aid'];
    }
    foreach ($attachtables as $attachtable => $aids) {
        $attachs = C::t('forum_attachment_n')->fetch_all($attachtable, $aids);
        foreach ($attachs as $attach) {
            $attach['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
            $data[$attach['tid']] = array_merge($data[$attach['tid']], $attach);
        }
    }
    return $data;
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:42,代码来源:misc_ranklist.php

示例10: getdata


//.........这里部分代码省略.........
         switch ($orderby) {
             case 'weekstart':
                 $historytime = TIMESTAMP + 86400 * 7;
                 break;
             case 'monthstart':
                 $historytime = TIMESTAMP + 86400 * 30;
                 break;
         }
         $where = ' WHERE a.starttimefrom>=' . TIMESTAMP . ' AND a.starttimefrom<=' . $historytime;
         $orderby = 'a.starttimefrom ASC';
     } elseif (in_array($orderby, array('weekexp', 'monthexp'))) {
         $historytime = 0;
         switch ($orderby) {
             case 'weekexp':
                 $historytime = TIMESTAMP + 86400 * 7;
                 break;
             case 'monthexp':
                 $historytime = TIMESTAMP + 86400 * 30;
                 break;
         }
         $where = ' WHERE a.expiration>=' . TIMESTAMP . ' AND a.expiration<=' . $historytime;
         $orderby = 'a.expiration ASC';
     } elseif (in_array($orderby, array('weekhot', 'monthhot'))) {
         $historytime = 0;
         switch ($orderby) {
             case 'weekhot':
                 $historytime = TIMESTAMP + 86400 * 7;
                 break;
             case 'monthhot':
                 $historytime = TIMESTAMP + 86400 * 30;
                 break;
         }
         $where = ' WHERE a.expiration>=' . TIMESTAMP . ' AND a.expiration<=' . $historytime;
         $orderby = 'a.applynumber DESC';
     } elseif ($orderby == 'alltimehot') {
         $where = ' WHERE (a.expiration>=' . TIMESTAMP . " OR a.expiration='0')";
         $orderby = 'a.applynumber DESC';
     } else {
         $orderby = 't.dateline DESC';
     }
     $where .= $uids ? ' AND t.authorid IN (' . dimplode($uids) . ')' : '';
     if ($gender) {
         $where .= " AND a.gender='{$gender}'";
     }
     if ($class) {
         $where .= " AND a.class='{$class}'";
     }
     $sqlfrom = " INNER JOIN `" . DB::table('forum_thread') . "` t ON t.tid=a.tid {$sql} AND t.displayorder>='0'";
     $joinmethod = empty($tids) ? 'INNER' : 'LEFT';
     if ($recommend) {
         $sqlfrom .= " {$joinmethod} JOIN `" . DB::table('forum_forumrecommend') . "` fc ON fc.tid=tr.tid";
     }
     $sqlfield = $highlight ? ', t.highlight' : '';
     $query = DB::query("SELECT a.*, t.tid, t.subject, t.authorid, t.author{$sqlfield}\n\t\t\tFROM " . DB::table('forum_activity') . " a {$sqlfrom} {$where}\n\t\t\tORDER BY {$orderby}\n\t\t\tLIMIT {$startrow},{$items};");
     require_once libfile('block_thread', 'class/block/forum');
     $bt = new block_thread();
     $listtids = $threadtids = $threads = $aid2tid = $attachtables = array();
     while ($data = DB::fetch($query)) {
         $data['time'] = dgmdate($data['starttimefrom']);
         if ($data['starttimeto']) {
             $data['time'] .= ' - ' . dgmdate($data['starttimeto']);
         }
         if ($style['getsummary']) {
             $threadtids[$data['posttableid']][] = $data['tid'];
         }
         if ($data['aid']) {
             $aid2tid[$data['aid']] = $data['tid'];
             $attachtable = getattachtableid($data['tid']);
             $attachtables[$attachtable][] = $data['aid'];
         }
         $listtids[] = $data['tid'];
         $list[$data['tid']] = array('id' => $data['tid'], 'idtype' => 'tid', 'title' => cutstr(str_replace('\\\'', '&#39;', $data['subject']), $titlelength, ''), 'url' => 'forum.php?mod=viewthread&tid=' . $data['tid'] . ($viewmod ? '&from=portal' : ''), 'pic' => $data['aid'] ? '' : $_G['style']['imgdir'] . '/nophoto.gif', 'picflag' => '0', 'fields' => array('fulltitle' => str_replace('\\\'', '&#39;', addslashes($data['subject'])), 'time' => $data['time'], 'expiration' => $data['expiration'] ? dgmdate($data['expiration']) : 'N/A', 'author' => $data['author'] ? $data['author'] : $_G['setting']['anonymoustext'], 'authorid' => $data['authorid'] ? $data['authorid'] : 0, 'cost' => $data['cost'], 'place' => $data['place'], 'class' => $data['class'], 'gender' => $data['gender'], 'number' => $data['number'], 'applynumber' => $data['applynumber']));
         if ($highlight && $data['highlight']) {
             $list[$data['tid']]['fields']['showstyle'] = $bt->getthreadstyle($data['highlight']);
         }
     }
     if (!empty($listtids)) {
         $query = DB::query("SELECT tid,COUNT(*) as sum FROM " . DB::table('forum_activityapply') . " WHERE tid IN(" . dimplode($listtids) . ") GROUP BY tid");
         while ($value = DB::fetch($query)) {
             $list[$value['tid']]['fields']['applynumber'] = $value['sum'];
         }
         $threads = $bt->getthread($threadtids, $summarylength, true);
         if ($threads) {
             foreach ($threads as $tid => $var) {
                 $list[$tid]['summary'] = $var;
             }
         }
         foreach ($attachtables as $tableid => $taids) {
             $query = DB::query('SELECT aid, attachment, remote FROM ' . DB::table('forum_attachment_' . $tableid) . ' WHERE aid IN (' . dimplode($taids) . ')');
             while ($avalue = DB::fetch($query)) {
                 $list[$aid2tid[$avalue['aid']]]['pic'] = 'forum/' . $avalue['attachment'];
                 $list[$aid2tid[$avalue['aid']]]['picflag'] = $avalue['remote'] ? '2' : '1';
             }
         }
         foreach ($listtids as $key => $value) {
             $datalist[] = $list[$value];
         }
     }
     return array('html' => '', 'data' => $datalist);
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:101,代码来源:block_activity.php

示例11: time

 $update['pid'] = $pid;
 $update['uid'] = $uid;
 $update['dateline'] = time();
 $update['filename'] = $filename;
 $update['filesize'] = $filesize;
 $update['attachment'] = $attachments;
 $update['description'] = censor(cutstr(dhtmlspecialchars($description), 100));
 $update['readperm'] = 0;
 $update['price'] = 0;
 $update['isimage'] = 1;
 $update['width'] = $width;
 $update['thumb'] = 0;
 $update['picid'] = 0;
 $update['sha1'] = '';
 C::t('forum_attachment_n')->insert('tid:' . $tid, $update, false, true);
 C::t('forum_attachment')->update($aid, array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)));
 $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid);
 $attachment = 0;
 if ($attachcount) {
     if (C::t('forum_attachment_n')->count_image_by_id('tid:' . $tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid)) {
         $attachment = 2;
     } else {
         $attachment = 1;
     }
 } else {
     $attachment = 0;
 }
 C::t('forum_thread')->update($tid, array('attachment' => $attachment));
 C::t('forum_post')->update('tid:' . $tid, $pid, array('attachment' => $attachment), true);
 if (!$attachment) {
     C::t('forum_threadimage')->delete_by_tid($tid);
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:31,代码来源:upattchapi.php

示例12: getPublishPollObj


//.........这里部分代码省略.........
             }
             $message = preg_replace($atsearch, $atreplace, $message . ' ', 1);
         }
     }
     /*renxing vote insert*/
     foreach ($pollarray['options'] as $polloptvalue) {
         $polloptvalue = dhtmlspecialchars(trim($polloptvalue));
         C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue));
     }
     $polloptionpreview = '';
     $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2);
     foreach ($query as $option) {
         $polloptvalue = preg_replace("/\\[url=(https?){1}:\\/\\/([^\\[\"']+?)\\](.+?)\\[\\/url\\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']);
         $polloptionpreview .= $polloptvalue . "\t";
     }
     $polloptionpreview = daddslashes($polloptionpreview);
     $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview);
     C::t('forum_poll')->insert($data);
     /*end  renxing vote insert*/
     $class_tag = new tag();
     $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid');
     $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message);
     $message = $_GET['platType'] == 1 ? $message . "\r\n[url=/mobcent/download/down.php]" . Common::get_unicode_charset('\\u6765\\u81ea\\u5b89\\u5353\\u5ba2\\u6237\\u7aef') . '[/url]' : $message . "\r\n[url=/mobcent/download/down.php]" . Common::get_unicode_charset('\\u6765\\u81ea\\u0069\\u0070\\u0068\\u006f\\u006e\\u0065\\u5ba2\\u6237\\u7aef') . "[/url]";
     $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => time(), 'message' => $message, 'useip' => get_client_ip(), 'invisible' => $pinvisible, 'anonymous' => $isAnonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => 0, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => $attachment, 'tags' => $tagstr, 'replycredit' => 0, 'status' => 0));
     if ($_G['group']['allowat'] && $atlist) {
         foreach ($atlist as $atuid => $atusername) {
             mobcent_helper_notification::notification_add($_G['username'], $atuid, 'at', 'at_message', $_G['uid'], array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150)));
         }
         set_atlist_cookie(array_keys($atlist));
     }
     if (empty($aid_Img)) {
         $threadimageaid = $aid;
         if ($aid) {
             $tableid = getattachtableid($tid);
             $query = get_forum_attachment_unused($aid);
             while ($attach = DB::fetch($query)) {
                 $aids = $attach['aid'];
                 $data = $attach;
             }
             $uid = $_G['uid'];
             update_forum_attachment($tid, $tableid, $uid, $pid, $aids);
             $data['uid'] = 1;
             $data['tid'] = $tid;
             $data['pid'] = $pid;
             C::t('forum_attachment_n')->insert($tableid, $data);
         }
         $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '');
         $param = array();
         if ($_G['forum']['picstyle']) {
             if (!setthreadcover($pid, 0, $threadimageaid)) {
                 preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER);
                 $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>";
                 $param['clean_msgforward'] = 1;
                 $param['timeout'] = $param['refreshtime'] = 15;
             }
         }
         if ($threadimageaid && empty($imagearr)) {
             if (!$threadimage) {
                 $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid);
             }
             $threadimage = daddslashes($threadimage);
             C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
         }
     } else {
         $isInsertForumImage = false;
         foreach ($aid_Img as $key => $val) {
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:67,代码来源:PublishPollImpl_x25.php

示例13: convertunusedattach

function convertunusedattach($aid, $tid, $pid)
{
    if (!$aid) {
        return;
    }
    global $_G;
    $attach = DB::fetch_first("SELECT * FROM " . DB::table('forum_attachment_unused') . " WHERE aid='{$aid}' AND uid='{$_G['uid']}'");
    if (!$attach) {
        return;
    }
    $attach = daddslashes($attach);
    $attach['tid'] = $tid;
    $attach['pid'] = $pid;
    DB::insert(getattachtablebytid($tid), $attach, false);
    DB::update('forum_attachment', array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)), "aid='{$attach['aid']}'");
    DB::delete('forum_attachment_unused', "aid='{$attach['aid']}'");
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:17,代码来源:function_forum.php

示例14: updateattach

function updateattach($modnewthreads, $tid, $pid, $attachnew, $attachupdate = array(), $uid = 0)
{
    global $_G;
    $thread = C::t('forum_thread')->fetch($tid);
    $uid = $uid ? $uid : $_G['uid'];
    if ($attachnew) {
        $newaids = array_keys($attachnew);
        $newattach = $newattachfile = $albumattach = array();
        foreach (C::t('forum_attachment_unused')->fetch_all($newaids) as $attach) {
            if ($attach['uid'] != $uid && !$_G['forum']['ismoderator']) {
                continue;
            }
            $attach['uid'] = $uid;
            $newattach[$attach['aid']] = daddslashes($attach);
            if ($attach['isimage']) {
                $newattachfile[$attach['aid']] = $attach['attachment'];
            }
        }
        if ($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark']) || !$_G['setting']['thumbdisabledmobile']) {
            require_once libfile('class/image');
            $image = new image();
        }
        if (!empty($_GET['albumaid'])) {
            array_unshift($_GET['albumaid'], '');
            $_GET['albumaid'] = array_unique($_GET['albumaid']);
            unset($_GET['albumaid'][0]);
            foreach ($_GET['albumaid'] as $aid) {
                if (isset($newattach[$aid])) {
                    $albumattach[$aid] = $newattach[$aid];
                }
            }
        }
        foreach ($attachnew as $aid => $attach) {
            $update = array();
            $update['readperm'] = $_G['group']['allowsetattachperm'] ? $attach['readperm'] : 0;
            $update['price'] = $_G['group']['maxprice'] ? intval($attach['price']) <= $_G['group']['maxprice'] ? intval($attach['price']) : $_G['group']['maxprice'] : 0;
            $update['tid'] = $tid;
            $update['pid'] = $pid;
            $update['uid'] = $uid;
            $update['description'] = censor(cutstr(dhtmlspecialchars($attach['description']), 100));
            C::t('forum_attachment_n')->update('tid:' . $tid, $aid, $update);
            if (!$newattach[$aid]) {
                continue;
            }
            $update = array_merge($update, $newattach[$aid]);
            if (!empty($newattachfile[$aid])) {
                if ($_G['setting']['thumbstatus'] && $_G['forum']['disablethumb']) {
                    $update['thumb'] = 0;
                    @unlink($_G['setting']['attachdir'] . '/forum/' . getimgthumbname($newattachfile[$aid]));
                    if (!empty($albumattach[$aid])) {
                        $albumattach[$aid]['thumb'] = 0;
                    }
                } elseif (!$_G['setting']['thumbdisabledmobile']) {
                    $_daid = sprintf("%09d", $aid);
                    $dir1 = substr($_daid, 0, 3);
                    $dir2 = substr($_daid, 3, 2);
                    $dir3 = substr($_daid, 5, 2);
                    $dw = 320;
                    $dh = 320;
                    $thumbfile = 'image/' . $dir1 . '/' . $dir2 . '/' . $dir3 . '/' . substr($_daid, -2) . '_' . $dw . '_' . $dh . '.jpg';
                    $image->Thumb($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
                    $dw = 720;
                    $dh = 720;
                    $thumbfile = 'image/' . $dir1 . '/' . $dir2 . '/' . $dir3 . '/' . substr($_daid, -2) . '_' . $dw . '_' . $dh . '.jpg';
                    $image->Thumb($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
                }
                if ($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
                    $image->Watermark($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid], '', 'forum');
                    $update['filesize'] = $image->imginfo['size'];
                }
            }
            if (!empty($_GET['albumaid']) && isset($albumattach[$aid])) {
                $newalbum = 0;
                if (!$_GET['uploadalbum']) {
                    require_once libfile('function/spacecp');
                    $_GET['uploadalbum'] = album_creat(array('albumname' => $_GET['newalbum']));
                    $newalbum = 1;
                }
                $picdata = array('albumid' => $_GET['uploadalbum'], 'uid' => $uid, 'username' => $_G['username'], 'dateline' => $albumattach[$aid]['dateline'], 'postip' => $_G['clientip'], 'filename' => censor($albumattach[$aid]['filename']), 'title' => censor(cutstr(dhtmlspecialchars($attach['description']), 100)), 'type' => fileext($albumattach[$aid]['attachment']), 'size' => $albumattach[$aid]['filesize'], 'filepath' => $albumattach[$aid]['attachment'], 'thumb' => $albumattach[$aid]['thumb'], 'remote' => $albumattach[$aid]['remote'] + 2);
                $update['picid'] = C::t('home_pic')->insert($picdata, 1);
                if ($newalbum) {
                    require_once libfile('function/home');
                    require_once libfile('function/spacecp');
                    album_update_pic($_GET['uploadalbum']);
                }
            }
            C::t('forum_attachment_n')->insert('tid:' . $tid, $update, false, true);
            C::t('forum_attachment')->update($aid, array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)));
            C::t('forum_attachment_unused')->delete($aid);
        }
        if (!empty($_GET['albumaid'])) {
            $albumdata = array('picnum' => C::t('home_pic')->check_albumpic($_GET['uploadalbum']), 'updatetime' => $_G['timestamp']);
            C::t('home_album')->update($_GET['uploadalbum'], $albumdata);
            require_once libfile('function/home');
            require_once libfile('function/spacecp');
            album_update_pic($_GET['uploadalbum']);
        }
        if ($newattach) {
            ftpupload($newaids, $uid);
        }
//.........这里部分代码省略.........
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:101,代码来源:function_post.php

示例15: followcode

function followcode($message, $tid = 0, $pid = 0, $length = 0, $allowimg = true)
{
    global $_G;
    include_once libfile('function/post');
    $message = strip_tags($message);
    $message = messagesafeclear($message);
    if ((strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) {
        $message = preg_replace("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/ies", "", $message);
    }
    $msglower = strtolower($message);
    $htmlon = 0;
    $message = dhtmlspecialchars($message);
    if ($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
        $_G['discuzcodemessage'] =& $message;
        $param = func_get_args();
        hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode');
    }
    $_G['delattach'] = array();
    $message = fparsesmiles($message);
    if (strpos($msglower, 'attach://') !== FALSE) {
        $message = preg_replace("/attach:\\/\\/(\\d+)\\.?(\\w*)/ie", '', $message);
    }
    if (strpos($msglower, 'ed2k://') !== FALSE) {
        $message = preg_replace("/ed2k:\\/\\/(.+?)\\//e", '', $message);
    }
    if (strpos($msglower, '[/i]') !== FALSE) {
        $message = preg_replace("/\\s*\\[i=s\\][\n\r]*(.+?)[\n\r]*\\[\\/i\\]\\s*/is", '', $message);
    }
    $message = str_replace('[/p]', "\n", $message);
    $message = str_replace(array('[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), '', preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[backcolor=([#\\w]+?)\\]/i", "/\\[backcolor=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[float=left\\]/i", "/\\[float=right\\]/i"), '', $message));
    if (strpos($msglower, '[/p]') !== FALSE) {
        $message = preg_replace("/\\[p=(\\d{1,2}|null), (\\d{1,2}|null), (left|center|right)\\]/i", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:left;\">", $message);
        $message = str_replace('[/p]', '</p>', $message);
    }
    if (strpos($msglower, '[/quote]') !== FALSE) {
        $message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", '', $message);
    }
    if (strpos($msglower, '[/free]') !== FALSE) {
        $message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", '', $message);
    }
    if (isset($_G['cache']['bbcodes'][-$allowbbcode])) {
        $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], '', $message);
    }
    if (strpos($msglower, '[/hide]') !== FALSE) {
        preg_replace("/\\[hide.*?\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", "hideattach('\\1')", $message);
        if (strpos($msglower, '[hide]') !== FALSE) {
            $message = preg_replace("/\\[hide\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $message);
        }
        if (strpos($msglower, '[hide=') !== FALSE) {
            $message = preg_replace("/\\[hide=(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", '', $message);
        }
    }
    if (strpos($msglower, '[/url]') !== FALSE) {
        $message = preg_replace("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\\/\\/|www\\.|mailto:)?([^\r\n\\[\"']+?))?\\](.+?)\\[\\/url\\]/ies", "fparseurl('\\1', '\\5', '\\2')", $message);
    }
    if (strpos($msglower, '[/email]') !== FALSE) {
        $message = preg_replace("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/ies", "fparseemail('\\1', '\\4')", $message);
    }
    $nest = 0;
    while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) {
        $message = preg_replace("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/ies", "fparsetable('\\1', '\\2', '\\3')", $message);
        if (++$nest > 4) {
            break;
        }
    }
    if (strpos($msglower, '[/media]') !== FALSE) {
        $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", "fparsemedia('\\1', '\\2')", $message);
    }
    if (strpos($msglower, '[/audio]') !== FALSE) {
        $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", "fparseaudio('\\2')", $message);
    }
    if (strpos($msglower, '[/flash]') !== FALSE) {
        $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", "fparseflash('\\4');", $message);
    }
    if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) {
        $message = preg_replace("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message);
    }
    $flag = $length ? 1 : 0;
    if ($tid) {
        $extra = "onclick=\"changefeed({$tid}, {$pid}, {$flag}, this)\"";
    }
    if (strpos($msglower, '[/img]') !== FALSE) {
        $message = preg_replace(array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"), $allowimg ? array("fparseimg('\\1', '{$extra}')", "fparseimg('\\3', '{$extra}')") : '', $message);
    }
    if ($tid && $pid) {
        $_G['post_attach'] = C::t('forum_attachment_n')->fetch_all_by_id(getattachtableid($tid), 'pid', $pid);
        foreach ($_G['post_attach'] as $aid => $attach) {
            if (!empty($_G['delattach']) && in_array($aid, $_G['delattach'])) {
                continue;
            }
            $message .= "[attach]{$attach['aid']}[/attach]";
            $message = preg_replace("/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i", fparseattach($attach['aid'], $length, $extra), $message, 1);
        }
    }
    if (strpos($msglower, '[/attach]') !== FALSE) {
        $message = preg_replace("/\\[attach\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/attach\\]/ies", '', $message);
    }
    $message = clearnl($message);
    if ($length) {
        $sppos = strpos($message, chr(0) . chr(0) . chr(0));
//.........这里部分代码省略.........
开发者ID:lemonstory,项目名称:bbs,代码行数:101,代码来源:function_followcode.php


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