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


PHP update_threadpartake函数代码示例

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


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

示例1: _setThreadSupport

 private function _setThreadSupport($res, $tid, $action)
 {
     global $_G;
     require_once libfile('function/forum');
     dsetcookie('discuz_recommend', '', -1, 0);
     $thread = C::t('forum_thread')->fetch($tid);
     if (!$_G['setting']['recommendthread']['status'] || !$_G['group']['allowrecommend']) {
         return $this->makeErrorInfo($res, 'no_privilege_recommend');
     }
     if ($thread['authorid'] == $_G['uid'] && !$_G['setting']['recommendthread']['ownthread']) {
         return $this->makeErrorInfo($res, 'recommend_self_disallow', array('{recommendc}' => $thread['recommends']));
     }
     if (C::t('forum_memberrecommend')->fetch_by_recommenduid_tid($_G['uid'], $tid)) {
         return $this->makeErrorInfo($res, 'recommend_duplicate', array('{recommendc}' => $thread['recommends']));
     }
     $recommendcount = C::t('forum_memberrecommend')->count_by_recommenduid_dateline($_G['uid'], $_G['timestamp'] - 86400);
     if ($_G['setting']['recommendthread']['daycount'] && $recommendcount >= $_G['setting']['recommendthread']['daycount']) {
         return $this->makeErrorInfo($res, 'recommend_outoftimes', array('{recommendc}' => $thread['recommends']));
     }
     $_G['group']['allowrecommend'] = intval($action == 'support' ? $_G['group']['allowrecommend'] : -$_G['group']['allowrecommend']);
     $fieldarr = array();
     if ($action == 'support') {
         $heatadd = 'recommend_add=recommend_add+1';
         $fieldarr['recommend_add'] = 1;
     } else {
         $heatadd = 'recommend_sub=recommend_sub+1';
         $fieldarr['recommend_sub'] = 1;
     }
     update_threadpartake($tid);
     $fieldarr['heats'] = 0;
     $fieldarr['recommends'] = $_G['group']['allowrecommend'];
     C::t('forum_thread')->increase($tid, $fieldarr);
     C::t('forum_memberrecommend')->insert(array('tid' => $tid, 'recommenduid' => $_G['uid'], 'dateline' => $_G['timestamp']));
     dsetcookie('recommend', 1, 43200);
     $recommendv = $_G['group']['allowrecommend'] > 0 ? '+' . $_G['group']['allowrecommend'] : $_G['group']['allowrecommend'];
     if ($_G['setting']['recommendthread']['daycount']) {
         $daycount = $_G['setting']['recommendthread']['daycount'] - $recommendcount;
         $params = array('noError' => 1, '{recommendv}' => $recommendv, '{recommendc}' => $thread['recommends'], '{daycount}' => $daycount);
         return $this->makeErrorInfo($res, 'recommend_daycount_succeed', $params);
     } else {
         $params = array('noError' => 1, '{recommendv}' => $recommendv, '{recommendc}' => $thread['recommends']);
         return $this->makeErrorInfo($res, 'recommend_succed', $params);
     }
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:44,代码来源:SupportAction.php

示例2: showmessage

        showmessage('recommend_duplicate', '', array('recommendc' => $thread['recommends']), array('msgtype' => 3));
    }
    $recommendcount = C::t('forum_memberrecommend')->count_by_recommenduid_dateline($_G['uid'], $_G['timestamp'] - 86400);
    if ($_G['setting']['recommendthread']['daycount'] && $recommendcount >= $_G['setting']['recommendthread']['daycount']) {
        showmessage('recommend_outoftimes', '', array('recommendc' => $thread['recommends']), array('msgtype' => 3));
    }
    $_G['group']['allowrecommend'] = intval($_GET['do'] == 'add' ? $_G['group']['allowrecommend'] : -$_G['group']['allowrecommend']);
    $fieldarr = array();
    if ($_GET['do'] == 'add') {
        $heatadd = 'recommend_add=recommend_add+1';
        $fieldarr['recommend_add'] = 1;
    } else {
        $heatadd = 'recommend_sub=recommend_sub+1';
        $fieldarr['recommend_sub'] = 1;
    }
    update_threadpartake($_G['tid']);
    $fieldarr['heats'] = 0;
    $fieldarr['recommends'] = $_G['group']['allowrecommend'];
    C::t('forum_thread')->increase($_G['tid'], $fieldarr);
    C::t('forum_memberrecommend')->insert(array('tid' => $_G['tid'], 'recommenduid' => $_G['uid'], 'dateline' => $_G['timestamp']));
    dsetcookie('recommend', 1, 43200);
    $recommendv = $_G['group']['allowrecommend'] > 0 ? '+' . $_G['group']['allowrecommend'] : $_G['group']['allowrecommend'];
    if ($_G['setting']['recommendthread']['daycount']) {
        $daycount = $_G['setting']['recommendthread']['daycount'] - $recommendcount;
        showmessage('recommend_daycount_succed', '', array('recommendv' => $recommendv, 'recommendc' => $thread['recommends'], 'daycount' => $daycount), array('msgtype' => 3));
    } else {
        showmessage('recommend_succed', '', array('recommendv' => $recommendv, 'recommendc' => $thread['recommends']), array('msgtype' => 3));
    }
} elseif ($_GET['action'] == 'protectsort') {
    $tid = $_GET['tid'];
    $optionid = $_GET['optionid'];
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:31,代码来源:forum_misc.php

示例3: nl2br

 }
 $description = $extrajs = '';
 $description_show = nl2br($description);
 $fav_count = C::t('home_favorite')->count_by_id_idtype($id, $idtype);
 if (submitcheck('favoritesubmit') || ($type == 'forum' || $type == 'group' || $type == 'thread') && $_GET['formhash'] == FORMHASH) {
     $arr = array('uid' => intval($_G['uid']), 'idtype' => $idtype, 'id' => $id, 'spaceuid' => $spaceuid, 'title' => getstr($title, 255), 'description' => getstr($_POST['description'], '', 0, 0, 1), 'dateline' => TIMESTAMP);
     $favid = C::t('home_favorite')->insert($arr, true);
     if ($_G['setting']['cloud_status']) {
         $favoriteService = Cloud::loadClass('Service_Client_Favorite');
         $favoriteService->add($arr['uid'], $favid, $arr['id'], $arr['idtype'], $arr['title'], $arr['description'], TIMESTAMP);
     }
     switch ($type) {
         case 'thread':
             C::t('forum_thread')->increase($id, array('favtimes' => 1));
             require_once libfile('function/forum');
             update_threadpartake($id);
             break;
         case 'forum':
             C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
             $extrajs = '<script type="text/javascript">$("number_favorite_num").innerHTML = parseInt($("number_favorite_num").innerHTML)+1;$("number_favorite").style.display="";</script>';
             dsetcookie('nofavfid', '', -1);
             break;
         case 'blog':
             C::t('home_blog')->increase($id, $spaceuid, array('favtimes' => 1));
             break;
         case 'group':
             C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
             break;
         case 'album':
             C::t('home_album')->update_num_by_albumid($id, 1, 'favtimes', $spaceuid);
             break;
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:spacecp_favorite.php

示例4: cutstr

         }
     }
 }
 $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];
                 }
             }
         }
     }
     $totalv = '';
