本文整理汇总了PHP中getattachtablebytid函数的典型用法代码示例。如果您正苦于以下问题:PHP getattachtablebytid函数的具体用法?PHP getattachtablebytid怎么用?PHP getattachtablebytid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getattachtablebytid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preg_replace
$multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=recyclebin&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='" . ADMINSCRIPT . "?action=recyclebin&page='+this.value", "page(this.value)", $multi);
echo '<script type="text/JavaScript">var replyreload;function attachimg() {}</script>';
showtagheader('div', 'threadlist', $searchsubmit);
showformheader('recyclebin&operation=search&frame=no', 'target="rbframe"', 'rbform');
showtableheader(cplang('recyclebin_result') . ' ' . $threadcount . ' <a href="#" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';" class="act lightlink normal">' . cplang('research') . '</a>', 'fixpadding');
while ($thread = DB::fetch($query)) {
$posttable = $thread['posttableid'] ? "forum_post_{$thread['posttableid']}" : 'forum_post';
$post = DB::fetch_first("SELECT p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff FROM " . DB::table($posttable) . " p WHERE p.tid='{$thread['tid']}' AND p.first='1'");
$thread = array_merge($thread, $post);
$thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);
$thread['moddateline'] = dgmdate($thread['moddateline']);
$thread['dateline'] = dgmdate($thread['dateline']);
if ($thread['attachment']) {
require_once libfile('function/attachment');
$queryattach = DB::query("SELECT aid, filename, filesize, attachment, isimage, remote FROM " . DB::table(getattachtablebytid($thread['tid'])) . " WHERE tid='{$thread['tid']}'");
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']) . ")";
$thread['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
}
}
showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" /><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" /><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">{$thread['forumname']}</a> » {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>"));
showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $thread['message'] . '</div>');
showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"home.php?mod=space&uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> {$lang['recyclebin_delete_time']}: {$thread['moddateline']} {$lang['reason']}: {$thread['reason']}");
}
showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">' . cplang('recyclebin_all_delete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">' . cplang('recyclebin_all_undelete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">' . cplang('recyclebin_all_ignore') . '</a> ', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="rbframe" style="display:none"></iframe>';
showtagfooter('div');
示例2: _reportPostData
function _reportPostData($type, $tid, $pid, $threadUrl, $extra = null)
{
global $_G;
if (!$this->_secStatus) {
return false;
}
$startTime = microtime(true);
$tid = intval($tid);
$pid = intval($pid);
$thread = DB::fetch(DB::query("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid='{$tid}'"));
if (!is_array($thread)) {
return true;
}
$post = DB::fetch(DB::query("SELECT * FROM " . DB::table(getposttable($thread['posttableid'])) . " WHERE pid='{$pid}'"));
$member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid = '{$post['authorid']}'");
$memberField = DB::fetch_first("SELECT * FROM " . DB::table('common_member_field_forum') . " WHERE uid='{$post['authorid']}'");
$memberStatus = DB::fetch_first("SELECT * FROM " . DB::table('common_member_status') . " WHERE uid='{$post['authorid']}'");
$memberVerify = DB::fetch_first("SELECT * FROM " . DB::table('common_member_verify') . " WHERE uid = '{$post['authorid']}'");
if ($post['first'] == 1) {
$type = $type . 'Thread';
} else {
$type = $type . 'Post';
}
$query = DB::query('SELECT filename,filesize FROM ' . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}'");
while ($res = DB::fetch($query)) {
$postAttachs[] = array('filename' => $res['filename'], 'filesize' => $res['filesize']);
}
if (!$post['first']) {
$firstPost = DB::fetch(DB::query("SELECT * FROM " . DB::table(getposttable($thread['posttableid'])) . " WHERE tid='{$tid}' and first=1"));
$query = DB::query('SELECT filename,filesize FROM ' . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}'");
while ($res = DB::fetch($query)) {
$threadAttachs[] = array('filename' => $res['filename'], 'filesize' => $res['filesize']);
}
} else {
$firstPost = $post;
$firstPostAttachs = $postAttachs;
}
$views = intval($thread['views']);
$replies = intval($thread['replies']);
$favourites = intval($thread['favtimes']);
$supports = intval($thread['recommend_add']);
$opposes = intval($thread['recommend_sub']);
$shares = intval($thread['sharetimes']);
if ($member['conisbind']) {
$memberConnect = DB::fetch_first('SELECT * FROM ' . DB::table('common_member_connect') . ' WHERE uid=\'' . $_G['uid'] . '\'');
$openId = $memberConnect['conopenid'];
} else {
$openId = 0;
}
if (!$thread || !$post) {
return true;
}
$fid = $thread["fid"];
if ($post['first']) {
$threadShield = $post['status'] & 1 ? 1 : 2;
$threadWarning = $post['status'] & 2 ? 1 : 2;
} else {
$threadShield = $firstPost['status'] & 1 ? 1 : 2;
$threadWarning = $firstPost['status'] & 2 ? 1 : 2;
}
$threadSort = 2;
if ($thread['sortid']) {
$threadSort = 1;
if ($post['first']) {
$sortMessage = $this->convertSortInfo($thread['sortid'], $thread['tid']);
$post['message'] = $sortMessage . '<br/>' . $post['message'];
}
}
$contentBitMap = array('onTop' => $thread['displayorder'] ? 1 : 2, 'hide' => strpos($post['message'], '[hide') ? 1 : 2, 'digest' => $thread['digest'] ? 1 : 2, 'highLight' => $thread['highlight'] ? 1 : 2, 'special' => $thread['special'] ? 1 : 2, 'threadAttach' => 2, 'threadAttachFlash' => 2, 'threadAttachPic' => 2, 'threadAttachVideo' => 2, 'threadAttachAudio' => 2, 'threadShield' => $threadShield, 'threadWarning' => $threadWarning, 'postAttach' => 2, 'postAttachFlash' => 2, 'postAttachPic' => 2, 'postAttachVideo' => 2, 'postAttachAudio' => 2, 'postShield' => $post['status'] & 1 ? 1 : 2, 'postWarning' => $post['status'] & 2 ? 1 : 2, 'isAdmin' => $member['adminid'] ? 1 : 2, 'threadSort' => $threadSort, 'isRush' => getstatus($thread['status'], 3) ? 1 : 2, 'hasReadPerm' => $thread['readperm'] ? 1 : 2, 'hasStamp' => $thread['stamp'] >= 0 ? 1 : 2, 'hasIcon' => $thread['icon'] >= 0 ? 1 : 2, 'isPushed' => $thread['pushedaid'] ? 1 : 2, 'hasCover' => $thread['cover'] ? 1 : 2, 'hasReward' => $thread['replycredit'] ? 1 : 2, 'threadStatus' => $thread['status'], 'postStatus' => $post['status']);
if ($post['first']) {
$contentBitMap['isMobile'] = $this->isMobile($thread['status']) ? 1 : 2;
if ($contentBitMap['isMobile'] == 1) {
$contentBitMap['isMobileSound'] = $this->mobileHasSound($thread['status']) ? 1 : 2;
$contentBitMap['isMobilePhoto'] = $this->mobileHasPhoto($thread['status']) ? 1 : 2;
$contentBitMap['isMobileGPS'] = $this->mobileHasGPS($thread['status']) ? 1 : 2;
}
} else {
$contentBitMap['isMobile'] = getstatus($post['status'], 4) ? 1 : 2;
}
$userBitMap = array('isAdmin' => $member['adminid'] ? 1 : 2, 'hasMedal' => $memberField['medals'] ? 1 : 2, 'hasAvatar' => $member['avatarstatus'] ? 1 : 2, 'hasVerify' => is_array($memberVerify) ? 1 : 2);
$videoExt = array('.rm', '.flv', '.mkv', '.rmvb', '.avi', '.wmv', '.mp4', '.mpeg', '.mpg');
$audioExt = array('.wav', '.mid', '.mp3', '.m3u', '.wma', '.asf', '.asx');
if ($firstPostAttachs) {
foreach ($firstPostAttachs as $attach) {
$fileExt = substr($attach['filename'], strrpos($attach['filename'], '.'));
if ($fileExt == '.bmp' || $fileExt == '.jpg' || $fileExt == '.jpeg' || $fileExt == '.gif' || $fileExt == '.png') {
$contentBitMap['threadAttachPic'] = 1;
}
if ($fileExt == '.swf' || $fileExt == '.fla') {
$contentBitMap['threadAttachFlash'] = 1;
}
if (in_array($fileExt, $videoExt)) {
$contentBitMap['threadAttachVideo'] = 1;
}
if (in_array($fileExt, $audioExt)) {
$contentBitMap['threadAttachAudio'] = 1;
}
}
$contentBitMap['threadAttach'] = 1;
}
//.........这里部分代码省略.........
示例3: 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}");
}
示例4: while
}
$thread_attachment = $post_attachment = 0;
$query = DB::query("SELECT pid, attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}'");
while ($attach = DB::fetch($query)) {
if ($attach['pid'] == $pid) {
if ($thread['displayorder'] >= 0) {
$post_attachment++;
}
dunlink($attach);
} else {
$thread_attachment = 1;
}
}
if ($post_attachment) {
DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid='{$pid}'", 'UNBUFFEREED');
DB::query("DELETE FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE pid='{$pid}'", 'UNBUFFEREED');
updatecreditbyaction('postattach', $orig['authorid'], array(), '', -$post_attachment);
}
DB::query("DELETE FROM " . DB::table($posttable) . " WHERE pid='{$pid}'");
DB::delete('forum_postcomment', "rpid='{$pid}'");
if ($thread['special'] == 2) {
DB::query("DELETE FROM " . DB::table('forum_trade') . " WHERE pid='{$pid}'");
}
if ($isfirstpost) {
$forumadd = 'threads=threads-\'1\', posts=posts-\'1\'';
$tablearray = array('forum_threadmod', 'forum_relatedthread', 'forum_thread', 'forum_debate', 'forum_debatepost', 'forum_polloption', 'forum_poll', 'forum_typeoptionvar');
foreach ($tablearray as $table) {
DB::query("DELETE FROM " . DB::table($table) . " WHERE tid='{$_G['tid']}'", 'UNBUFFERED');
}
if ($_G['setting']['globalstick'] && in_array($thread['displayorder'], array(2, 3))) {
require_once libfile('function/cache');
示例5: sprintf
$stylestr = sprintf('%03b', $string[0]);
for ($i = 1; $i <= 3; $i++) {
$stylecheck[$i] = $stylestr[$i - 1] ? 1 : 0;
}
$colorcheck = $string[1];
$_G['forum']['modrecommend'] = is_array($_G['forum']['modrecommend']) ? $_G['forum']['modrecommend'] : array();
} elseif ($_G['gp_optgroup'] == 2 || $_G['gp_optgroup'] == 5) {
require_once libfile('function/forumlist');
$forumselect = forumselect(FALSE, 0, $threadlist[$_G['tid']]['fid']);
$typeselect = typeselect($single ? $threadlist[$_G['tid']]['typeid'] : 0);
} elseif ($_G['gp_optgroup'] == 4 && $single) {
empty($threadlist[$_G['tid']]['closed']) ? $closecheck[0] = 'checked="checked"' : ($closecheck[1] = 'checked="checked"');
}
$imgattach = array();
if (count($threadlist) == 1 && $operation == 'recommend') {
$query = DB::query("SELECT * FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}' AND isimage IN ('1', '-1')");
while ($row = DB::fetch($query)) {
$imgattach[] = $row;
}
$query = DB::query("SELECT * FROM " . DB::table('forum_forumrecommend') . " WHERE tid='{$_G['tid']}'");
if ($oldthread = DB::fetch($query)) {
$threadlist[$_G['tid']]['subject'] = $oldthread['subject'];
$selectposition[$oldthread['position']] = ' selected="selected"';
$selectattach = $oldthread['aid'];
} else {
$selectattach = $imgattach[0]['aid'];
$selectposition[0] = ' selected="selected"';
}
}
include template('forum/topicadmin');
} else {
示例6: 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> » <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">" . $threadlist[$post['tid']]['tsubject'] . "</a>" . ($post['subject'] ? ' » ' . $post['subject'] : '') . "</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} 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']) . " {$lang['ishtmlon']}: " . ($post['htmlon'] ? $lang['yes'] : $lang['no']));
}
return true;
}
示例7: before_deletepost
public function before_deletepost($parameters)
{
$thread_attachment = $post_attachment = 0;
foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $this->thread['tid'], 'tid', $this->thread['tid']) as $attach) {
if ($attach['pid'] == $this->post['pid']) {
if ($this->thread['displayorder'] >= 0) {
$post_attachment++;
}
dunlink($attach);
} else {
$thread_attachment = 1;
}
}
$this->param['updatefieldarr']['attachment'] = array($thread_attachment);
if ($post_attachment) {
C::t('forum_attachment')->delete_by_id('pid', $this->post['pid']);
DB::query("DELETE FROM " . DB::table(getattachtablebytid($this->thread['tid'])) . " WHERE pid='" . $this->post['pid'] . "'", 'UNBUFFEREED');
updatecreditbyaction('postattach', $this->post['authorid'], array(), '', -$post_attachment);
}
}
示例8: recommendupdate
function recommendupdate($fid, &$modrecommend, $force = '', $position = 0)
{
global $_G;
$recommendlist = $recommendimagelist = $modedtids = array();
$num = $modrecommend['num'] ? intval($modrecommend['num']) : 10;
$imagenum = $modrecommend['imagenum'] = $modrecommend['imagenum'] ? intval($modrecommend['imagenum']) : 0;
$imgw = $modrecommend['imagewidth'] = $modrecommend['imagewidth'] ? intval($modrecommend['imagewidth']) : 200;
$imgh = $modrecommend['imageheight'] = $modrecommend['imageheight'] ? intval($modrecommend['imageheight']) : 150;
if ($modrecommend['sort'] && (TIMESTAMP - $modrecommend['updatetime'] > $modrecommend['cachelife'] || $force)) {
foreach (C::t('forum_forumrecommend')->fetch_all_by_fid($fid) as $row) {
if ($modrecommend['sort'] == 2 && $row['moderatorid']) {
$modedtids[] = $row['tid'];
}
}
C::t('forum_forumrecommend')->delete_by_fid($fid, $modrecommend['sort'] == 2 ? 0 : false);
$orderby = 'dateline';
$dateline = $modrecommend['dateline'] ? TIMESTAMP - $modrecommend['dateline'] * 3600 : null;
$recommends = null;
switch ($modrecommend['orderby']) {
case '':
case '1':
$orderby = 'lastpost';
break;
case '2':
$orderby = 'views';
break;
case '3':
$orderby = 'replies';
break;
case '4':
$orderby = 'digest';
break;
case '5':
$orderby = 'recommends';
$recommends = 0;
break;
case '6':
$orderby = 'heats';
break;
}
$i = 0;
$addthread = $addimg = $recommendlist = $recommendimagelist = $tids = array();
foreach (C::t('forum_thread')->fetch_all_by_fid_displayorder($fid, 0, $dateline, $recommends, 0, $num, $orderby) as $thread) {
$recommendlist[$thread['tid']] = $thread;
$tids[] = $thread['tid'];
if (!$modedtids || !in_array($thread['tid'], $modedtids)) {
$addthread[$thread['tid']] = array('fid' => $thread['fid'], 'tid' => $thread['tid'], 'position' => 1, 'displayorder' => $i, 'subject' => $thread['subject'], 'author' => $thread['author'], 'authorid' => $thread['authorid'], 'moderatorid' => 0, 'expiration' => 0, 'highlight' => $thread['highlight']);
$i++;
}
}
if ($tids && $imagenum) {
$attachtables = array();
foreach ($tids as $tid) {
$attachtables[getattachtablebytid($tid)][] = $tid;
}
foreach ($attachtables as $attachtable => $tids) {
$attachmentpost = array();
$postlist = C::t('forum_post')->fetch_all_by_tid(0, $tids, false, '', 0, 0, 1);
if ($postlist) {
$pids = array();
foreach ($postlist as $post) {
$pids[] = $post['pid'];
}
$attachmentlist = C::t('forum_attachment_n')->fetch_all_by_pid_width('tid:' . $tids[0], $pids, $imgw);
if ($attachmentlist) {
foreach ($attachmentlist as $k => $attachment) {
$attachmentpost[$k]['fid'] = $postlist[$attachment['pid']]['fid'];
$attachmentpost[$k]['tid'] = $postlist[$attachment['pid']]['tid'];
$attachmentpost[$k]['aid'] = $attachment['aid'];
}
}
unset($postlist, $attachmentlist, $pids);
}
foreach ($attachmentpost as $attachment) {
if (isset($recommendimagelist[$attachment['tid']])) {
continue;
}
$key = md5($attachment['aid'] . '|' . $imgw . '|' . $imgh);
$recommendlist[$attachment['tid']]['filename'] = $attachment['aid'] . "\t" . $imgw . "\t" . $imgh . "\t" . $key;
$recommendimagelist[$attachment['tid']] = $recommendlist[$attachment['tid']];
$recommendimagelist[$attachment['tid']]['subject'] = addslashes($recommendimagelist[$attachment['tid']]['subject']);
$addthread[$attachment['tid']]['aid'] = '';
$addthread[$attachment['tid']]['filename'] = $recommendlist[$attachment['tid']]['filename'];
$addthread[$attachment['tid']]['typeid'] = 1;
if (count($recommendimagelist) == $imagenum) {
break;
}
}
}
}
unset($recommendimagelist);
if ($addthread) {
foreach ($addthread as $row) {
C::t('forum_forumrecommend')->insert($row, false, true);
}
$modrecommend['updatetime'] = TIMESTAMP;
$modrecommendnew = serialize($modrecommend);
C::t('forum_forumfield')->update($fid, array('modrecommend' => $modrecommendnew));
}
}
//.........这里部分代码省略.........
示例9: str_replace
if ($isgroup) {
DB::query("UPDATE " . DB::table('forum_groupuser') . " SET threads=threads+1, lastupdate='" . TIMESTAMP . "' WHERE uid='{$_G['uid']}' AND fid='{$_G['fid']}'");
}
$subject = str_replace("\t", ' ', $subject);
$lastpost = "{$tid}\t{$subject}\t{$_G['timestamp']}\t{$author}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$_G['fid']}'", 'UNBUFFERED');
if ($_G['forum']['type'] == 'sub') {
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='" . $_G['forum'][fup] . "'", 'UNBUFFERED');
}
}
if ($_G['forum']['status'] == 3) {
require_once libfile('function/group');
updateactivity($_G['fid'], 0);
require_once libfile('function/grouplog');
updategroupcreditlog($_G['fid'], $_G['uid']);
}
// д��¼����Ϣ by shawn
$table_att = DB::table(getattachtablebytid($tid));
$attache_s = DB::query("SELECT * FROM " . $table_att . " WHERE pid='" . $pid . "' AND dateline>0 ORDER BY dateline");
$str = "****";
$str .= "SELECT * FROM " . $table_att . " WHERE pid='{$pid}' AND dateline>'0' ORDER BY dateline";
$str .= "****";
file_put_contents('./log.txt', $str, FILE_APPEND);
@(include_once DISCUZ_ROOT . './source/class/class_replayparse.php');
while ($row = DB::fetch($attache_s)) {
//print_r($row);
writeReplayInfo($row['aid'], $table_att);
}
showmessage('post_newthread_succeed', "forum.php?mod=viewthread&tid={$tid}&extra={$extra}", $param);
}
}
示例10: getTopicThread
function getTopicThread()
{
global $_G;
$tid = intval($_G['gp_tid']);
if (empty($tid)) {
ajaxshowheader();
echo showTopicTemplate(0);
ajaxshowfooter();
return false;
}
require_once libfile('function/forum');
require_once libfile('function/discuzcode');
loadforum();
$posttable = $_G['thread']['posttable'];
if (empty($posttable)) {
ajaxshowheader();
echo showTopicTemplate(0);
ajaxshowfooter();
return false;
}
$imagePath = $imageUrl = '';
$subject = strip_tags($_G['thread']['subject']);
$post = DB::fetch_first('SELECT message, pid FROM ' . DB::table($posttable) . " WHERE tid='{$tid}' AND first='1'");
$pid = intval($post['pid']);
$message = cutstr(strip_tags(discuzcode($post['message'], 1, 0, 1)), 200);
$message = preg_replace('/\\[attach\\](\\d+)\\[\\/attach\\]/is', '', $message);
$imageDir = 'qqgroup';
$imageName = 'miniportal_tid_' . $tid . '.jpg';
$thumbTarget = $imageDir . '/' . $imageName;
if (file_exists($_G['setting']['attachdir'] . './' . $thumbTarget)) {
$imagePath = $thumbTarget;
$imageUrl = $_G['setting']['attachurl'] . $imagePath;
} else {
$attachment = DB::result_first("SELECT attachment FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND (isimage='1' OR isimage='-1') AND remote='0'");
if ($attachment) {
$imagePath = 'forum/' . $attachment;
$imageUrl = $_G['setting']['attachurl'] . $imagePath;
}
}
ajaxshowheader();
echo showTopicTemplate($tid, $subject, $message, $imagePath, $imageUrl);
ajaxshowfooter();
}
示例11: showmessage
$trade = DB::fetch_first("SELECT * FROM " . DB::table('forum_trade') . " WHERE tid='{$_G['tid']}' AND pid='{$pid}'");
if (empty($trade)) {
showmessage('trade_not_found');
}
$fromcode = false;
if ($trade['closed']) {
showmessage('trade_closed', 'forum.php?mod=viewthread&tid=' . $_G['tid'] . '&page=' . $page);
}
if ($trade['price'] <= 0 && $trade['credit'] <= 0) {
showmessage('trade_invalid', 'forum.php?mod=viewthread&tid=' . $_G['tid'] . '&page=' . $page);
}
if ($trade['credit'] > 0 && $_G['setting']['creditstransextra'][5] == -1) {
showmessage('trade_credit_invalid', 'forum.php?mod=viewthread&tid=' . $_G['tid'] . '&page=' . $page);
}
$limit = 6;
$query = DB::query("SELECT t.tid, t.pid, t.aid, t.subject, t.price, t.credit, t.displayorder FROM " . DB::table('forum_trade') . " t\r\n\t\tLEFT JOIN " . DB::table(getattachtablebytid($_G['tid'])) . " a ON t.aid=a.aid\r\n\t\tWHERE t.sellerid='{$trade['sellerid']}' ORDER BY t.displayorder DESC LIMIT {$limit}");
$usertrades = array();
$usertradecount = 0;
while ($usertrade = DB::fetch($query)) {
$usertradecount++;
$usertrades[] = $usertrade;
}
if ($_G['gp_action'] != 'trade' && !submitcheck('tradesubmit')) {
$lastbuyerinfo = dhtmlspecialchars(DB::fetch_first("SELECT buyername,buyercontact,buyerzip,buyerphone,buyermobile FROM " . DB::table('forum_tradelog') . " WHERE buyerid='{$_G['uid']}' AND status!=0 AND buyername!='' ORDER BY lastupdate DESC LIMIT 1"));
$extra = rawurlencode($extra);
include template('forum/trade');
} else {
if ($trade['sellerid'] == $_G['uid']) {
showmessage('trade_by_myself');
} elseif ($_G['gp_number'] <= 0) {
showmessage('trade_input_no');
示例12: exit
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: topicadmin_repair.php 20522 2011-02-25 04:03:05Z monkey $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['group']['allowrepairthread']) {
showmessage('no_privilege_repairthread');
}
$posttable = getposttablebytid($_G['tid']);
$replies = DB::result_first("SELECT COUNT(*) FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND invisible='0'") - 1;
$attachcount = DB::result_first("SELECT count(*) FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}'");
$attachment = $attachcount ? DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}' AND isimage != 0") ? 2 : 1 : 0;
$firstpost = DB::fetch_first("SELECT pid, subject, rate FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND invisible='0' ORDER BY dateline LIMIT 1");
$firstpost['subject'] = addslashes(cutstr($firstpost['subject'], 79));
@($firstpost['rate'] = $firstpost['rate'] / abs($firstpost['rate']));
$lastpost = DB::fetch_first("SELECT author, dateline FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND invisible='0' ORDER BY dateline DESC LIMIT 1");
DB::query("UPDATE " . DB::table('forum_thread') . " SET subject='{$firstpost['subject']}', replies='{$replies}', lastpost='{$lastpost['dateline']}', lastposter='" . addslashes($lastpost['author']) . "', rate='{$firstpost['rate']}', attachment='{$attachment}' WHERE tid='{$_G['tid']}'", 'UNBUFFERED');
DB::query("UPDATE " . DB::table($posttable) . " SET first='1', subject='{$firstpost['subject']}' WHERE pid='{$firstpost['pid']}'", 'UNBUFFERED');
DB::query("UPDATE " . DB::table($posttable) . " SET first='0' WHERE tid='{$_G['tid']}' AND pid<>'{$firstpost['pid']}'", 'UNBUFFERED');
showmessage('admin_repair_succeed', '', array(), array('alert' => 'right'));
示例13: implode
if (empty($ufielddata['userfield'])) {
$query = DB::query("SELECT " . implode(',', $activity['ufield']['userfield']) . " FROM " . DB::table('common_member_profile') . " WHERE uid='{$_G['uid']}'");
$ufielddata['userfield'] = DB::fetch($query);
}
$html = profile_setting($fieldid, $ufielddata['userfield'], false, true);
if ($html) {
$settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
$htmls[$fieldid] = $html;
}
}
}
} else {
$activity['ufield'] = '';
}
if ($activity['aid']) {
$attach = DB::fetch_first("SELECT * FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE aid='{$activity['aid']}'");
if ($attach['isimage']) {
$activity['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
$activity['thumb'] = $attach['thumb'] ? getimgthumbname($activity['attachurl']) : $activity['attachurl'];
$activity['width'] = $attach['thumb'] && $_G['setting']['thumbwidth'] < $attach['width'] ? $_G['setting']['thumbwidth'] : $attach['width'];
}
$skipaids[] = $activity['aid'];
}
$applylistverified = array();
$noverifiednum = 0;
$query = DB::query("SELECT aa.username, aa.uid, aa.verified, aa.dateline, aa.message, aa.payment, aa.ufielddata, m.groupid FROM " . DB::table('forum_activityapply') . " aa\r\n\tLEFT JOIN " . DB::table('common_member') . " m USING(uid)\r\n\tLEFT JOIN " . DB::table('common_member_field_forum') . " mf USING(uid)\r\n\tWHERE aa.tid='{$_G['tid']}' ORDER BY aa.dateline DESC");
while ($activityapplies = DB::fetch($query)) {
$activityapplies['dateline'] = dgmdate($activityapplies['dateline'], 'u');
if ($activityapplies['verified'] == 1) {
$activityapplies['ufielddata'] = unserialize($activityapplies['ufielddata']);
if (count($applylist) < $_G['setting']['activitypp']) {
示例14: dgmdate
} else {
$thread['author'] = 'guest';
}
$thread['dateline'] = dgmdate($thread['dateline']);
$posttable = $thread['posttableid'] ? "forum_post_{$thread['posttableid']}" : 'forum_post';
$posttablearr[$posttable][$thread['tid']] = $thread['tid'];
$postlist[$thread['tid']] = $thread;
}
$attachtablearr = array();
foreach ($posttablearr as $posttable => $tids) {
$query = DB::query('SELECT pid, tid, message, useip, attachment FROM ' . DB::table($posttable) . " WHERE tid IN(" . dimplode($tids) . ") AND first='1'");
while ($post = DB::fetch($query)) {
$thread = array_merge($postlist[$post['tid']], $post);
$thread['message'] = nl2br(dhtmlspecialchars($thread['message']));
if ($thread['attachment']) {
$attachtable = getattachtablebytid($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;
}
示例15: array
if ($_G['gp_item_price'] > 0) {
if ($_G['setting']['creditstransextra'][5] != -1 && $_G['gp_item_credit']) {
$feed['body_template'] = 'feed_thread_goods_message_1';
} else {
$feed['body_template'] = 'feed_thread_goods_message_2';
}
} else {
$feed['body_template'] = 'feed_thread_goods_message_3';
}
$feed['body_data'] = array('itemname' => "<a href=\"forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}\">{$_G['gp_item_name']}</a>", 'itemprice' => $_G['gp_item_price'], 'itemcredit' => $_G['gp_item_credit'], 'creditunit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title']);
if ($_G['gp_tradeaid']) {
$feed['images'] = array(getforumimg($_G['gp_tradeaid']));
$feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}");
}
if ($_G['gp_tradeaid']) {
$attachment = DB::fetch_first("SELECT * FROM " . DB::table(getattachtablebytid($tid)) . " WHERE aid='{$_G['gp_tradeaid']}'");
if (in_array($attachment['filetype'], array('image/gif', 'image/jpeg', 'image/png'))) {
$imgurl = $_G['setting']['attachurl'] . 'forum/' . ($attachment['thumb'] && $attachment['filetype'] != 'image/gif' ? getimgthumbname($attachment['attachment']) : $attachment['attachment']);
$feed['images'][] = $attachment['attachment'] ? $imgurl : '';
$feed['image_links'][] = $attachment['attachment'] ? "forum.php?mod=viewthread&tid={$tid}" : '';
}
}
$feed['title_data']['hash_data'] = "tid{$tid}";
$feed['id'] = $tid;
$feed['idtype'] = 'tid';
postfeed($feed);
}
if ($displayorder != -4) {
if ($digest) {
updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']);
}