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


PHP updatepostcredits函数代码示例

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


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

示例1: IN

     $query2 = $db->query("SELECT pid, first, authorid FROM {$tablepre}posts WHERE tid IN ({$tidsdelete})");
     while (($post = $db->fetch_array($query1)) || ($post = $db->fetch_array($query2))) {
         $postsarray[$post['pid']] = $post;
     }
     foreach ($postsarray as $post) {
         if ($post['first']) {
             $tuidarray[] = $post['authorid'];
         } else {
             $ruidarray[] = $post['authorid'];
         }
     }
     if ($tuidarray) {
         updatepostcredits('-', $tuidarray, $creditspolicy['post']);
     }
     if ($ruidarray) {
         updatepostcredits('-', $ruidarray, $creditspolicy['reply']);
     }
 }
 $db->query("DELETE FROM {$tablepre}attachments WHERE pid IN ({$pidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}attachments WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}threadsmod WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}threadsmod WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}threads WHERE tid IN ({$tidsdelete})");
 $deletedthreads = $db->affected_rows();
 $db->query("DELETE FROM {$tablepre}posts WHERE pid IN ({$pidsdelete})");
 $deletedposts = $db->affected_rows();
 $db->query("DELETE FROM {$tablepre}posts WHERE tid IN ({$tidsdelete})");
 $deletedposts += $db->affected_rows();
 $db->query("DELETE FROM {$tablepre}polloptions WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}polls WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
 $db->query("DELETE FROM {$tablepre}rewardlog WHERE tid IN ({$tidsdelete})", 'UNBUFFERED');
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:prune.inc.php

示例2: 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;
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:38,代码来源:function_misc.php

示例3: newthread


//.........这里部分代码省略.........
     if (!$this->param['special']) {
         $this->param['price'] = $this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] : $this->group['maxprice'] : 0;
     }
     if (!$this->param['typeid'] && $this->forum['threadtypes']['required'] && !$this->param['special']) {
         return $this->showmessage('post_type_isnull');
     }
     if (!$this->param['sortid'] && $this->forum['threadsorts']['required'] && !$this->param['special']) {
         return $this->showmessage('post_sort_isnull');
     }
     if (!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
         return $this->showmessage('post_net_price_iszero');
     }
     $this->param['sortid'] = $this->param['special'] && $this->forum['threadsorts']['types'][$this->param['sortid']] ? 0 : $this->param['sortid'];
     $this->param['typeexpiration'] = intval($this->param['typeexpiration']);
     if ($this->forum['threadsorts']['expiration'][$this->param['typeid']] && !$this->param['typeexpiration']) {
         return $this->showmessage('threadtype_expiration_invalid');
     }
     $author = !$this->param['isanonymous'] ? $this->member['username'] : '';
     $this->param['moderated'] = $this->param['digest'] || $this->param['displayorder'] > 0 ? 1 : 0;
     $this->param['ordertype'] && ($this->param['tstatus'] = setstatus(4, 1, $this->param['tstatus']));
     $this->param['imgcontent'] && ($this->param['tstatus'] = setstatus(15, $this->param['imgcontent'], $this->param['tstatus']));
     $this->param['hiddenreplies'] && ($this->param['tstatus'] = setstatus(2, 1, $this->param['tstatus']));
     $this->param['allownoticeauthor'] && ($this->param['tstatus'] = setstatus(6, 1, $this->param['tstatus']));
     $this->param['isgroup'] = $this->forum['status'] == 3 ? 1 : 0;
     $this->param['publishdate'] = !$this->param['modnewthreads'] ? $this->param['publishdate'] : TIMESTAMP;
     $newthread = array('fid' => $this->forum['fid'], 'posttableid' => 0, 'readperm' => $this->param['readperm'], 'price' => $this->param['price'], 'typeid' => $this->param['typeid'], 'sortid' => $this->param['sortid'], 'author' => $author, 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'lastpost' => $this->param['publishdate'], 'lastposter' => $author, 'displayorder' => $this->param['displayorder'], 'digest' => $this->param['digest'], 'special' => $this->param['special'], 'attachment' => 0, 'moderated' => $this->param['moderated'], 'status' => $this->param['tstatus'], 'isgroup' => $this->param['isgroup'], 'replycredit' => $this->param['replycredit'], 'closed' => $this->param['closed'] ? 1 : 0);
     $this->tid = C::t('forum_thread')->insert($newthread, true);
     C::t('forum_newthread')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'], 'dateline' => $this->param['publishdate']));
     useractionlog($this->member['uid'], 'tid');
     if (!getuserprofile('threads') && $this->setting['newbie']) {
         C::t('forum_thread')->update($this->tid, array('icon' => $this->setting['newbie']));
     }
     if ($this->param['publishdate'] != TIMESTAMP) {
         $cron_publish_ids = dunserialize($this->cache('cronpublish'));
         $cron_publish_ids[$this->tid] = $this->tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$this->param['isanonymous']) {
         C::t('common_member_field_home')->update($this->member['uid'], array('recentnote' => $this->param['subject']));
     }
     if ($this->param['moderated']) {
         updatemodlog($this->tid, $this->param['displayorder'] > 0 ? 'STK' : 'DIG');
         updatemodworks($this->param['displayorder'] > 0 ? 'STK' : 'DIG', 1);
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $this->param['usesig'] = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $this->param['tagstr'] = $class_tag->add_tag($this->param['tags'], $this->tid, 'tid');
     $this->param['pinvisible'] = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['pstatus'] = intval($this->param['pstatus']);
     defined('IN_MOBILE') && ($this->param['pstatus'] = setstatus(4, 1, $this->param['pstatus']));
     if ($this->param['imgcontent']) {
         stringtopic($this->param['message'], $this->tid, true, $this->param['imgcontentwidth']);
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '1', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $this->param['pinvisible'], 'anonymous' => $this->param['isanonymous'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => '0', 'tags' => $this->param['tagstr'], 'replycredit' => 0, 'status' => $this->param['pstatus']));
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($this->param['isgroup'] ? 'groupthread' : $statarr[$this->param['special']]);
     if ($this->param['geoloc'] && IN_MOBILE == 2) {
         list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
         if ($mapx && $mapy && $location) {
             C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->tid, 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     if ($this->param['modnewthreads']) {
         updatemoderate('tid', $this->tid);
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return 'post_newthread_mod_succeed';
     } else {
         if ($this->param['displayorder'] != -4) {
             if ($this->param['digest']) {
                 updatepostcredits('+', $this->member['uid'], 'digest', $this->forum['fid']);
             }
             updatepostcredits('+', $this->member['uid'], 'post', $this->forum['fid']);
             if ($this->param['isgroup']) {
                 C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $this->param['subject']);
             $lastpost = "{$this->tid}\t" . $subject . "\t" . TIMESTAMP . "\t{$author}";
             C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($this->forum['fid'], 1, 1, 1);
             if ($this->forum['type'] == 'sub') {
                 C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($this->param['isgroup']) {
             C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($this->forum['fid'], $this->member['uid']);
         }
         C::t('forum_sofa')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid']));
         return 'post_newthread_succeed';
     }
 }
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:101,代码来源:model_forum_thread.php

示例4: foreach

 if (!empty($_GET['commentitem']) && !empty($_G['uid']) && $post['authorid'] != $_G['uid']) {
     foreach ($_GET['commentitem'] as $itemk => $itemv) {
         if ($itemv !== '') {
             $commentscore .= strip_tags(trim($itemk)) . ': <i>' . intval($itemv) . '</i> ';
         }
     }
 }
 $comment = cutstr(($commentscore ? $commentscore . '<br />' : '') . censor(trim(dhtmlspecialchars($_GET['message'])), '***'), 200, ' ');
 if (!$comment) {
     showmessage('post_sm_isnull');
 }
 $pcid = C::t('forum_postcomment')->insert(array('tid' => $post['tid'], 'pid' => $post['pid'], 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => TIMESTAMP, 'comment' => $comment, 'score' => $commentscore ? 1 : 0, 'useip' => $_G['clientip'], 'port' => $_G['remoteport']), true);
 C::t('forum_post')->update('tid:' . $_G['tid'], $_GET['pid'], array('comment' => 1));
 $comments = $thread['comments'] ? $thread['comments'] + 1 : C::t('forum_postcomment')->count_by_tid($_G['tid']);
 C::t('forum_thread')->update($_G['tid'], array('comments' => $comments));
 !empty($_G['uid']) && updatepostcredits('+', $_G['uid'], 'reply', $_G['fid']);
 if (!empty($_G['uid']) && $_G['uid'] != $post['authorid']) {
     notification_add($post['authorid'], 'pcomment', 'comment_add', array('tid' => $_G['tid'], 'pid' => $_GET['pid'], 'subject' => $thread['subject'], 'from_id' => $_G['tid'], 'from_idtype' => 'pcomment', 'commentmsg' => cutstr(str_replace(array('[b]', '[/b]', '[/color]'), '', preg_replace("/\\[color=([#\\w]+?)\\]/i", "", $comment)), 200)));
 }
 update_threadpartake($post['tid']);
 $pcid = C::t('forum_postcomment')->fetch_standpoint_by_pid($_GET['pid']);
 $pcid = $pcid['id'];
 if (!empty($_G['uid']) && $_GET['commentitem']) {
     $totalcomment = array();
     foreach (C::t('forum_postcomment')->fetch_all_by_pid_score($_GET['pid'], 1) as $comment) {
         $comment['comment'] = addslashes($comment['comment']);
         if (strexists($comment['comment'], '<br />')) {
             if (preg_match_all("/([^:]+?):\\s<i>(\\d+)<\\/i>/", $comment['comment'], $a)) {
                 foreach ($a[1] as $k => $itemk) {
                     $totalcomment[trim($itemk)][] = $a[2][$k];
                 }
开发者ID:lemonstory,项目名称:bbs,代码行数:31,代码来源:post_newreply.php

示例5: undeletethreads

function undeletethreads($tids)
{
    global $db, $tablepre, $creditspolicy;
    $threadsundel = 0;
    if ($tids && is_array($tids)) {
        $tids = '\'' . implode('\',\'', $tids) . '\'';
        $tuidarray = $ruidarray = $fidarray = array();
        $query = $db->query("SELECT fid, first, authorid FROM {$tablepre}posts WHERE tid IN ({$tids})");
        while ($post = $db->fetch_array($query)) {
            if ($post['first']) {
                $tuidarray[] = $post['authorid'];
            } else {
                $ruidarray[] = $post['authorid'];
            }
            if (!in_array($post['fid'], $fidarray)) {
                $fidarray[] = $post['fid'];
            }
        }
        if ($tuidarray) {
            updatepostcredits('+', $tuidarray, $creditspolicy['post']);
        }
        if ($ruidarray) {
            updatepostcredits('+', $ruidarray, $creditspolicy['reply']);
        }
        $db->query("UPDATE {$tablepre}posts SET invisible='0' WHERE tid IN ({$tids})", 'UNBUFFERED');
        $db->query("UPDATE {$tablepre}threads 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;
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:35,代码来源:cpanel.share.php

示例6: IN

 $query = DB::query("SELECT pid, authorid, dateline, message, first FROM " . DB::table($posttable) . " WHERE pid IN ({$deletepids}) AND tid='{$_G['tid']}'");
 while ($post = DB::fetch($query)) {
     if (!$post['first']) {
         $posts[] = $post;
         $pids .= $comma . $post['pid'];
         if ($post['dateline'] < $losslessdel) {
             updatemembercount($post['authorid'], array('posts' => -1), false);
         } else {
             $puidarray[] = $post['authorid'];
         }
         $modpostsnum++;
         $comma = ',';
     }
 }
 if ($puidarray) {
     updatepostcredits('-', $puidarray, 'reply', $_G['fid']);
 }
 if ($pids) {
     $query = DB::query("SELECT uid, attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})");
 }
 while ($attach = DB::fetch($query)) {
     if (in_array($attach['uid'], $puidarray)) {
         $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1;
     }
     dunlink($attach);
 }
 if ($auidarray) {
     updateattachcredits('-', $auidarray, $postattachcredits);
 }
 $logs = array();
 if ($pids) {
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:topicadmin_delpost.php

示例7: updatemodworks

         updatemodworks('MOD', $rows);
         C::t('forum_post')->update_by_tid(0, explode(',', $recyclebintids), array('invisible' => -1), true);
         updatemodlog($recyclebintids, 'DEL');
     }
     require_once libfile('function/delete');
     deletethread($deletetids);
     updatemoderate('tid', $moderation['delete'], 2);
 }
 if ($validatetids = dimplode($moderation['validate'])) {
     $tids = $moderatedthread = array();
     foreach (C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['validate'], $pstat, '=', $modfids ? explode(',', $modfids) : null) as $thread) {
         $tids[] = $thread['tid'];
         $poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
         $poststatus = $poststatus['status'];
         if (getstatus($poststatus, 3) == 0) {
             updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
             $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']);
             updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
         }
         $validatedthreads[] = $thread;
         if ($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
             $pmlist[] = array('act' => 'modthreads_validate', 'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'from_id' => 0, 'from_idtype' => 'modthreads'), 'authorid' => $thread['authorid']);
         }
     }
     if ($tids) {
         $tidstr = dimplode($tids);
         C::t('forum_post')->update_by_tid(0, $tids, array('invisible' => 0), true, false, 1);
         C::t('forum_thread')->update($tids, array('displayorder' => 0, 'moderated' => 1));
         $threadsmod = DB::affected_rows();
         if ($_G['fid']) {
             updateforumcount($_G['fid']);
开发者ID:tang86,项目名称:discuz-utf8,代码行数:31,代码来源:modcp_moderate.php

示例8: array

                    $feed['body_data'] = array('subject' => "<a href=\"{$boardurl}viewthread.php?tid={$tid}\">{$subject}</a>", 'play' => "<a href=\"{$boardurl}viewthread.php?tid={$tid}\" class=\"playbutton\">Play</a>", 'message' => cutstr(strip_tags(preg_replace(array("/\\[hide=?\\d*\\].+?\\[\\/hide\\]/is", "/\\[.+?\\]/is"), array('', ''), $message)), 150), 'vlength' => sprintf("%02d", intval($vlength / 60)) . ':' . sprintf("%02d", intval($vlength % 60)));
                }
            }
            if ($special == 6) {
                $feed['images'][] = array('url' => VideoClient_Util::getThumbUrl($vid, 'small'), 'link' => "{$boardurl}viewthread.php?tid={$tid}");
            } else {
                if (in_array($attachments[1]['type'], array('image/gif', 'image/jpeg', 'image/png'))) {
                    $attachurl = preg_match("/^((https?|ftps?):\\/\\/|www\\.)/i", $attachurl) ? $attachurl : $boardurl . $attachurl;
                    $imgurl = $attachurl . '/' . $attachments[1]['attachment'] . ($attachments[1]['thumb'] && $attachments[1]['type'] != 'image/gif' ? '.thumb.jpg' : '');
                    $feed['images'][] = $attachments[1]['attachment'] ? array('url' => $imgurl, 'link' => "{$boardurl}viewthread.php?tid={$tid}") : array();
                }
            }
            if ($feed) {
                postfeed($feed);
            }
        }
        if ($digest) {
            foreach ($digestcredits as $id => $addcredits) {
                $postcredits[$id] = (isset($postcredits[$id]) ? $postcredits[$id] : 0) + $addcredits;
            }
        }
        updatepostcredits('+', $discuz_uid, $postcredits);
        $subject = str_replace("\t", ' ', $subject);
        $lastpost = "{$tid}\t{$subject}\t{$timestamp}\t{$author}";
        $db->query("UPDATE {$tablepre}forums SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'", 'UNBUFFERED');
        if ($forum['type'] == 'sub') {
            $db->query("UPDATE {$tablepre}forums SET lastpost='{$lastpost}' WHERE fid='{$forum['fup']}'", 'UNBUFFERED');
        }
        showmessage('post_newthread_succeed', "viewthread.php?tid={$tid}&extra={$extra}");
    }
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:newthread.inc.php

示例9: sendPost


//.........这里部分代码省略.........
             notification_add($atuid, 'at', 'at_message', 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));
     }
     $threadimageaid = 0;
     $threadimage = array();
     if ($special == 4 && $_GET['activityaid']) {
         $threadimageaid = $_GET['activityaid'];
         convertunusedattach($_GET['activityaid'], $tid, $pid);
     }
     if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) {
         foreach ($sortaids as $sortaid) {
             convertunusedattach($sortaid, $tid, $pid);
         }
     }
     if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) {
         updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']);
         if (!$threadimageaid) {
             $threadimage = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'tid', $tid);
             $threadimageaid = $threadimage['aid'];
         }
     }
     $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : '');
     $param = array();
     Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
     if ($_G['forum']['picstyle']) {
         if (!mobcent_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) {
         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']));
     }
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($isgroup ? 'groupthread' : $statarr[$special]);
     if ($modnewthreads) {
         updatemoderate('tid', $tid);
         C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_newthread_mod_succeed', array('noError' => 1));
         //showmessage('post_newthread_mod_succeed', $returnurl, $values, $param);
     } else {
         if ($displayorder >= 0 && helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) {
             require_once libfile('function/discuzcode');
             require_once libfile('function/followcode');
             $feedcontent = array('tid' => $tid, 'content' => followcode($message, $tid, $pid, 1000));
             C::t('forum_threadpreview')->insert($feedcontent);
             C::t('forum_thread')->update_status_by_tid($tid, '512');
             $followfeed = array('uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $tid, 'note' => '', 'dateline' => TIMESTAMP);
             $values['feedid'] = C::t('home_follow_feed')->insert($followfeed, true);
             C::t('common_member_count')->increase($_G['uid'], array('feeds' => 1));
         }
         $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array());
         if ($displayorder != -4) {
             if ($digest) {
                 updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']);
             }
             //updatepostcredits('+',  $_G['uid'], 'post', $_G['fid']);
             Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
             //Yii::import('application.components.discuz.source.function.function_post', true);
             mobcent_updatepostcredits('+', $_G['uid'], 'post', $_G['fid']);
             if ($isgroup) {
                 C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $subject);
             $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}";
             C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1);
             if ($_G['forum']['type'] == 'sub') {
                 C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($_G['forum']['status'] == 3) {
             C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($_G['fid'], $_G['uid']);
         }
         /*如果显示地理位置,入库到表里*/
         if ($jsonInfo['isShowPostion']) {
             $data = DB::query('INSERT INTO  %t VALUES(null,%f,%f,%d,%d,%s)', array('home_surrounding_user', $jsonInfo['longitude'], $jsonInfo['latitude'], $tid, 3, (string) $jsonInfo['location']));
         }
         /*  //客户端发表主题积分入库
                $temp = DB::fetch_first('SELECT extcredits3  FROM '.DB::table('common_credit_rule').' WHERE rid =%d ',array(1));
                $extcredits3 = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_member_count').' WHERE uid = %d',array($_G['uid']));
                $temp = $extcredits3['extcredits3'] + $temp['extcredits3'];
                DB::query('UPDATE '.DB::table('common_member_count').' set extcredits3 = %d WHERE uid = %d',array($temp,$_G['uid']));
             */
         //showmessage('post_newthread_succeed', $returnurl, $values, $param);
         // return array('rs'=>1,'errcode'=>WebUtils::t('发贴成功'));
         return $this->makeErrorInfo($res, 'mobcent_post_newthread_success', array('noError' => 1));
     }
 }
开发者ID:caidongyun,项目名称:CS,代码行数:101,代码来源:TopicAdminAction.php

示例10: foreach

             } else {
                 $ruidarray[$post['fid']][] = $post['authorid'];
             }
             $fids[$post['fid']] = $post['fid'];
         }
     }
     if ($tuidarray) {
         foreach ($tuidarray as $fid => $uids) {
             $_G['fid'] = $fid;
             updatepostcredits('-', $uids, 'post');
         }
     }
     if ($ruidarray) {
         foreach ($ruidarray as $fid => $uids) {
             $_G['fid'] = $fid;
             updatepostcredits('-', $uids, 'reply');
         }
     }
     require_once libfile('function/delete');
     deletethread($moderate);
     DB::query("DELETE FROM " . DB::table('forum_postcomment') . " WHERE {$tidsadd} AND authorid='{$space['uid']}'");
     foreach ($fids as $fid) {
         updateforumcount(intval($fid));
     }
     foreach ($moderate as $tid) {
         my_thread_log('delete', array('tid' => $tid));
     }
     $_G['cache']['space_thread'][$alltype] = array();
     save_syscache('space_thread', $_G['cache']['space_thread']);
     showmessage('thread_delete_succeed', 'home.php?mod=space&uid=' . $space['uid'] . '&do=thread&view=all');
 }
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:31,代码来源:space_thread.php