开发者ID:lemonstory,项目名称:bbs,代码行数:31,代码来源:post_newreply.php

示例5: replyPost

 private function replyPost($extract)
 {
     global $_G;
     extract($extract);
     // 获取主题和帖子要插入的状态信息
     $topicStatus = ForumUtils::getPostSendStatus('topic', $_GET['platType']);
     $postStatus = ForumUtils::getPostSendStatus('post', $_GET['platType']);
     //$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];
     //copy from dz source/include/post/post_newreply.php
     require_once libfile('function/forumlist');
     $isfirstpost = 0;
     $showthreadsorts = 0;
     $quotemessage = '';
     if (!$_G['uid'] && !(!$_G['forum']['replyperm'] && $_G['group']['allowreply'] || $_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm']))) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'replyperm_login_nopermission', array('{login}' => 1));
     } elseif (empty($_G['forum']['allowreply'])) {
         if (!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'replyperm_none_nopermission', array('{login}' => 1));
         } elseif ($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
             $msg = mobcent_showmessagenoperm('replyperm', $_G['forum']['fid']);
             return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
         }
     } elseif ($_G['forum']['allowreply'] == -1) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_forum_newreply_nopermission');
     }
     if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'replyperm_login_nopermission', array('{login}' => 1));
     }
     if (empty($thread)) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'thread_nonexistence');
     } elseif ($thread['price'] > 0 && $thread['special'] == 0 && !$_G['uid']) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']));
     }
     checklowerlimit('reply', 0, 1, $_G['forum']['fid']);
     if ($_G['setting']['commentnumber'] && !empty($_GET['comment'])) {
         if (!submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('submitcheck_error', NULL);
         }
         $post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']);
         if (!$post) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_nonexistence');
         }
         if ($thread['closed'] && !$_G['forum']['ismoderator'] && !$thread['isgroup']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_thread_closed');
         } elseif (!$thread['isgroup'] && ($post_autoclose = checkautoclose($thread))) {
             return WebUtils::makeErrorInfo_oldVersion($res, $post_autoclose, array('{autoclose}' => $_G['forum']['autoclose']));
         } elseif (checkflood()) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl', array('{floodctrl}' => $_G['setting']['floodctrl']));
         } elseif (checkmaxperhour('pid')) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl_posts_per_hour', array('posts_per_hour' => $_G['group']['maxpostsperhour']));
         }
         $commentscore = '';
         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) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
         }
         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']));
         C::t('forum_post')->update('tid:' . $_G['tid'], $_GET['pid'], array('comment' => 1));
         if (!empty($_G['uid'])) {
             Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
             mobcent_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];
                         }
                     }
                 }
             }
             $totalv = '';
             foreach ($totalcomment as $itemk => $itemv) {
                 $totalv .= strip_tags(trim($itemk)) . ': <i>' . floatval(sprintf('%1.1f', array_sum($itemv) / count($itemv))) . '</i> ';
             }
             if ($pcid) {
                 C::t('forum_postcomment')->update($pcid, array('comment' => $totalv, 'dateline' => TIMESTAMP + 1));
             } else {
                 C::t('forum_postcomment')->insert(array('tid' => $post['tid'], 'pid' => $post['pid'], 'author' => '', 'authorid' => '-1', 'dateline' => TIMESTAMP + 1, 'comment' => $totalv));
             }
         }
         C::t('forum_postcache')->delete($post['pid']);
         return WebUtils::makeErrorInfo_oldVersion($res, 'comment_add_succeed');
