本文整理汇总了PHP中updatepost函数的典型用法代码示例。如果您正苦于以下问题:PHP updatepost函数的具体用法?PHP updatepost怎么用?PHP updatepost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updatepost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: undeletethreads
function undeletethreads($tids)
{
global $_G;
$threadsundel = 0;
if ($tids && is_array($tids)) {
foreach ($tids as $t) {
my_thread_log('restore', array('tid' => $t));
}
$tids = '\'' . implode('\',\'', $tids) . '\'';
$tuidarray = $ruidarray = $fidarray = array();
$postarray = getfieldsofposts('fid, first, authorid', "tid IN ({$tids})");
foreach ($postarray as $post) {
if ($post['first']) {
$tuidarray[] = $post['authorid'];
} else {
$ruidarray[] = $post['authorid'];
}
if (!in_array($post['fid'], $fidarray)) {
$fidarray[] = $post['fid'];
}
}
if ($tuidarray) {
updatepostcredits('+', $tuidarray, 'post');
}
if ($ruidarray) {
updatepostcredits('+', $ruidarray, 'reply');
}
updatepost(array('invisible' => '0'), "tid IN ({$tids})", true);
DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})");
$threadsundel = DB::affected_rows();
updatemodlog($tids, 'UDL');
updatemodworks('UDL', $threadsundel);
foreach ($fidarray as $fid) {
updateforumcount($fid);
}
}
return $threadsundel;
}
示例2: session_start
<?php
session_start();
require_once "install.php";
/* REQUEST = $_POST $_GET */
if (!empty($_REQUEST['action'])) {
$accion = $_REQUEST['action'];
if ($accion == 'crear') {
crearPost();
} else {
if ($accion == 'ver') {
verpost();
} else {
if ($accion == 'update') {
updatepost();
} else {
if ($accion == 'delete') {
deletepost();
}
}
}
}
}
function crearPost()
{
/* Proteccion de Datos */
$params = array(':Utc ' => $_POST['Utc'], ':Anio ' => $_POST['Anio'], ':Mes ' => $_POST['Mes'], ':Dia ' => $_POST['Dia'], ':Hora ' => $_POST['Hora'], ':Minuto ' => $_POST['Minuto'], ':Segundo ' => $_POST['Segundo'], ':Titulo ' => $_POST['Titulo'], ':SubTitulo ' => $_POST['SubTitulo'], ':Icono ' => $_POST['Icono'], ':Texto ' => $_POST['Texto'], ':Imagen ' => $_POST['Imagen']);
/* Preparamos el query apartir del array $params*/
$query = 'INSERT INTO Post
(Utc,Anio,Mes,Dia,Hora,Minuto,Segundo,Titulo,SubTitulo,Icono,Texto,Imagen)
VALUES
示例3: updatepostcredits
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);
}
}
示例4: parseattach
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
global $_G;
$query = DB::query("SELECT a.*, af.description, l.relatedid AS payed\n\t\tFROM " . DB::table('forum_attachment') . " a\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid\n\t\tLEFT JOIN " . DB::table('common_credit_log') . " l ON l.relatedid=a.aid AND l.uid='{$_G['uid']}' AND l.operation='BAC'\n\t\tWHERE a.pid IN ({$attachpids})");
$attachexists = FALSE;
while ($attach = DB::fetch($query)) {
$attachexists = TRUE;
if ($skipaids && in_array($attach['aid'], $skipaids)) {
continue;
}
$attached = 0;
$extension = strtolower(fileext($attach['filename']));
$attach['ext'] = $extension;
$attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
$attach['attachsize'] = sizecount($attach['filesize']);
$attach['attachimg'] = $_G['setting']['attachimgpost'] && $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
if ($attach['price']) {
if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
DB::query("UPDATE " . DB::table('forum_attachment') . " SET price='0' WHERE aid='{$attach['aid']}'");
$attach['price'] = 0;
} else {
if (!$_G['uid'] || !$_G['forum']['ismoderator'] && $attach['uid'] != $_G['uid'] && !$attach['payed']) {
$attach['unpayed'] = 1;
}
}
}
$exemptattachpay = $_G['group']['exempt'] & 8 ? 1 : 0;
$attach['payed'] = $attach['payed'] || $_G['forum']['ismoderator'] || $attach['uid'] == $_G['uid'] ? 1 : 0;
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] . '/' : $_G['setting']['attachurl']) . 'forum/';
$attach['dateline'] = dgmdate($attach['dateline'], 'u');
$postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
if (!empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
$findattach[$attach['pid']][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
$replaceattach[$attach['pid']][] = attachtag($attach['pid'], $attach['aid'], $postlist);
$attached = 1;
}
if (!$attached) {
if ($attach['isimage']) {
$postlist[$attach['pid']]['imagelist'] .= attachlist($attach);
} else {
if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
$postlist[$attach['pid']]['attachlist'] .= attachlist($attach);
}
}
}
}
if ($attachexists) {
foreach ($attachtags as $pid => $aids) {
if ($findattach[$pid]) {
$postlist[$pid]['message'] = preg_replace($findattach[$pid], $replaceattach[$pid], $postlist[$pid]['message'], 1);
$postlist[$pid]['message'] = preg_replace($findattach[$pid], '', $postlist[$pid]['message']);
}
}
} else {
updatepost(array('attachment' => '0'), "pid IN ({$attachpids})", true);
}
}
示例5: daddslashes
if (in_array($thread['displayorder'], array(2, 3))) {
$stickmodify = 1;
}
if ($_G['gp_type'] == 'redirect') {
$thread = daddslashes($thread, 1);
DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, readperm, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, special, attachment, typeid)\r\n\t\t\t\t\t\t\t\tVALUES ('{$thread['fid']}', '{$thread['readperm']}', '" . addslashes($thread['author']) . "', '{$thread['authorid']}', '" . addslashes($thread['subject']) . "', '{$thread['dateline']}', '{$thread['dblastpost']}', '" . addslashes($thread['lastposter']) . "', '0', '0', '0', '0', '{$thread['tid']}', '0', '0', '{$_G['gp_threadtypeid']}')");
}
}
}
if (!($moderatetids = implode(',', $moderate))) {
showmessage('admin_moderate_invalid');
}
$displayorderadd = $_G['adminid'] == 3 ? ', displayorder=\'0\'' : '';
DB::query("UPDATE " . DB::table('forum_thread') . " SET fid='{$moveto}', moderated='1', isgroup='0', typeid='{$_G['gp_threadtypeid']}' {$displayorderadd} WHERE tid IN ({$moderatetids})");
DB::query("UPDATE " . DB::table('forum_forumrecommend') . " SET fid='{$moveto}' WHERE tid IN ({$moderatetids})");
updatepost(array('fid' => $moveto), "tid IN ({$moderatetids})");
if ($_G['setting']['globalstick'] && $stickmodify) {
require_once libfile('function/cache');
updatecache('globalstick');
}
$modaction = 'MOV';
updateforumcount($moveto);
updateforumcount($_G['fid']);
} elseif ($operation == 'type') {
if (!$_G['group']['allowedittypethread']) {
showmessage('no_privilege_edittypethread');
}
if (!isset($_G['forum']['threadtypes']['types'][$_G['gp_typeid']]) && ($_G['gp_typeid'] != 0 || $_G['forum']['threadtypes']['required'])) {
showmessage('admin_type_invalid');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET typeid='{$_G['gp_typeid']}', moderated='1' WHERE tid IN ({$moderatetids})");
示例6: showformheader
showformheader('forums&operation=merge');
showtableheader();
showsetting('forums_merge_source', '', '', sprintf($forumselect, 'source'));
showsetting('forums_merge_target', '', '', sprintf($forumselect, 'target'));
showsubmit('mergesubmit');
showtablefooter();
showformfooter();
} else {
if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE fid IN ('{$source}', '{$target}') AND type<>'group'") != 2) {
cpmsg_error('forums_nonexistence');
}
if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE fup='{$source}'")) {
cpmsg_error('forums_merge_source_sub_notnull');
}
DB::update('forum_thread', array('fid' => $target), "fid='{$source}'");
updatepost(array('fid' => $target), "fid='{$source}'");
$sourceforum = DB::fetch_first("SELECT threads, posts FROM " . DB::table('forum_forum') . " WHERE fid='{$source}'");
$targetforum = DB::fetch_first("SELECT threads, posts FROM " . DB::table('forum_forum') . " WHERE fid='{$target}'");
DB::update('forum_forum', array('threads' => $targetforum['threads'] + $sourceforum['threads'], 'posts' => $targetforum['posts'] + $sourceforum['posts']), "fid='{$target}'");
DB::query("DELETE FROM " . DB::table('forum_forum') . " WHERE fid='{$source}'");
DB::query("DELETE FROM " . DB::table('forum_forumfield') . " WHERE fid='{$source}'");
DB::query("DELETE FROM " . DB::table('forum_moderator') . " WHERE fid='{$source}'");
my_thread_log('mergeforum', array('fid' => $source, 'otherid' => $target));
$query = DB::query("SELECT * FROM " . DB::table('forum_access') . " WHERE fid='{$source}'");
while ($access = DB::fetch($query)) {
DB::insert('forum_access', array('uid' => $access['uid'], 'fid' => $target, 'allowview' => $access['allowview'], 'allowpost' => $access['allowpost'], 'allowreply' => $access['allowreply'], 'allowgetattach' => $access['allowgetattach']), 0, 0, 1);
}
DB::query("DELETE FROM " . DB::table('forum_access') . " WHERE fid='{$source}'");
updatecache('forums');
cpmsg('forums_merge_succeed', 'action=forums', 'succeed');
}
示例7: array
$pm = 'pm_' . $post['pid'];
if (isset(${$pm}) && ${$pm} != '' && $post['authorid']) {
$pmlist[] = array('action' => 'modreplies_validate', 'notevar' => array('tid' => $_G['tid'], 'post' => $post, 'reason' => stripslashes($reason)), 'authorid' => $post['authorid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(cutstr($post['message'], 30)), 'reason' => dhtmlspecialchars(${$pm}));
}
}
if ($authoridarray) {
updatepostcredits('+', $authoridarray, 'reply');
}
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)) {
updatepost(array('invisible' => '0'), "pid IN (0," . implode(',', $pidarray) . ")");
$validates = DB::affected_rows();
updatemodworks('MOD', $validates);
} else {
updatemodworks('MOD', 1);
}
}
if ($pmlist) {
foreach ($pmlist as $pm) {
$reason = $pm['reason'];
$post = $pm['post'];
$tid = intval($pm['tid']);
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notvar'], 1);
}
}
cpmsg('moderate_replies_succeed', "action=moderate&operation=replies&page={$page}&filter={$filter}&modfid={$modfid}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
示例8: recyclebinpostundelete
function recyclebinpostundelete($undeletepids, $posttableid = false)
{
global $_G;
$postsundel = 0;
if (empty($undeletepids)) {
return $postsundel;
}
foreach ($undeletepids as $pid) {
my_post_log('restore', array('pid' => $pid));
}
$undeletepids = dimplode($undeletepids);
loadcache('posttableids');
$posttableids = !empty($_G['cache']['posttableids']) ? $posttableid !== false && in_array($posttableid, $_G['cache']['posttableids']) ? array($posttableid) : $_G['cache']['posttableids'] : array('0');
$postarray = $ruidarray = $fidarray = $tidarray = array();
foreach ($posttableids as $ptid) {
$query = DB::query('SELECT fid, tid, first, authorid FROM ' . DB::table(getposttable($ptid)) . " WHERE pid IN ({$undeletepids})");
while ($post = DB::fetch($query)) {
$postarray[] = $post;
}
}
if (empty($postarray)) {
return $postsundel;
}
foreach ($postarray as $key => $post) {
if (!$post['first']) {
$ruidarray[] = $post['authorid'];
}
$fidarray[$post['fid']] = $post['fid'];
$tidarray[$post['tid']] = $post['tid'];
}
$postsundel = updatepost(array('invisible' => '0'), "pid IN ({$undeletepids})", true, $posttableid);
include_once libfile('function/post');
if ($ruidarray) {
updatepostcredits('+', $ruidarray, $creditspolicy['reply']);
}
foreach ($tidarray as $tid) {
updatethreadcount($tid, 1);
}
foreach ($fidarray as $fid) {
updateforumcount($fid);
}
return $postsundel;
}
示例9: showtagfooter
echo '<iframe name="attachmentframe" style="display:none"></iframe>';
showtagfooter('div');
}
} else {
if ($ids = dimplode($_G['gp_delete'])) {
$tids = $pids = 0;
$query = DB::query("SELECT tid, pid, attachment, thumb, remote, aid FROM " . DB::table('forum_attachment_' . $_G['gp_attachtableid']) . " WHERE aid IN ({$ids})");
while ($attach = DB::fetch($query)) {
dunlink($attach);
$tids .= ',' . $attach['tid'];
$pids .= ',' . $attach['pid'];
}
DB::query("DELETE FROM " . DB::table('forum_attachment_' . $_G['gp_attachtableid']) . " WHERE aid IN ({$ids})");
$attachtids = 0;
$query = DB::query("SELECT tid FROM " . DB::table('forum_attachment_' . $_G['gp_attachtableid']) . " WHERE tid IN ({$tids}) GROUP BY tid ORDER BY pid DESC");
while ($attach = DB::fetch($query)) {
$attachtids .= ',' . $attach['tid'];
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET attachment='0' WHERE tid IN ({$tids})" . ($attachtids ? " AND tid NOT IN ({$attachtids})" : NULL));
$attachpids = 0;
$query = DB::query("SELECT pid FROM " . DB::table('forum_attachment_' . $_G['gp_attachtableid']) . " WHERE pid IN ({$pids}) GROUP BY pid ORDER BY pid DESC");
while ($attach = DB::fetch($query)) {
$attachpids .= ',' . $attach['pid'];
}
updatepost(array('attachment' => '0'), "pid IN ({$pids})" . ($attachpids ? "AND pid NOT IN ({$attachpids})" : NULL));
$cpmsg = cplang('attach_edit_succeed');
} else {
$cpmsg = cplang('attach_edit_invalid');
}
echo "<script type=\"text/JavaScript\">alert('{$cpmsg}');parent.\$('attachmentforum').searchsubmit.click();</script>";
}
示例10: deletethread
deletethread($tidsarray, !$_G['gp_donotupdatemember'], !$_G['gp_donotupdatemember']);
if ($_G['setting']['globalstick']) {
updatecache('globalstick');
}
foreach (explode(',', $_G['gp_fids']) as $fid) {
updateforumcount(intval($fid));
}
foreach ($_G['gp_tidarray'] as $tid) {
my_thread_log('delete', array('tid' => $tid));
}
$cpmsg = cplang('threads_succeed');
} elseif ($optype == 'deleteattach') {
require_once libfile('function/delete');
deleteattach($tidsarray, 'tid');
DB::query("UPDATE " . DB::table('forum_thread') . " SET attachment='0' WHERE {$tidsadd}");
updatepost(array('attachment' => '0'), $tidsadd);
$cpmsg = cplang('threads_succeed');
} elseif ($optype == 'stick') {
DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='{$_G['gp_stick_level']}' WHERE {$tidsadd}");
$my_act = $_G['gp_stick_level'] ? 'sticky' : 'update';
foreach ($_G['gp_tidarray'] as $tid) {
my_thread_log($my_act, array('tid' => $tid));
}
if ($_G['setting']['globalstick']) {
updatecache('globalstick');
}
$cpmsg = cplang('threads_succeed');
} elseif ($optype == 'adddigest') {
$query = DB::query("SELECT tid, fid, authorid, digest FROM " . DB::table('forum_thread') . " WHERE {$tidsadd}");
while ($thread = DB::fetch($query)) {
if ($_G['gp_digest_level'] == $thread['digest']) {
示例11: parseattach
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array())
{
global $_G;
$query = DB::query("SELECT * FROM " . DB::table(getattachtablebytid($_G['tid'])) . " a WHERE a.pid IN ({$attachpids})");
$attachexists = FALSE;
$skipattachcode = $aids = $payaids = $findattach = array();
while ($attach = DB::fetch($query)) {
$attachexists = TRUE;
if ($skipaids && in_array($attach['aid'], $skipaids)) {
$skipattachcode[$attach[pid]][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
continue;
}
$attached = 0;
$extension = strtolower(fileext($attach['filename']));
$attach['ext'] = $extension;
$attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
$attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']);
$attach['attachsize'] = sizecount($attach['filesize']);
if ($attach['isimage'] && !$_G['setting']['attachimgpost']) {
$attach['isimage'] = 0;
}
$attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
if ($attach['attachimg']) {
$GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
}
if ($attach['price']) {
if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
DB::query("UPDATE " . DB::table(getattachtablebytid($_G['tid'])) . " SET price='0' WHERE aid='{$attach['aid']}'");
$attach['price'] = 0;
} elseif (!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
$payaids[$attach['aid']] = $attach['pid'];
}
}
$attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/';
$attach['dateline'] = dgmdate($attach['dateline'], 'u');
$postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
if (!empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
$findattach[$attach['pid']][$attach['aid']] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i";
$attached = 1;
}
if (!$attached) {
if ($attach['isimage']) {
$postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
$postlist[$attach['pid']]['imagelistcount']++;
if ($postlist[$attach['pid']]['first']) {
$GLOBALS['firstimgs'][] = $attach['aid'];
}
} else {
if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) {
$postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
}
}
}
$aids[] = $attach['aid'];
}
if ($aids) {
$query = DB::query("SELECT aid, pid, downloads FROM " . DB::table('forum_attachment') . " WHERE aid IN (" . dimplode($aids) . ")");
while ($attach = DB::fetch($query)) {
$postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
}
}
if ($payaids) {
$query = DB::query("SELECT relatedid FROM " . DB::table('common_credit_log') . " WHERE relatedid IN (" . dimplode(array_keys($payaids)) . ") AND uid='{$_G['uid']}' AND operation='BAC'");
while ($creditlog = DB::fetch($query)) {
$postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
}
}
if (!empty($skipattachcode)) {
foreach ($skipattachcode as $pid => $findskipattach) {
foreach ($findskipattach as $findskip) {
$postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
}
}
}
if ($attachexists) {
foreach ($attachtags as $pid => $aids) {
if ($findattach[$pid]) {
foreach ($findattach[$pid] as $aid => $find) {
$postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]['first']), $postlist[$pid]['message'], 1);
$postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
}
}
}
} else {
updatepost(array('attachment' => '0'), "pid IN ({$attachpids})", true);
}
}
示例12: array
$sourcefid = $fidarray[$start];
if (empty($start)) {
$nums = array();
$query = DB::query("SELECT fup FROM " . DB::table('forum_forum') . " WHERE fid IN(" . dimplode($fidarray) . ")");
while ($fup = DB::fetch($query)) {
$nums[$fup['fup']]++;
}
foreach ($nums as $fup => $num) {
DB::query("UPDATE " . DB::table('forum_forumfield') . " SET groupnum = groupnum+'-{$num}' WHERE fid='{$fup}'");
}
}
foreach ($threadtables as $tableid) {
$threadtable = $tableid ? "forum_thread_{$tableid}" : 'forum_thread';
DB::query("UPDATE " . DB::table($threadtable) . " SET fid='{$targetgroup}' WHERE fid='{$sourcefid}'");
}
updatepost(array('fid' => $targetgroup), "fid='{$sourcefid}'");
$targetusers = $newgroupusers = array();
$query = DB::query("SELECT uid FROM " . DB::table('forum_groupuser') . " WHERE fid='{$targetgroup}'");
while ($row = DB::fetch($query)) {
$targetusers[$row['uid']] = $row['uid'];
}
$adduser = 0;
$query = DB::query("SELECT uid, username FROM " . DB::table('forum_groupuser') . " WHERE fid='{$sourcefid}'");
while ($row = DB::fetch($query)) {
if (empty($targetusers[$row['uid']])) {
$newgroupusers[$row[uid]] = daddslashes($row['username']);
$adduser++;
}
}
if ($adduser) {
foreach ($newgroupusers as $newuid => $newusername) {
示例13: handleEvilPost
function handleEvilPost($tid, $pid, $evilType, $evilLevel = 1)
{
global $_G;
if (notOpenService()) {
return false;
}
include_once DISCUZ_ROOT . './source/language/lang_admincp_cloud.php';
loadSecLog($pid, 'pid');
$evilPost = DB::fetch_first("SELECT * FROM " . DB::table('security_evilpost') . " WHERE pid='{$pid}'");
if (is_array($evilPost)) {
$data = $evilPost;
$data['evilcount'] = $evilPost['evilcount'] + 1;
} else {
require_once libfile('function/delete');
require_once libfile('function/forum');
require_once libfile('function/post');
$data = array('pid' => $pid, 'tid' => $tid, 'evilcount' => 1, 'eviltype' => $evilType, 'createtime' => TIMESTAMP);
$post = get_post_by_pid($pid);
if (is_array($post) && count($post) > 0) {
if ($tid != $post['tid']) {
return false;
}
if ($post['first']) {
$data['type'] = 1;
if (checkThreadIgnore($tid)) {
return false;
}
DB::insert('security_evilpost', $data, 0, 1);
updateEvilCount('thread');
DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='-1', digest='0', moderated='1' WHERE tid = '" . $tid . "'");
deletethread(array($tid), true, true, true);
updatepost(array('invisible' => '-1'), "tid = '" . $tid . "'");
updatemodlog($tid, 'DEL', 0, 1, $extend_lang['security_modreason']);
} else {
$data['type'] = 0;
if (checkPostIgnore($pid, $post)) {
return false;
}
DB::insert('security_evilpost', $data, 0, 1);
updateEvilCount('post');
deletepost(array($pid), 'pid', true, false, true);
}
} else {
$data['operateresult'] = 2;
DB::insert('security_evilpost', $data, 0, 1);
}
}
return true;
}
示例14: 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['fid']][] = $post['authorid'];
} else {
$ruidarray[$post['fid']][] = $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) {
foreach ($tuidarray as $fid => $tuids) {
updatepostcredits('-', $tuids, 'post', $fid);
}
}
if ($ruidarray) {
foreach ($ruidarray as $fid => $ruids) {
updatepostcredits('-', $ruids, 'reply', $fid);
}
}
$auidarray = $attachtables = array();
foreach ($atids as $tid) {
$attachtables[getattachtablebytid($tid)][] = $tid;
}
//.........这里部分代码省略.........
示例15: array
}
if ($validatetids = dimplode($moderation['validate'])) {
$tids = $comma = $comma2 = '';
$moderatedthread = array();
$query = DB::query("SELECT t.fid, t.tid, t.authorid, t.subject, t.author, t.dateline FROM " . DB::table('forum_thread') . " t\n\t\t\t\tWHERE t.tid IN ({$validatetids}) AND t.displayorder='{$pstat}' AND " . ($modfidsadd ? "t.{$modfidsadd}" : '1'));
while ($thread = DB::fetch($query)) {
$tids .= $comma . $thread['tid'];
$comma = ',';
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$validatedthreads[] = $thread;
if ($_G['gp_reason'] != '' && $thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array('act' => 'modthreads_validate', 'notevar' => array('reason' => dhtmlspecialchars($_G['gp_reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject']), 'authorid' => $thread['authorid']);
}
}
if ($tids) {
updatepost(array('invisible' => '0'), "tid IN ({$tids})");
DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})");
$threadsmod = DB::affected_rows();
if ($_G['fid']) {
updateforumcount($_G['fid']);
} else {
$fids = array_keys($modforums['list']);
foreach ($fids as $f) {
updateforumcount($f);
}
}
updatemodworks('MOD', $threadsmod);
updatemodlog($tids, 'MOD');
}
}
if ($pmlist) {