示例11: deletepost

 public function deletepost($parameters)
 {
     $this->_init_parameters($parameters);
     if (!$this->setting['editperdel']) {
         return $this->showmessage('post_edit_thread_ban_del', NULL);
     }
     $isfirstpost = $this->post['first'] ? 1 : 0;
     if ($isfirstpost && $this->thread['replies'] > 0) {
         return $this->showmessage($this->thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply', NULL);
     }
     if ($this->thread['displayorder'] >= 0) {
         updatepostcredits('-', $this->post['authorid'], $isfirstpost ? 'post' : 'reply', $this->forum['fid']);
     }
     if (!$this->param['handlereplycredit']) {
         if (!$isfirstpost && !$this->param['isanonymous']) {
             $postreplycredit = C::t('forum_post')->fetch('tid:' . $this->thread['tid'], $this->post['pid']);
             $postreplycredit = $postreplycredit['replycredit'];
             if ($postreplycredit) {
                 C::t('forum_post')->update('tid:' . $this->thread['tid'], $this->post['pid'], array('replycredit' => 0));
                 updatemembercount($this->post['authorid'], array($replycredit_rule['extcreditstype'] => '-' . $postreplycredit));
             }
         }
     }
     C::t('forum_post')->delete('tid:' . $this->thread['tid'], $this->post['pid']);
     $forumcounter = array();
     if ($isfirstpost) {
         $forumcounter['threads'] = $forumcounter['posts'] = -1;
         $tablearray = array('forum_relatedthread', 'forum_debate', 'forum_debatepost', 'forum_polloption', 'forum_poll');
         foreach ($tablearray as $table) {
             C::t($table)->delete_by_tid($this->thread['tid']);
         }
         C::t('forum_thread')->delete_by_tid($this->thread['tid']);
         C::t('common_moderate')->delete($this->thread['tid'], 'tid');
         C::t('forum_threadmod')->delete_by_tid($this->thread['tid']);
         if ($this->setting['globalstick'] && in_array($this->thread['displayorder'], array(2, 3))) {
             require_once libfile('function/cache');
             updatecache('globalstick');
         }
     } else {
         $forumcounter['posts'] = -1;
         $lastpost = C::t('forum_post')->fetch_visiblepost_by_tid('tid:' . $this->thread['tid'], $this->thread['tid'], 0, 1);
         $lastpost['author'] = !$lastpost['anonymous'] ? addslashes($lastpost['author']) : '';
         $this->param['updatefieldarr']['replies'] = -1;
         $this->param['updatefieldarr']['lastposter'] = array($lastpost['author']);
         $this->param['updatefieldarr']['lastpost'] = array($lastpost['dateline']);
         C::t('forum_thread')->increase($this->thread['tid'], $this->param['updatefieldarr']);
     }
     $this->forum['lastpost'] = explode("\t", $this->forum['lastpost']);
     if ($this->post['dateline'] == $this->forum['lastpost'][2] && ($this->post['author'] == $this->forum['lastpost'][3] || $this->forum['lastpost'][3] == '' && $this->post['anonymous'])) {
         $lastthread = C::t('forum_thread')->fetch_by_fid_displayorder($this->forum['fid']);
         C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => "{$lastthread['tid']}\t{$lastthread['subject']}\t{$lastthread['lastpost']}\t{$lastthread['lastposter']}"));
     }
     C::t('forum_forum')->update_forum_counter($this->forum['fid'], $forumcounter['threads'], $forumcounter['posts']);
 }