//.........这里部分代码省略.........
开发者ID:caidongyun,项目名称:CS,代码行数:101,代码来源:TopicAdminAction.php

示例6: newreply

 public function newreply($parameters)
 {
     $this->_init_parameters($parameters);
     if ($this->thread['closed'] && !$this->forum['ismoderator'] && !$this->thread['isgroup']) {
         return $this->showmessage('post_thread_closed');
     } elseif (!$this->thread['isgroup'] && ($post_autoclose = checkautoclose($this->thread))) {
         return $this->showmessage($post_autoclose, '', array('autoclose' => $this->forum['autoclose']));
     }
     if (trim($this->param['subject']) == '' && trim($this->param['message']) == '' && $this->thread['special'] != 2) {
         return $this->showmessage('post_sm_isnull');
     } elseif ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] == 2 && $this->group['allowposttrade'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     } elseif (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('pid')) {
         return $this->showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $this->group['maxpostsperhour']));
     }
     $heatthreadset = update_threadpartake($this->thread['tid'], true);
     $bbcodeoff = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $smileyoff = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $parseurloff = !empty($this->param['parseurloff']);
     $htmlon = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $usesig = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && !empty($this->param['isanonymous']) ? 1 : 0;
     $author = empty($this->param['isanonymous']) ? $this->member['username'] : '';
     list(, $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($this->thread['displayorder'] == -4) {
         $this->param['modnewreplies'] = 0;
     }
     $pinvisible = $this->param['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     if (!empty($this->param['noticetrimstr'])) {
         $this->param['message'] = $this->param['noticetrimstr'] . "\n\n" . $this->param['message'];
         $bbcodeoff = false;
     }
     $status = defined('IN_MOBILE') ? 8 : 0;
     if ($this->param['modstatus']) {
         foreach ($this->param['modstatus'] as $modbit => $modvalue) {
             $status = setstatus($modbit, $modvalue, $status);
         }
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->thread['tid'], 'first' => '0', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['timestamp'] ? $this->param['timestamp'] : getglobal('timestamp'), 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $pinvisible, 'anonymous' => $this->param['isanonymous'], 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'status' => $status));
     $this->param['updatethreaddata'] = $heatthreadset ? $heatthreadset : array();
     $this->param['maxposition'] = C::t('forum_post')->fetch_maxposition_by_tid($this->thread['posttableid'], $this->thread['tid']);
     $this->param['updatethreaddata'][] = DB::field('maxposition', $this->param['maxposition']);
     useractionlog($this->member['uid'], 'pid');
     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->thread['tid'], 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     $nauthorid = 0;
     if (!empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
         list($ac, $nauthorid) = explode('|', authcode($this->param['noticeauthor'], 'DECODE'));
         if ($nauthorid != $this->member['uid']) {
             if ($ac == 'q') {
                 notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->pid, 'from_idtype' => 'quote'));
             } elseif ($ac == 'r') {
                 notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
             }
         }
     }
     if ($this->thread['authorid'] != $this->member['uid'] && getstatus($this->thread['status'], 6) && empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
         $thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($this->thread['tid'], 0);
         notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
     }
     $this->forum['threadcaches'] && deletethreadcaches($this->thread['tid']);
     include_once libfile('function/stat');
     updatestat($this->thread['isgroup'] ? 'grouppost' : 'post');
     $this->param['showmsgparam']['fid'] = $this->forum['fid'];
     $this->param['showmsgparam']['tid'] = $this->thread['tid'];
     $this->param['showmsgparam']['pid'] = $this->pid;
     $this->param['showmsgparam']['from'] = $this->param['from'];
     $this->param['showmsgparam']['sechash'] = !empty($this->param['sechash']) ? $this->param['sechash'] : '';
     dsetcookie('clearUserdata', 'forum');
     if ($this->thread['replies'] <= 0) {
         C::t('forum_sofa')->delete($this->thread['tid']);
     }
     if ($this->param['modnewreplies']) {
         updatemoderate('pid', $this->pid);
         unset($this->param['showmsgparam']['pid']);
         if ($this->param['updatethreaddata']) {
             C::t('forum_thread')->update($this->thread['tid'], $this->param['updatethreaddata'], false, false, 0, true);
         }
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1, 1);
         manage_addnotify('verifypost');
         return 'post_reply_mod_succeed';
     } else {
         $fieldarr = array('lastposter' => array($author), 'replies' => 1);
         if ($this->thread['lastpost'] < getglobal('timestamp')) {
             $fieldarr['lastpost'] = array(getglobal('timestamp'));
         }
         $row = C::t('forum_threadaddviews')->fetch($this->thread['tid']);
         if (!empty($row)) {
             C::t('forum_threadaddviews')->update($this->thread['tid'], array('addviews' => 0));
             $fieldarr['views'] = $row['addviews'];
         }
         $this->param['updatethreaddata'] = array_merge($this->param['updatethreaddata'], C::t('forum_thread')->increase($this->thread['tid'], $fieldarr, false, 0, true));
         if ($this->thread['displayorder'] != -4) {
//.........这里部分代码省略.........
开发者ID:MCHacker,项目名称:docker-discuz,代码行数:101,代码来源:model_forum_post.php

示例7: _viewRate


//.........这里部分代码省略.........
                }
            }
            $_GET = array_merge($_GET, $_POST);
        }
        global $_G;
        require_once libfile('function/misc');
        require_once libfile('function/forum');
        //今日剩余积分
        $maxratetoday = $this->_getratingleft($_G['group']['raterange']);
        $post = C::t('forum_post')->fetch('tid:' . $tid, $pid);
        $thread = C::t('forum_thread')->fetch($tid);
        if (!empty($_POST)) {
            $reason = checkreasonpm();
            $rate = $ratetimes = 0;
            $creditsarray = $sub_self_credit = array();
            getuserprofile('extcredits1');
            foreach ($_G['group']['raterange'] as $id => $rating) {
                $score = intval($_GET['score' . $id]);
                if (isset($_G['setting']['extcredits'][$id]) && !empty($score)) {
                    if ($rating['isself'] && intval($_G['member']['extcredits' . $id]) - $score < 0) {
                        //抱歉,您的{extcreditstitle}(评分栏目)不足,无法评分
                        $errorMsg = lang('message', 'thread_rate_range_self_invalid', array('extcreditstitle' => $_G['setting']['extcredits'][$id]['title']));
                        $this->_renderTemplates($tid, $pid, $errorMsg);
                        exit;
                    }
                    if (abs($score) <= $maxratetoday[$id]) {
                        if ($score > $rating['max'] || $score < $rating['min']) {
                            //请输入正确的分值
                            $errorMsg = lang('message', 'thread_rate_range_invalid');
                            $this->_renderTemplates($tid, $pid, $errorMsg);
                            exit;
                        } else {
                            $creditsarray[$id] = $score;
                            if ($rating['isself']) {
                                $sub_self_credit[$id] = -abs($score);
                            }
                            $rate += $score;
                            $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);
                        }
                    } else {
                        //抱歉,24 小时评分数超过限制
                        $errorMsg = lang('message', 'thread_rate_ctrl');
                        $this->_renderTemplates($tid, $pid, $errorMsg);
                        exit;
                    }
                }
            }
            if (!$creditsarray) {
                //请输入正确的分值
                $errorMsg = lang('message', 'thread_rate_range_invalid');
                $this->_renderTemplates($tid, $pid, $errorMsg);
                exit;
            }
            updatemembercount($post['authorid'], $creditsarray, 1, 'PRC', $_GET['pid']);
            if (!empty($sub_self_credit)) {
                updatemembercount($_G['uid'], $sub_self_credit, 1, 'RSC', $_GET['pid']);
            }
            C::t('forum_post')->increase_rate_by_pid('tid:' . $_G['tid'], $_GET['pid'], $rate, $ratetimes);
            if ($post['first']) {
                $threadrate = intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
                C::t('forum_thread')->update($_G['tid'], array('rate' => $threadrate));
            }
            require_once libfile('function/discuzcode');
            $sqlvalues = $comma = '';
            $sqlreason = censor(trim($_GET['reason']));
            $sqlreason = cutstr(dhtmlspecialchars($sqlreason), 40, '.');
            foreach ($creditsarray as $id => $addcredits) {
                $insertarr = array('pid' => $_GET['pid'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'extcredits' => $id, 'dateline' => $_G['timestamp'], 'score' => $addcredits, 'reason' => $sqlreason);
                C::t('forum_ratelog')->insert($insertarr);
            }
            include_once libfile('function/post');
            $_G['forum']['threadcaches'] && @deletethreadcaches($_G['tid']);
            $reason = dhtmlspecialchars(censor(trim($reason)));
            //对是否通知作者做的一些初始工作
            if ($_G['group']['resasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
                $forumname = strip_tags($_G['forum']['name']);
                $sendreasonpm = 1;
            } else {
                $sendreasonpm = 0;
            }
            if ($sendreasonpm) {
                $ratescore = $slash = '';
                foreach ($creditsarray as $id => $addcredits) {
                    $ratescore .= $slash . $_G['setting']['extcredits'][$id]['title'] . ' ' . ($addcredits > 0 ? '+' . $addcredits : $addcredits) . ' ' . $_G['setting']['extcredits'][$id]['unit'];
                    $slash = ' / ';
                }
                sendreasonpm($post, 'rate_reason', array('tid' => $thread['tid'], 'pid' => $_GET['pid'], 'subject' => $thread['subject'], 'ratescore' => $ratescore, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'rate'));
            }
            $logs = array();
            foreach ($creditsarray as $id => $addcredits) {
                $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$post['author']}\t{$id}\t{$addcredits}\t{$_G['tid']}\t{$thread['subject']}\t{$reason}");
            }
            update_threadpartake($post['tid']);
            C::t('forum_postcache')->delete($_GET['pid']);
            writelog('ratelog', $logs);
            //评分成功
            $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
        }
        $this->_renderTemplates($tid, $pid);
    }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:101,代码来源:TopicRateAction.php

