本文整理汇总了PHP中getposttable函数的典型用法代码示例。如果您正苦于以下问题:PHP getposttable函数的具体用法?PHP getposttable怎么用?PHP getposttable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getposttable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apiGetNewPost
function apiGetNewPost($uid, $limit = 10)
{
$FTParams = array('numid_id' => $uid, 'num_limit' => $limit);
if ($this->_FTHelper($FTParams)) {
$Query = "SELECT `pid`,`fid`,`tid`,`author`,`authorid`,`subject`,`message` FROM " . DB::table(getposttable('p')) . " WHERE `authorid`='" . $uid . "' AND `first`=1 ORDER BY `pid` DESC LIMIT " . $limit;
$RS = $this->_DBHelper($Query, 3);
if ($RS) {
//去除同步提示信息
foreach ($RS as $key => $row) {
$RS[$key]['message'] = preg_replace("|(\n\n)?\\[size=2\\]\\[color=gray\\] \\[img\\](.*?)\\[/url\\]\\[/color\\]\\[/size\\]\$|", '', $row['message']);
}
$this->rst = $RS;
}
}
$this->_LogHelper($this->apiRoute . '/apiGetNewPost');
return array('rst' => $this->rst, 'errno' => $this->errno, 'err' => $this->err);
}
示例2: csc
function csc($task = array())
{
global $_G;
$taskvars = array('num' => 0);
$query = DB::query("SELECT variable, value FROM " . DB::table('common_taskvar') . " WHERE taskid='{$task['taskid']}'");
while ($taskvar = DB::fetch($query)) {
if ($taskvar['value']) {
$taskvars[$taskvar['variable']] = $taskvar['value'];
}
}
$taskvars['num'] = $taskvars['num'] ? $taskvars['num'] : 1;
$tbladd = $sqladd = '';
if ($taskvars['act'] == 'newreply' && $taskvars['threadid']) {
$sqladd .= " AND p.tid='{$taskvars['threadid']}'";
} else {
if ($taskvars['forumid']) {
$sqladd .= " AND p.fid='{$taskvars['forumid']}'";
}
if ($taskvars['author']) {
$taskvars['authorid'] = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='" . addslashes($taskvars['author']) . "'");
$tbladd .= ", " . DB::table('forum_thread') . " t";
$sqladd .= " AND p.tid=t.tid AND t.authorid='{$taskvars['authorid']}'";
}
}
if ($taskvars['act']) {
if ($taskvars['act'] == 'newthread') {
$sqladd .= " AND p.first='1'";
} elseif ($taskvars['act'] == 'newreply') {
$sqladd .= " AND p.first='0'";
}
}
$sqladd .= ($taskvars['time'] = floatval($taskvars['time'])) ? " AND p.dateline BETWEEN {$task['applytime']} AND {$task['applytime']}+3600*{$taskvars['time']}" : " AND p.dateline>{$task['applytime']}";
$num = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getposttable()) . " p {$tbladd} WHERE p.authorid='{$_G['uid']}' {$sqladd}");
if ($num && $num >= $taskvars['num']) {
return TRUE;
} elseif ($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
return FALSE;
} else {
return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
}
}
示例3: loadcache
$allposttalbe[] = 'forum_post_' . $i;
$i++;
}
loadcache('threadtableids');
foreach ($_G['cache']['threadtableids'] as $value) {
$allthreadtalbe[] = 'forum_thread_' . $value;
}
showtipss($toolslang['cleardbtips']);
if (submitcheck('clearpostsubmit', 1)) {
$id = getmaxmin(getposttable('primary'), 'pid');
if ($_G['gp_start'] == 0) {
$_G['gp_start'] = $id['min'];
}
$start = $_G['gp_start'];
$end = $_G['gp_start'] + $rpp;
$posttable = getposttable('primary');
$query = DB::query("SELECT pid,tid FROM " . DB::table($posttable) . " WHERE pid >= {$start} AND pid < {$end}");
//note
while ($post = DB::fetch($query)) {
$tid = DB::result_first("SELECT tid FROM " . DB::table('forum_thread') . " WHERE tid='" . $post['tid'] . "'");
foreach ($allthreadtalbe as $value) {
$tid = $tid || DB::result_first("SELECT tid FROM " . DB::table($value) . " WHERE tid='" . $post['tid'] . "'");
}
if (!$tid) {
$rows++;
DB::delete($posttable, "pid = {$post['pid']}");
}
}
$nextlink = "action=plugins&cp=aboutdb&pmod=maintain&identifier=tools&operation={$operation}&do={$do}&start={$end}&rows={$rows}&clearpostsubmit=yes&rpp={$rpp}";
if ($end <= $id['max'] + 1) {
cpmsg("{$lang['counter_forum']}: " . cplang('counter_processing', array('current' => $start, 'next' => $end)), $nextlink, 'loading');
示例4: make_special_condition
private function make_special_condition($special, $authorid = 0, $replies = 0, $displayorder = null, $subject = '', $join = 0, $tableid = 0)
{
$wherearr = $condition = array();
$parameter = array($this->get_table_name($tableid));
if ($authorid && !$join) {
$authorid = dintval($authorid, true);
$parameter[] = $authorid;
$wherearr[] = is_array($authorid) && $authorid ? 't.authorid IN(%n)' : 't.authorid=%d';
}
$parameter[] = $special;
$wherearr[] = 't.special=%d';
if ($replies) {
$parameter[] = $replies;
$wherearr[] = 't.replies>=%d';
}
if ($displayorder !== null) {
$parameter[] = $displayorder;
$wherearr[] = 't.displayorder>=%d';
}
if (!empty($subject)) {
$parameter[] = '%' . $subject . '%';
$wherearr[] = "subject LIKE %s";
}
if ($join) {
if ($special == 1) {
$parameter[] = $authorid;
$wherearr[] = 'p.uid=%d';
$wherearr[] = 'p.tid = t.tid';
$condition['jointable'] = ', ' . DB::table('forum_pollvoter') . ' p ';
} elseif ($special == 5) {
$parameter[] = $authorid;
$wherearr[] = 'p.authorid=%d';
$wherearr[] = 'p.first=0';
$wherearr[] = 'p.tid = t.tid';
$posttable = getposttable();
$condition['jointable'] = ', ' . DB::table($posttable) . ' p ';
}
}
$condition['parameter'] = $parameter;
$condition['where'] = ' WHERE ' . implode(' AND ', $wherearr);
return $condition;
}
示例5: getranklist_member_post
function getranklist_member_post($num, $orderby)
{
global $_G;
$timestamp = TIMESTAMP;
$posts = array();
$timelimit = 0;
if ($orderby == 'digestposts') {
$sql = "SELECT m.username, m.uid, mc.digestposts AS posts\n\t\tFROM " . DB::table('common_member') . " m\n\t\tLEFT JOIN " . DB::table('common_member_count') . " mc ON mc.uid=m.uid WHERE mc.digestposts>0\n\t\tORDER BY mc.digestposts DESC LIMIT 0, {$num}";
} elseif ($orderby == 'thismonth') {
$timelimit = $timestamp - 86400 * 30;
} elseif ($orderby == 'today') {
$timelimit = $timestamp - 86400;
} else {
$sql = "SELECT m.username, m.uid, mc.posts\n\t\tFROM " . DB::table('common_member') . " m\n\t\tLEFT JOIN " . DB::table('common_member_count') . " mc ON mc.uid=m.uid WHERE\tmc.posts>0\n\t\tORDER BY mc.posts DESC LIMIT 0, {$num}";
}
if ($timelimit) {
$sql = "SELECT DISTINCT(author) AS username, authorid AS uid, COUNT(pid) AS posts\n\t\tFROM " . DB::table(getposttable()) . " WHERE dateline>='{$timelimit}' AND invisible='0' AND authorid>'0'\n\t\tGROUP BY author\n\t\tORDER BY posts DESC LIMIT 0, {$num}";
}
$query = DB::query($sql);
while ($result = DB::fetch($query)) {
$posts[] = $result;
}
return $posts;
}
示例6: IN
}
if ($threadimageaid) {
if (!$threadimage) {
$threadimage = DB::fetch_first("SELECT attachment, remote FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1");
}
DB::delete('forum_threadimage', "tid='{$_G['tid']}'");
$threadimage = daddslashes($threadimage);
DB::insert('forum_threadimage', array('tid' => $_G['tid'], 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
}
}
$feed = array();
if ($special == 127) {
$message .= chr(0) . chr(0) . chr(0) . $specialextra;
}
if ($_G['forum_auditstatuson'] && $audit == 1) {
DB::query("UPDATE " . DB::table(getposttable($thread['posttableid'])) . " SET status='4' WHERE pid='{$pid}' AND status='0' AND invisible='-2'");
updatepostcredits('+', $orig['authorid'], $isfirstpost ? 'post' : 'reply', $_G['fid']);
updatemodworks('MOD', 1);
updatemodlog($_G['tid'], 'MOD');
}
$displayorder = $pinvisible = 0;
if ($isfirstpost) {
$displayorder = $modnewthreads ? -2 : $thread['displayorder'];
$pinvisible = $modnewthreads ? -2 : (empty($_G['gp_save']) ? 0 : -3);
if ($thread['displayorder'] == -4 && empty($_G['gp_save'])) {
DB::query("UPDATE " . DB::table($posttable) . " SET dateline='{$_G['timestamp']}', invisible='0' WHERE tid='{$thread['tid']}'");
DB::query("UPDATE " . DB::table('forum_thread') . " SET dateline='{$_G['timestamp']}', lastpost='{$_G['timestamp']}' WHERE tid='{$thread['tid']}'");
$posts = $thread['replies'] + 1;
if ($thread['replies']) {
$dateline = $_G['timestamp'];
$query = DB::query("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='0'");
示例7: my_thread_log
my_thread_log('validate', array('tid' => $thread['tid']));
if (getstatus($poststatus, 3) == 0) {
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$attachcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($thread['tid'])) . " WHERE tid='{$thread['tid']}'");
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
}
$forums[] = $thread['fid'];
$validatedthreads[] = $thread;
$pm = 'pm_' . $thread['tid'];
if (isset($_G['gp_' . $pm]) && $_G['gp_' . $pm] != '' && $thread['authorid']) {
$pmlist[] = array('action' => 'modthreads_validate', 'notevar' => array('tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'reason' => dhtmlspecialchars($_G['gp_' . $pm])), 'authorid' => $thread['authorid']);
}
}
if ($tids) {
$tidstr = dimplode($tids);
$validates = DB::query("UPDATE " . DB::table(getposttable()) . " SET status='4' WHERE tid IN ({$tidstr}) AND status='0' AND invisible='-2'");
updatepost(array('invisible' => '0'), "tid IN ({$tidstr}) AND first='1'");
DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tidstr})");
$validates = DB::affected_rows();
foreach (array_unique($forums) as $fid) {
updateforumcount($fid);
}
updatemodworks('MOD', $validates);
updatemodlog($tidstr, 'MOD');
updatemoderate('tid', $tids, 2);
}
}
if ($pmlist) {
foreach ($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
示例8: on_gts
function on_gts() {
$xmlcontent = '';
$threads = C::t('forum_thread')->count();
$posts = 0;
loadcache('posttableids');
if($_G['cache']['posttableids']) {
foreach($_G['cache']['posttableids'] AS $tableid) {
$posts += DB::result_first("SELECT COUNT(*) FROM ".DB::table(getposttable($tableid))." LIMIT 1");
}
}
$members = C::t('common_member')->count();
$settings = C::t('common_setting')->fetch_all(array('bbname', 'historyposts'));
$bbname = $settings['bbname'];
$yesterdayposts = $settings['historyposts'];
if(!empty($yesterdayposts)) {
$yesterdayposts = explode("\t", $yesterdayposts);
$yestoday = intval($yesterdayposts[0]);
$mostpost = intval($yesterdayposts[1]);
} else {
$yestoday = $mostpost = 0;
}
$xmlcontent .= "<sitedata>\n".
" <bbname>".dhtmlspecialchars($bbname)."</bbname>\n".
" <threads>$threads</threads>\n".
" <posts>$posts</posts>\n".
" <members>$members</members>\n".
" <yesterdayposts>$yestoday</yesterdayposts>\n".
" <mostposts>$mostpost</mostposts>\n".
"</sitedata>\n";
echo $xmlcontent;
echo "<forumdata>\n";
$query = C::t('forum_forum')->fetch_all_forum_ignore_access();
foreach($query as $forum) {
echo " <$forum[type]>\n".
" <fid>$forum[fid]</fid>\n".
" <fup>$forum[fup]</fup>\n".
" <name>".dhtmlspecialchars($forum['name'])."</name>\n".
" <description>".dhtmlspecialchars($forum['description'])."</description>\n".
" <threads>$forum[threads]</threads>\n".
" <posts>$forum[posts]</posts>\n".
" <todayposts>$forum[todayposts]</todayposts>\n".
" </$forum[type]>\n";
}
echo "</forumdata>";
}
示例9: max
}
$page = max(1, intval($_G['page']));
$total = 0;
$query = $multipage = '';
if ($do == 'list') {
$postarray = array();
$result = $modsession->get($cachekey);
$threadoptionselect[$result['threadoption']] = 'selected';
if ($result['fid'] == $_G['fid']) {
$total = $result['count'];
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "{$cpscript}?mod=modcp&action={$_G['gp_action']}&op={$op}&fid={$_G['fid']}&do={$do}");
if ($total && $result['pids']) {
$start = ($page - 1) * $_G['tpp'];
$query = DB::query('SELECT p.*, t.subject as tsubject ' . 'FROM ' . DB::table(getposttable($result['posttableid'])) . " p LEFT JOIN " . DB::table('forum_thread') . " t USING(tid) " . "WHERE pid IN ({$result['pids']}) " . 'ORDER BY dateline DESC ' . "LIMIT {$start}, {$_G['tpp']}");
while ($value = DB::fetch($query)) {
$postarray[] = $value;
}
}
}
}
$postlist = array();
if ($postarray) {
require_once libfile('function/post');
foreach ($postarray as $post) {
$post['dateline'] = dgmdate($post['dateline']);
$post['message'] = messagecutstr($post['message'], 200);
$post['forum'] = $modforums['list'][$post['fid']];
$post['modthreadkey'] = modauthkey($post['tid']);
$postlist[] = $post;
示例10: deletethread
function deletethread($tids, $membercount = false, $credit = false, $ponly = false)
{
global $_G;
if ($_G['setting']['plugins'][HOOKTYPE . '_deletethread']) {
$_G['deletethreadtids'] =& $tids;
$hookparam = func_get_args();
hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'deletethread');
}
if (!$tids) {
return 0;
}
require_once libfile('function/forum');
foreach ($tids as $tid) {
my_post_log('delete', array('tid' => $tid));
}
$count = count($tids);
$tids = dimplode($tids);
loadcache(array('threadtableids', 'posttableids'));
$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
$posttableids = !empty($_G['cache']['posttableids']) ? $_G['cache']['posttableids'] : array('0');
if (!in_array(0, $threadtableids)) {
$threadtableids = array_merge(array(0), $threadtableids);
}
DB::delete('common_moderate', "id IN ({$tids}) AND idtype='tid'");
$atids = $fids = $postids = $threadtables = array();
foreach ($threadtableids as $tableid) {
$threadtable = !$tableid ? "forum_thread" : "forum_thread_{$tableid}";
$query = DB::query("SELECT cover, tid, fid, posttableid FROM " . DB::table($threadtable) . " WHERE tid IN ({$tids})");
while ($row = DB::fetch($query)) {
$atids[] = $row['tid'];
$row['posttableid'] = !empty($row['posttableid']) && in_array($row['posttableid'], $posttableids) ? $row['posttableid'] : '0';
$postids[$row['posttableid']][$row['tid']] = $row['tid'];
if ($tableid) {
$fids[$row['fid']][] = $tableid;
}
}
if (!$tableid && !$ponly) {
$threadtables[] = $threadtable;
}
}
if ($credit || $membercount) {
$losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0;
$postlist = $uidarray = $tuidarray = $ruidarray = array();
foreach ($postids as $posttableid => $posttabletids) {
$query = DB::query('SELECT tid, first, authorid, dateline, replycredit, invisible FROM ' . DB::table(getposttable($posttableid)) . ' WHERE tid IN (' . dimplode($posttabletids) . ')');
while ($post = DB::fetch($query)) {
if ($post['invisible'] != -1 && $post['invisible'] != -5) {
$postlist[] = $post;
}
}
}
$query = DB::query("SELECT tid, extcreditstype FROM " . DB::table('forum_replycredit') . " WHERE tid IN ({$tids})");
while ($rule = DB::fetch($query)) {
$rule['extcreditstype'] = $rule['extcreditstype'] ? $rule['extcreditstype'] : $_G['setting']['creditstransextra'][10];
$replycredit_rule[$rule['tid']] = $rule;
}
foreach ($postlist as $post) {
if ($post['dateline'] < $losslessdel) {
if ($membercount) {
if ($post['first']) {
updatemembercount($post['authorid'], array('threads' => -1, 'post' => -1), false);
} else {
updatemembercount($post['authorid'], array('posts' => -1), false);
}
}
} else {
if ($credit) {
if ($post['first']) {
$tuidarray[] = $post['authorid'];
} else {
$ruidarray[] = $post['authorid'];
}
}
}
if ($credit || $membercount) {
if ($post['authorid'] > 0 && $post['replycredit'] > 0) {
if ($replycredit_rule[$post['tid']]['extcreditstype']) {
updatemembercount($post['authorid'], array($replycredit_rule[$post['tid']]['extcreditstype'] => (int) ('-' . $post['replycredit'])));
}
}
}
}
if ($credit) {
if ($tuidarray || $ruidarray) {
require_once libfile('function/post');
}
if ($tuidarray) {
updatepostcredits('-', $tuidarray, 'post', $_G['forum']['fid']);
}
if ($ruidarray) {
updatepostcredits('-', $ruidarray, 'reply', $_G['forum']['fid']);
}
$auidarray = $attachtables = array();
foreach ($atids as $tid) {
$attachtables[getattachtablebytid($tid)][] = $tid;
}
foreach ($attachtables as $attachtable => $attachtids) {
$query = DB::query("SELECT uid, dateline FROM " . DB::table($attachtable) . " WHERE tid IN (" . dimplode($attachtids) . ")");
while ($attach = DB::fetch($query)) {
if ($attach['dateline'] > $losslessdel) {
//.........这里部分代码省略.........
示例11: addslashes
$threads[$post['tid']]['lastpostadd'] = $post['dateline'] > $post['lastpost'] && $post['dateline'] > $lastpost[$post['tid']] ? ", lastpost='{$post['dateline']}', lastposter='" . ($post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : addslashes($post[author])) . "'" : '';
$threads[$post['tid']]['attachadd'] = $threads[$post['tid']]['attachadd'] || $post['attachment'] ? ', attachment=\'1\'' : '';
$pm = 'pm_' . $post['pid'];
if (isset($_G['gp_' . $pm]) && $_G['gp_' . $pm] != '' && $post['authorid']) {
$pmlist[] = array('action' => 'modreplies_validate', 'notevar' => array('pid' => $post['pid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(cutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_G['gp_' . $pm])), 'authorid' => $post['authorid']);
}
}
foreach ($threads as $tid => $thread) {
DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+{$thread['posts']} {$thread['lastpostadd']} {$thread['attachadd']} WHERE tid='{$tid}'", 'UNBUFFERED');
}
foreach (array_unique($forums) as $fid) {
updateforumcount($fid);
}
if (!empty($pidarray)) {
DB::query("UPDATE " . DB::table(getposttable($posttable)) . " SET status='4' WHERE pid IN (0," . implode(',', $pidarray) . ") AND status='0' AND invisible='-2'");
DB::query("UPDATE " . DB::table(getposttable($posttable)) . " SET invisible='0' WHERE pid IN (0," . implode(',', $pidarray) . ")");
$validates = DB::affected_rows();
updatemodworks('MOD', $validates);
updatemoderate('pid', $pidarray, 2);
} else {
updatemodworks('MOD', 1);
}
}
if ($pmlist) {
foreach ($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
}
if ($_G['gp_fast']) {
echo callback_js($_G['gp_pid']);
exit;
示例12: 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)) {
$query = DB::query("SELECT tid, moderatorid, aid FROM " . DB::table('forum_forumrecommend') . " WHERE fid='{$fid}'");
while ($row = DB::fetch($query)) {
if ($modrecommend['sort'] == 2 && $row['moderatorid']) {
$modedtids[] = $row['tid'];
}
}
DB::query("DELETE FROM " . DB::table('forum_forumrecommend') . " WHERE fid='{$fid}'" . ($modrecommend['sort'] == 2 ? " AND moderatorid='0'" : ''));
$orderby = 'dateline';
$conditions = $modrecommend['dateline'] ? 'AND dateline>' . (TIMESTAMP - $modrecommend['dateline'] * 3600) : '';
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';
$conditions .= " AND recommends>'0'";
break;
case '6':
$orderby = 'heats';
break;
}
$add = $comma = $i = '';
$addthread = $addimg = $recommendlist = $recommendimagelist = $tids = array();
$query = DB::query("SELECT fid, tid, author, authorid, subject, highlight FROM " . DB::table('forum_thread') . " WHERE fid='{$fid}' AND displayorder>='0' {$conditions} ORDER BY {$orderby} DESC LIMIT 0, {$num}");
while ($thread = DB::fetch($query)) {
$recommendlist[$thread['tid']] = $thread;
$tids[] = $thread['tid'];
if (!$modedtids || !in_array($thread['tid'], $modedtids)) {
$addthread[$thread['tid']] = "'{$thread['fid']}', '{$thread['tid']}', '1', '{$i}', '" . addslashes($thread['subject']) . "', '" . addslashes($thread['author']) . "', '{$thread['authorid']}', '0', '0', '{$thread['highlight']}'";
$i++;
}
}
if ($tids && $imagenum) {
$attachtables = array();
foreach ($tids as $tid) {
$attachtables[getattachtablebytid($tid)][] = $tid;
}
foreach ($attachtables as $attachtable => $tids) {
$query = DB::query('SELECT p.fid, p.tid, a.aid
FROM ' . DB::table(getposttable()) . " p\n\t\t\t\t\t\t\tINNER JOIN " . DB::table($attachtable) . " a\n\t\t\t\t\t\t\tON a.pid=p.pid AND a.isimage IN ('1', '-1') AND a.width>='{$imgw}'" . "\n\t\t\t\t\t\t\tWHERE p.tid IN (" . dimplode($tids) . ") AND p.first='1'");
while ($attachment = DB::fetch($query)) {
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']];
$addimg[$attachment['tid']] = ",'', '" . addslashes($recommendlist[$attachment['tid']]['filename']) . "', '1'";
if (count($recommendimagelist) == $imagenum) {
break;
}
}
}
}
foreach ($addthread as $tid => $row) {
$add .= $comma . '(' . $row . (!isset($addimg[$tid]) ? ",'0','','0'" : $addimg[$tid]) . ')';
$comma = ', ';
}
unset($recommendimagelist);
if ($add) {
DB::query("REPLACE INTO " . DB::table('forum_forumrecommend') . " (fid, tid, position, displayorder, subject, author, authorid, moderatorid, expiration, highlight, aid, filename, typeid) VALUES {$add}");
$modrecommend['updatetime'] = TIMESTAMP;
$modrecommendnew = addslashes(serialize($modrecommend));
DB::query("UPDATE " . DB::table('forum_forumfield') . " SET modrecommend='{$modrecommendnew}' WHERE fid='{$fid}'");
}
}
$recommendlists = $recommendlist = array();
$position = $position ? "AND position IN ('0','{$position}')" : '';
$query = DB::query("SELECT * FROM " . DB::table('forum_forumrecommend') . " WHERE fid='{$fid}' {$position} ORDER BY displayorder");
while ($recommend = DB::fetch($query)) {
if ($recommend['expiration'] && $recommend['expiration'] > TIMESTAMP || !$recommend['expiration']) {
if ($recommend['filename'] && strexists($recommend['filename'], "\t")) {
$imgd = explode("\t", $recommend['filename']);
if ($imgd[0] && $imgd[3]) {
$recommend['filename'] = 'forum.php?mod=image&aid=' . $imgd[0] . '&size=' . $imgd[1] . 'x' . $imgd[2] . '&key=' . rawurlencode($imgd[3]);
}
}
$recommendlist[] = $recommend;
if ($recommend['typeid'] && count($recommendimagelist) < $imagenum) {
$recommendimagelist[] = $recommend;
}
//.........这里部分代码省略.........
示例13: IN
DB::query("UPDATE " . DB::table('forum_forumfield') . " SET groupnum = groupnum+'-{$num}' WHERE fid='{$fup}'");
}
$query = DB::query("SELECT tid FROM " . DB::table('forum_thread') . " WHERE fid IN(" . dimplode($fidarray) . ") ORDER BY tid LIMIT {$start}, {$pp}");
while ($thread = DB::fetch($query)) {
$tids[] = $thread['tid'];
}
require_once libfile('function/delete');
if ($tids) {
deletepost($tids, 'tid');
deletethread($tids);
cpmsg('group_thread_removing', 'action=group&operation=managetype&optype=delete&submit=yes&confirmed=yes&fidarray=' . $_G['gp_fidarray'] . '&start=' . ($start + $pp));
}
loadcache('posttable_info');
if (!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
foreach ($_G['cache']['posttable_info'] as $key => $value) {
DB::query("DELETE FROM " . DB::table(getposttable($key)) . " WHERE fid IN(" . dimplode($fidarray) . ")", 'UNBUFFERED');
}
}
loadcache('threadtableids');
$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array('0');
foreach ($threadtableids as $tableid) {
if (!$tableid) {
$threadtable = "forum_thread";
} else {
$threadtable = "forum_thread_{$tableid}";
}
DB::query("DELETE FROM " . DB::table($threadtable) . " WHERE fid IN(" . dimplode($fidarray) . ")", 'UNBUFFERED');
}
DB::query("DELETE FROM " . DB::table('forum_forumrecommend') . " WHERE fid IN(" . dimplode($fidarray) . ")", 'UNBUFFERED');
DB::query("DELETE FROM " . DB::table('forum_forum') . " WHERE fid IN(" . dimplode($fidarray) . ")");
DB::query("DELETE FROM " . DB::table('forum_forumfield') . " WHERE fid IN(" . dimplode($fidarray) . ")");
示例14: array
if(!$modcount) {
$query = DB::query("SELECT tid FROM ".DB::table('forum_thread')." WHERE displayorder='-2'");
while($row = DB::fetch($query)) {
updatemoderate('tid', $row['tid']);
}
loadcache('posttable_info');
$posttables = array();
if(!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
foreach($_G['cache']['posttable_info'] as $posttableid => $data) {
$posttables[] = $posttableid;
}
} else {
$posttables[] = 0;
}
foreach($posttables as $postableid) {
$query = DB::query("SELECT pid FROM ".DB::table(getposttable($postableid))." WHERE invisible='-2' AND first='0'");
while($row = DB::fetch($query)) {
updatemoderate('pid', $row['pid']);
}
}
$query = DB::query("SELECT blogid FROM ".DB::table('home_blog')." WHERE status='1'");
while($row = DB::fetch($query)) {
updatemoderate('blogid', $row['blogid']);
}
$query = DB::query("SELECT doid FROM ".DB::table('home_doing')." WHERE status='1'");
while($row = DB::fetch($query)) {
updatemoderate('doid', $row['doid']);
}
$query = DB::query("SELECT picid FROM ".DB::table('home_pic')." WHERE status='1'");
while($row = DB::fetch($query)) {
示例15: getallwithposts
function getallwithposts($sqlstruct, $onlyprimarytable = false)
{
$ptable = getposttable('p');
$atable = getposttable('a');
$result = array();
$from_clause = str_replace(DB::table('forum_post'), DB::table($ptable), $sqlstruct['from']);
$sql = "SELECT {$sqlstruct['select']} FROM {$from_clause} WHERE {$sqlstruct['where']}";
$sqladd = '';
if (!empty($sqlstruct['order'])) {
$sqladd .= " ORDER BY {$sqlstruct['order']}";
}
if (!empty($sqlstruct['limit'])) {
$sqladd .= " LIMIT {$sqlstruct['limit']}";
}
$sql = $sql . $sqladd;
$query = DB::query($sql);
while ($row = DB::fetch($query)) {
$result[] = $row;
}
if (!$onlyprimarytable && $atable !== NULL) {
$from_clause = str_replace(DB::table('forum_post'), DB::table($atable), $sqlstruct['from']);
$sql = "SELECT {$sqlstruct['select']} FROM {$from_clause} WHERE {$sqlstruct['where']}";
$sql = $sql . $sqladd;
$query = DB::query($sql);
while ($row = DB::fetch($query)) {
$result[] = $row;
}
}
return $result;
}