开发者ID:MCHacker,项目名称:docker-discuz,代码行数:54,代码来源:model_forum_post.php

示例12: 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) {
//.........这里部分代码省略.........
开发者ID:pan289091315,项目名称:Discuz,代码行数:101,代码来源:function_delete.php

示例13: updatepostcredits

     } else {
         if ($post['first']) {
             $tuidarray[] = $post['authorid'];
         } else {
             $ruidarray[] = $post['authorid'];
         }
     }
 }
 if ($uidarray) {
     updatepostcredits('-', $uidarray, array());
 }
 if ($tuidarray) {
     updatepostcredits('-', $tuidarray, $postcredits);
 }
 if ($ruidarray) {
     updatepostcredits('-', $ruidarray, $replycredits);
 }
 $modaction = 'DEL';
 if ($forum['recyclebin']) {
     $db->query("UPDATE {$tablepre}threads SET displayorder='-1', digest='0', moderated='1' WHERE tid IN ({$moderatetids})");
     $db->query("UPDATE {$tablepre}posts SET invisible='-1' WHERE tid IN ({$moderatetids})");
 } else {
     $auidarray = array();
     $query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid IN ({$moderatetids})");
     while ($attach = $db->fetch_array($query)) {
         dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
         if ($attach['dateline'] > $losslessdel) {
             $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1;
         }
     }
     if ($auidarray) {
开发者ID:lilhorse,项目名称:cocoa,代码行数:31,代码来源:moderation.inc.php

示例14: getposttableid

        $thread['views'] = $thread['replies'] = $thread['highlight'] = $thread['digest'] = 0;
        $thread['rate'] = $thread['displayorder'] = $thread['attachment'] = 0;
        $posttableid = getposttableid('p');
        $thread['posttableid'] = $posttableid;
        $threadid = DB::insert('forum_thread', $thread, true);
        $posttable = getposttablebytid($_G['tid']);
        if ($post = DB::fetch_first("SELECT * FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND first=1 LIMIT 1")) {
            $post['pid'] = '';
            $post['tid'] = $threadid;
            $post['fid'] = $copyto;
            $post['dateline'] = TIMESTAMP;
            $post['attachment'] = 0;
            $post['invisible'] = $post['rate'] = $post['ratetimes'] = 0;
            $pid = insertpost($post);
        }
        updatepostcredits('+', $post['authorid'], 'post', $_G['fid']);
        updateforumcount($copyto);
        updateforumcount($_G['fid']);
        $modpostsnum++;
        $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_copy') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'threadid' => $threadid), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other));
    }
} elseif ($_G['gp_action'] == 'removereward' && $_G['group']['allowremovereward']) {
    if (!submitcheck('modsubmit')) {
        include template('forum/topicadmin_action');
    } else {
        if (!is_array($thread) || $thread['special'] != '3') {
            showmessage('reward_end');
        }
        $modaction = 'RMR';
        $reason = checkreasonpm();
        $answererid = DB::result_first("SELECT uid FROM " . DB::table('common_credit_log') . " WHERE operation='RAC' AND relatedid='{$thread['tid']}'");
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:31,代码来源:forum_topicadmin.php

示例15: deletethread

function deletethread($tids, $membercount = false, $credit = false, $ponly = false)
{
    global $_G;
    if ($_G['setting']['plugins']['func'][HOOKTYPE]['deletethread']) {
        $_G['deletethreadtids'] =& $tids;
        $hookparam = func_get_args();
        hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'deletethread');
    }
    if (!$tids) {
        return 0;
    }
    $count = count($tids);
    $arrtids = $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);
    }
    C::t('common_moderate')->delete($arrtids, 'tid');
    C::t('forum_threadclosed')->delete($arrtids);
    $cachefids = $atids = $fids = $postids = $threadtables = array();
    foreach ($threadtableids as $tableid) {
        foreach (C::t('forum_thread')->fetch_all_by_tid($arrtids, 0, 0, $tableid) as $row) {
            $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;
            }
            $cachefids[$row['fid']] = $row['fid'];
        }
        if (!$tableid && !$ponly) {
            $threadtables[] = $tableid;
        }
    }
    if ($credit || $membercount) {
        $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0;
        $postlist = $uidarray = $tuidarray = $ruidarray = array();
        foreach ($postids as $posttableid => $posttabletids) {
            foreach (C::t('forum_post')->fetch_all_by_tid($posttableid, $posttabletids, false) as $post) {
                if ($post['invisible'] != -1 && $post['invisible'] != -5) {
                    $postlist[] = $post;
                }
            }
        }
        foreach (C::t('forum_replycredit')->fetch_all($arrtids) as $rule) {
            $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[getattachtableid($tid)][] = $tid;
            }
            foreach ($attachtables as $attachtable => $attachtids) {
                foreach (C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'tid', $attachtids) as $attach) {
                    if ($attach['dateline'] > $losslessdel) {
                        $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1;
                    }
//.........这里部分代码省略.........
开发者ID:softhui,项目名称:discuz,代码行数:101,代码来源:function_delete.php


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