示例8: showmessage

         showmessage('trade_price_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
     } elseif ($_G['group']['maxtradeprice'] && $item_credit > 0 && ($_G['group']['mintradeprice'] > $item_credit || $_G['group']['maxtradeprice'] < $item_credit)) {
         showmessage('trade_credit_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
     } elseif (!$_G['group']['maxtradeprice'] && $item_price > 0 && $_G['group']['mintradeprice'] > $item_price) {
         showmessage('trade_price_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice']));
     } elseif (!$_G['group']['maxtradeprice'] && $item_credit > 0 && $_G['group']['mintradeprice'] > $item_credit) {
         showmessage('trade_credit_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice']));
     } elseif ($item_price <= 0 && $item_credit <= 0) {
         showmessage('trade_pricecredit_need');
     } elseif ($_GET['item_number'] < 1) {
         showmessage('tread_please_number');
     }
 }
 $attentionon = empty($_GET['attention_add']) ? 0 : 1;
 $attentionoff = empty($attention_remove) ? 0 : 1;
 $heatthreadset = update_threadpartake($_G['tid'], true);
 if ($_G['group']['allowat']) {
     $atlist = $atlist_tmp = $ateduids = array();
     preg_match_all("/@([^\r\n]*?)\\s/i", $message . ' ', $atlist_tmp);
     $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']);
     $atnum = $maxselect = 0;
     foreach (C::t('home_notification')->fetch_all_by_authorid_fromid($_G['uid'], $_G['tid'], 'at') as $row) {
         $atnum++;
         $ateduids[$row[uid]] = $row['uid'];
     }
     $maxselect = $_G['group']['allowat'] - $atnum;
     if ($maxselect > 0 && !empty($atlist_tmp)) {
         if (empty($_G['setting']['at_anyone'])) {
             foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) {
                 if (!in_array($row['followuid'], $ateduids)) {
                     $atlist[$row[followuid]] = $row['fusername'];
开发者ID:softhui,项目名称:discuz,代码行数:31,代码来源:post_newreply.php

示例9: _userFavoriteSetting

 private function _userFavoriteSetting($res, $id, $idType)
 {
     global $_G;
     $uid = $_G['uid'];
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     $spaceuid = empty($_GET['spaceuid']) ? 0 : intval($_GET['spaceuid']);
     $title = '';
     switch ($idType) {
         case 'tid':
             $idType = 'tid';
             $thread = C::t('forum_thread')->fetch($id);
             $title = $thread['subject'];
             break;
         case 'fid':
             $idType = 'fid';
             $foruminfo = C::t('forum_forum')->fetch($id);
             loadcache('forums');
             $forum = $_G['cache']['forums'][$id];
             if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$_G['uid']}\t")) {
                 $title = $foruminfo['status'] != 3 ? $foruminfo['name'] : '';
                 // $icon = '<img src="static/image/feed/discuz.gif" alt="forum" class="vm" /> ';
             }
             break;
         case 'blog':
             $idType = 'blogid';
             $bloginfo = C::t('home_blog')->fetch($id);
             $title = $bloginfo['uid'] == $spaceuid ? $bloginfo['subject'] : '';
             break;
         case 'group':
             $idType = 'gid';
             $foruminfo = C::t('forum_forum')->fetch($id);
             $title = $foruminfo['status'] == 3 ? $foruminfo['name'] : '';
             break;
         case 'album':
             $idType = 'albumid';
             $result = C::t('home_album')->fetch($id, $spaceuid);
             $title = $result['albumname'];
             break;
         case 'space':
             $idType = 'uid';
             $_member = getuserbyuid($id);
             $title = $_member['username'];
             $unset($_member);
             break;
         case 'article':
             $idType = 'aid';
             $article = C::t('portal_article_title')->fetch($id);
             $title = $article['title'];
             break;
         default:
             break;
     }
     if (empty($title)) {
         return $this->makeErrorInfo($res, 'favorite_cannot_favorite');
     } else {
         $fav = C::t('home_favorite')->fetch_by_id_idtype($id, $idType, $uid);
         if ($fav) {
             $res = $this->makeErrorInfo($res, 'favorite_repeat');
         } else {
             $description = '';
             $description_show = nl2br($description);
             $fav_count = C::t('home_favorite')->count_by_id_idtype($id, $idType);
             require_once libfile('function/home');
             $description = WebUtils::t('用手机客户端收藏');
             $arr = array('uid' => intval($uid), 'idtype' => $idType, 'id' => $id, 'spaceuid' => $thread['authorid'], 'title' => getstr($title, 255), 'description' => getstr($description, '', 0, 0, 1), 'dateline' => TIMESTAMP);
             $favid = C::t('home_favorite')->insert($arr, true);
             if ($_G['setting']['cloud_status']) {
                 $favoriteService = Cloud::loadClass('Service_Client_Favorite');
                 $favoriteService->add($arr['uid'], $favid, $arr['id'], $arr['idtype'], $arr['title'], $arr['description'], TIMESTAMP);
             }
             switch ($idType) {
                 case 'tid':
                     C::t('forum_thread')->increase($id, array('favtimes' => 1));
                     require_once libfile('function/forum');
                     update_threadpartake($id);
                     break;
                 case 'fid':
                     C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
                     // $extrajs = '<script type="text/javascript">$("number_favorite_num").innerHTML = parseInt($("number_favorite_num").innerHTML)+1;$("number_favorite").style.display="";</script>';
                     dsetcookie('nofavfid', '', -1);
                     break;
                 case 'blog':
                     C::t('home_blog')->increase($id, $spaceuid, array('favtimes' => 1));
                     break;
                 case 'group':
                     C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
                     break;
                 case 'album':
                     C::t('home_album')->update_num_by_albumid($id, 1, 'favtimes', $spaceuid);
                     break;
                 case 'space':
                     C::t('common_member_status')->increase($id, array('favtimes' => 1));
                     break;
                 case 'article':
                     C::t('portal_article_count')->increase($id, array('favtimes' => 1));
                     break;
                 default:
                     break;
//.........这里部分代码省略.........
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:101,代码来源:UserFavoriteAction.php


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