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


PHP stringtopic函数代码示例

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


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

示例1: newthread

 public function newthread($parameters)
 {
     require_once libfile('function/post');
     $this->tid = $this->pid = 0;
     $this->_init_parameters($parameters);
     if (trim($this->param['subject']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     if (!$this->param['sortid'] && !$this->param['special'] && trim($this->param['message']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] || $this->param['sortid'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return $this->showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $this->group['maxthreadsperhour']));
     }
     $this->param['save'] = $this->member['uid'] ? $this->param['save'] : 0;
     $this->param['typeid'] = isset($this->param['typeid']) && isset($this->forum['threadtypes']['types'][$this->param['typeid']]) && (!$this->forum['threadtypes']['moderators'][$this->param['typeid']] || $this->forum['ismoderator']) ? $this->param['typeid'] : 0;
     $this->param['displayorder'] = $this->param['modnewthreads'] ? -2 : ($this->forum['ismoderator'] && $this->group['allowstickthread'] && !empty($this->param['sticktopic']) ? 1 : (empty($this->param['save']) ? 0 : -4));
     if ($this->param['displayorder'] == -2) {
         C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
     }
     $this->param['digest'] = $this->forum['ismoderator'] && $this->group['allowdigestthread'] && !empty($this->param['digest']) ? 1 : 0;
     $this->param['readperm'] = $this->group['allowsetreadperm'] ? $this->param['readperm'] : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && $this->param['isanonymous'] ? 1 : 0;
     $this->param['price'] = intval($this->param['price']);
     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']) {
//.........这里部分代码省略.........
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:101,代码来源:model_forum_thread.php

示例2: threadsortshow

function threadsortshow($sortid, $tid)
{
    global $_G;
    loadcache(array('threadsort_option_' . $sortid, 'threadsort_template_' . $sortid));
    $sortoptionarray = $_G['cache']['threadsort_option_' . $sortid];
    $templatearray = $_G['cache']['threadsort_template_' . $sortid];
    $threadsortshow = $optiondata = $searchtitle = $searchvalue = $searchunit = $memberinfofield = $_G['forum_option'] = array();
    $sql = "SELECT p.pid,p.fid,p.authorid FROM " . DB::table('forum_post') . " p WHERE p.tid =" . $tid . " and p.position=1 LIMIT 0, 1";
    $query = DB::query($sql);
    $vanfon_tid = 0;
    $vanfon_fid = 0;
    $vanfon_uid = 0;
    while ($result = DB::fetch($query)) {
        $vanfon_tid = $result['pid'];
        $vanfon_fid = $result['fid'];
        $vanfon_uid = $result['authorid'];
    }
    $vanfon_verify = '';
    $verifyuids = array();
    $verifyuids[$vanfon_uid] = $vanfon_uid;
    foreach (C::t('common_member_verify')->fetch_all($verifyuids) as $value) {
        foreach ($_G['setting']['verify'] as $vid => $vsetting) {
            if ($vsetting['available'] && $vsetting['showicon'] && $value['verify' . $vid] == 1) {
                $srcurl = '';
                if (!empty($vsetting['icon'])) {
                    $srcurl = $vsetting['icon'];
                }
                $vanfon_verify .= "<a href=\"home.php?mod=spacecp&ac=profile&op=verify&vid={$vid}\" target=\"_blank\">" . (!empty($srcurl) ? '<img src="' . $srcurl . '" class="vm" alt="' . $vsetting['title'] . '" title="' . $vsetting['title'] . '" />' : $vsetting['title']) . '</a>';
            } else {
                /*$srcurl = '';
                		$srcurl =   $vsetting['unverifyicon'];
                			$vanfon_verify .= "<a href=\"home.php?mod=spacecp&ac=profile&op=verify&vid=$vid\" target=\"_blank\">".(!empty($srcurl) ? '<img src="'.$srcurl.'" class="vm" alt="'.$vsetting['title'].'" title="'.$vsetting['title'].'" />' : $vsetting['title']).'</a>';*/
            }
        }
    }
    $sql = "SELECT m.groupid,g.icon FROM " . DB::table('common_member') . " m ," . DB::table('common_usergroup') . " g WHERE m.uid =" . $vanfon_uid . " and m.groupid=g.groupid LIMIT 0, 1";
    $query = DB::query($sql);
    $vanfon_usergroup = 0;
    while ($result = DB::fetch($query)) {
        $vanfon_usergroup = $result['icon'];
    }
    if ($sortoptionarray) {
        foreach (C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($tid) as $option) {
            $optiondata[$option['optionid']]['value'] = $option['value'];
            $optiondata[$option['optionid']]['expiration'] = $option['expiration'] && $option['expiration'] <= TIMESTAMP ? 1 : 0;
            $sortdataexpiration = $option['expiration'];
        }
        foreach ($sortoptionarray as $optionid => $option) {
            $_G['forum_option'][$option['identifier']]['title'] = $option['title'];
            $_G['forum_option'][$option['identifier']]['unit'] = $option['unit'];
            $_G['forum_option'][$option['identifier']]['type'] = $option['type'];
            if ($option['expiration'] && !$optiondata[$optionid]['expiration'] || empty($option['expiration'])) {
                if (!protectguard($option['protect'])) {
                    if ($option['type'] == 'checkbox') {
                        $_G['forum_option'][$option['identifier']]['value'] = '';
                        foreach (explode("\t", $optiondata[$optionid]['value']) as $choiceid) {
                            $_G['forum_option'][$option['identifier']]['value'] .= $option['choices'][$choiceid] . '&nbsp;';
                        }
                    } elseif ($option['type'] == 'radio') {
                        $_G['forum_option'][$option['identifier']]['value'] = $option['choices'][$optiondata[$optionid]['value']];
                    } elseif ($option['type'] == 'select') {
                        $tmpchoiceid = $tmpidentifiervalue = array();
                        foreach (explode('.', $optiondata[$optionid]['value']) as $choiceid) {
                            $tmpchoiceid[] = $choiceid;
                            $tmpidentifiervalue[] = $option['choices'][implode('.', $tmpchoiceid)];
                        }
                        $_G['forum_option'][$option['identifier']]['value'] = implode(' &raquo; ', $tmpidentifiervalue);
                        unset($tmpchoiceid, $tmpidentifiervalue);
                    } elseif ($option['type'] == 'image') {
                        $imgoptiondata = dunserialize($optiondata[$optionid]['value']);
                        $threadsortshow['sortaids'][] = $imgoptiondata['aid'];
                        if (empty($templatearray['viewthread'])) {
                            $maxwidth = $option['maxwidth'] ? 'width="' . $option['maxwidth'] . '"' : '';
                            $maxheight = $option['maxheight'] ? 'height="' . $option['maxheight'] . '"' : '';
                            if (!defined('IN_MOBILE')) {
                                $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? "<img src=\"" . $imgoptiondata['url'] . "\" onload=\"thumbImg(this)\" {$maxwidth} {$maxheight} border=\"0\">" : '';
                            } else {
                                $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? "<a href=\"" . $imgoptiondata['url'] . "\" target=\"_blank\">" . lang('forum/misc', 'click_view') . "</a>" : '';
                            }
                        } else {
                            $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? $imgoptiondata['url'] : './static/image/common/nophoto.gif';
                        }
                    } elseif ($option['type'] == 'face') {
                        $faceoptiondata = dunserialize($optiondata[$optionid]['value']);
                        $_G['forum_option'][$option['identifier']]['value'] = "forum.php?mod=attachment&aid=" . aidencode($faceoptiondata['aid']);
                        $attach = C::t('forum_attachment')->fetch($faceoptiondata['aid']);
                        $_G['forum_option'][$option['identifier']]['downloads'] = $attach['downloads'];
                        $threadsortshow['sortaids'][] = $faceoptiondata['aid'];
                    } elseif ($option['type'] == 'url') {
                        $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? "<a href=\"" . $optiondata[$optionid]['value'] . "\" target=\"_blank\">" . $optiondata[$optionid]['value'] . "</a>" : '';
                    } elseif ($option['type'] == 'number') {
                        $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'];
                    } else {
                        if ($option['protect']['status'] && $optiondata[$optionid]['value']) {
                            $optiondata[$optionid]['value'] = $option['protect']['mode'] == 1 ? '<image src="' . stringtopic($optiondata[$optionid]['value']) . '">' : (!defined('IN_MOBILE') ? '<span id="sortmessage_' . $option['identifier'] . '"><a href="###" onclick="ajaxget(\'forum.php?mod=misc&action=protectsort&tid=' . $tid . '&optionid=' . $optionid . '\', \'sortmessage_' . $option['identifier'] . '\');return false;">' . lang('forum/misc', 'click_view') . '</a></span>' : $optiondata[$optionid]['value']);
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? $optiondata[$optionid]['value'] : $option['defaultvalue'];
                        } elseif ($option['type'] == 'textarea') {
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? nl2br($optiondata[$optionid]['value']) : '';
                        } else {
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? $optiondata[$optionid]['value'] : $option['defaultvalue'];
//.........这里部分代码省略.........
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:101,代码来源:function_threadsort_bakfavicon.php

示例3: threadsortshow

function threadsortshow($sortid, $tid)
{
    global $_G;
    loadcache(array('threadsort_option_' . $sortid, 'threadsort_template_' . $sortid));
    $sortoptionarray = $_G['cache']['threadsort_option_' . $sortid];
    $templatearray = $_G['cache']['threadsort_template_' . $sortid];
    $threadsortshow = $optiondata = $searchtitle = $searchvalue = $searchunit = $memberinfofield = $_G['forum_option'] = array();
    if ($sortoptionarray) {
        foreach (C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($tid) as $option) {
            $optiondata[$option['optionid']]['value'] = $option['value'];
            $optiondata[$option['optionid']]['expiration'] = $option['expiration'] && $option['expiration'] <= TIMESTAMP ? 1 : 0;
            $sortdataexpiration = $option['expiration'];
        }
        foreach ($sortoptionarray as $optionid => $option) {
            $_G['forum_option'][$option['identifier']]['title'] = $option['title'];
            $_G['forum_option'][$option['identifier']]['unit'] = $option['unit'];
            $_G['forum_option'][$option['identifier']]['type'] = $option['type'];
            if ($option['expiration'] && !$optiondata[$optionid]['expiration'] || empty($option['expiration'])) {
                if (!protectguard($option['protect'])) {
                    if ($option['type'] == 'checkbox') {
                        $_G['forum_option'][$option['identifier']]['value'] = '';
                        foreach (explode("\t", $optiondata[$optionid]['value']) as $choiceid) {
                            $_G['forum_option'][$option['identifier']]['value'] .= $option['choices'][$choiceid] . '&nbsp;';
                        }
                    } elseif ($option['type'] == 'radio') {
                        $_G['forum_option'][$option['identifier']]['value'] = $option['choices'][$optiondata[$optionid]['value']];
                    } elseif ($option['type'] == 'select') {
                        $tmpchoiceid = $tmpidentifiervalue = array();
                        foreach (explode('.', $optiondata[$optionid]['value']) as $choiceid) {
                            $tmpchoiceid[] = $choiceid;
                            $tmpidentifiervalue[] = $option['choices'][implode('.', $tmpchoiceid)];
                        }
                        $_G['forum_option'][$option['identifier']]['value'] = implode(' &raquo; ', $tmpidentifiervalue);
                        unset($tmpchoiceid, $tmpidentifiervalue);
                    } elseif ($option['type'] == 'image') {
                        $imgoptiondata = dunserialize($optiondata[$optionid]['value']);
                        $threadsortshow['sortaids'][] = $imgoptiondata['aid'];
                        if (empty($templatearray['viewthread'])) {
                            $maxwidth = $option['maxwidth'] ? 'width="' . $option['maxwidth'] . '"' : '';
                            $maxheight = $option['maxheight'] ? 'height="' . $option['maxheight'] . '"' : '';
                            if (!defined('IN_MOBILE')) {
                                $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? "<img src=\"" . $imgoptiondata['url'] . "\" onload=\"thumbImg(this)\" {$maxwidth} {$maxheight} border=\"0\">" : '';
                            } else {
                                $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? "<a href=\"" . $imgoptiondata['url'] . "\" target=\"_blank\">" . lang('forum/misc', 'click_view') . "</a>" : '';
                            }
                        } else {
                            $_G['forum_option'][$option['identifier']]['value'] = $imgoptiondata['url'] ? $imgoptiondata['url'] : './static/image/common/nophoto.gif';
                        }
                    } elseif ($option['type'] == 'url') {
                        $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? "<a href=\"" . $optiondata[$optionid]['value'] . "\" target=\"_blank\">" . $optiondata[$optionid]['value'] . "</a>" : '';
                    } elseif ($option['type'] == 'number') {
                        $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'];
                    } else {
                        if ($option['protect']['status'] && $optiondata[$optionid]['value']) {
                            $optiondata[$optionid]['value'] = $option['protect']['mode'] == 1 ? '<image src="' . stringtopic($optiondata[$optionid]['value']) . '">' : (!defined('IN_MOBILE') ? '<span id="sortmessage_' . $option['identifier'] . '"><a href="###" onclick="ajaxget(\'forum.php?mod=misc&action=protectsort&tid=' . $tid . '&optionid=' . $optionid . '\', \'sortmessage_' . $option['identifier'] . '\');return false;">' . lang('forum/misc', 'click_view') . '</a></span>' : $optiondata[$optionid]['value']);
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] ? $optiondata[$optionid]['value'] : $option['defaultvalue'];
                        } elseif ($option['type'] == 'textarea') {
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] != '' ? nl2br($optiondata[$optionid]['value']) : '';
                        } else {
                            $_G['forum_option'][$option['identifier']]['value'] = $optiondata[$optionid]['value'] != '' ? $optiondata[$optionid]['value'] : $option['defaultvalue'];
                        }
                    }
                } else {
                    if (empty($option['permprompt'])) {
                        $_G['forum_option'][$option['identifier']]['value'] = lang('forum/misc', 'view_noperm');
                    } else {
                        $_G['forum_option'][$option['identifier']]['value'] = $option['permprompt'];
                    }
                }
            } else {
                $_G['forum_option'][$option['identifier']]['value'] = lang('forum/misc', 'has_expired');
            }
        }
        $typetemplate = '';
        if ($templatearray['viewthread']) {
            foreach ($sortoptionarray as $option) {
                $searchtitle[] = '/{(' . $option['identifier'] . ')}/e';
                $searchvalue[] = '/\\[(' . $option['identifier'] . ')value\\]/e';
                $searchvalue[] = '/{(' . $option['identifier'] . ')_value}/e';
                $searchunit[] = '/\\[(' . $option['identifier'] . ')unit\\]/e';
                $searchunit[] = '/{(' . $option['identifier'] . ')_unit}/e';
            }
            $threadexpiration = $sortdataexpiration ? dgmdate($sortdataexpiration) : lang('forum/misc', 'never_expired');
            $typetemplate = preg_replace(array("/\\{expiration\\}/i"), array($threadexpiration), stripslashes($templatearray['viewthread']));
            $typetemplate = preg_replace($searchtitle, "showoption('\\1', 'title')", $typetemplate);
            $typetemplate = preg_replace($searchvalue, "showoption('\\1', 'value')", $typetemplate);
            $typetemplate = preg_replace($searchunit, "showoption('\\1', 'unit')", $typetemplate);
        }
    }
    $threadsortshow['optionlist'] = !$optionexpiration ? $_G['forum_option'] : 'expire';
    $threadsortshow['typetemplate'] = $typetemplate;
    $threadsortshow['expiration'] = dgmdate($sortdataexpiration, 'd');
    return $threadsortshow;
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:94,代码来源:function_threadsort.php

示例4: viewthread_procpost


//.........这里部分代码省略.........
        $post['warned'] = ($post['status'] & 2) >> 1;
    } else {
        if (!$post['authorid']) {
            $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')) . '.x';
        }
    }
    $post['attachments'] = array();
    $post['imagelist'] = $post['attachlist'] = '';
    if ($post['attachment']) {
        if (!empty($_G['setting']['guestviewthumb']['flag']) && !$_G['uid'] || $_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) {
            $_G['forum_attachpids'][] = $post['pid'];
            $post['attachment'] = 0;
            if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $post['message'], $matchaids)) {
                $_G['forum_attachtags'][$post['pid']] = $matchaids[1];
            }
        } else {
            $post['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/i", '', $post['message']);
        }
    }
    if ($_G['setting']['ratelogrecord'] && $post['ratetimes']) {
        $_G['forum_cachepid'][$post['pid']] = $post['pid'];
    }
    if ($_G['setting']['commentnumber'] && ($post['first'] && $_G['setting']['commentfirstpost'] || !$post['first']) && $post['comment']) {
        $_G['forum_cachepid'][$post['pid']] = $post['pid'];
    }
    $post['allowcomment'] = $_G['setting']['commentnumber'] && in_array(1, $_G['setting']['allowpostcomment']) && ($_G['setting']['commentpostself'] || $post['authorid'] != $_G['uid']) && ($post['first'] && $_G['setting']['commentfirstpost'] && in_array($_G['group']['allowcommentpost'], array(1, 3)) || !$post['first'] && in_array($_G['group']['allowcommentpost'], array(2, 3)));
    $forum_allowbbcode = $_G['forum']['allowbbcode'] ? -$post['groupid'] : 0;
    $post['signature'] = $post['usesig'] ? $_G['setting']['sigviewcond'] ? strlen($post['message']) > $_G['setting']['sigviewcond'] ? $post['signature'] : '' : $post['signature'] : '';
    $imgcontent = $post['first'] ? getstatus($_G['forum_thread']['status'], 15) : 0;
    if (!defined('IN_ARCHIVER')) {
        if ($post['first']) {
            if (!defined('IN_MOBILE')) {
                $messageindex = false;
                if (strpos($post['message'], '[/index]') !== FALSE) {
                    $post['message'] = preg_replace("/\\s?\\[index\\](.+?)\\[\\/index\\]\\s?/ies", "parseindex('\\1', '{$post['pid']}')", $post['message']);
                    $messageindex = true;
                    unset($_GET['threadindex']);
                }
                if (strpos($post['message'], '[page]') !== FALSE) {
                    if ($_GET['cp'] != 'all') {
                        $postbg = '';
                        if (strpos($post['message'], '[/postbg]') !== FALSE) {
                            preg_match("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/is", $post['message'], $r);
                            $postbg = $r[0];
                        }
                        $messagearray = explode('[page]', $post['message']);
                        $cp = max(intval($_GET['cp']), 1);
                        $post['message'] = $messagearray[$cp - 1];
                        if ($postbg && strpos($post['message'], '[/postbg]') === FALSE) {
                            $post['message'] = $postbg . $post['message'];
                        }
                        unset($postbg);
                    } else {
                        $cp = 0;
                        $post['message'] = preg_replace("/\\s?\\[page\\]\\s?/is", '', $post['message']);
                    }
                    if ($_GET['cp'] != 'all' && strpos($post['message'], '[/index]') === FALSE && empty($_GET['threadindex']) && !$messageindex) {
                        $_G['forum_posthtml']['footer'][$post['pid']] .= '<div id="threadpage"></div><script type="text/javascript" reload="1">show_threadpage(' . $post['pid'] . ', ' . $cp . ', ' . count($messagearray) . ', ' . ($_GET['from'] == 'preview' ? '1' : '0') . ');</script>';
                    }
                }
            }
        }
        if (!empty($_GET['threadindex'])) {
            $_G['forum_posthtml']['header'][$post['pid']] .= '<div id="threadindex"></div><script type="text/javascript" reload="1">show_threadindex(0, ' . ($_GET['from'] == 'preview' ? '1' : '0') . ');</script>';
        }
        if (!$imgcontent) {
            $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $forum_allowbbcode, $_G['forum']['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0, $_G['forum']['allowhtml'], $_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0, 0, $post['authorid'], $_G['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_G['forum']['allowmediacode'], $post['pid'], $_G['setting']['lazyload'], $post['dbdateline'], $post['first']);
            if ($post['first']) {
                $_G['relatedlinks'] = '';
                $relatedtype = !$_G['forum_thread']['isgroup'] ? 'forum' : 'group';
                if (!$_G['setting']['relatedlinkstatus']) {
                    $_G['relatedlinks'] = get_related_link($relatedtype);
                } else {
                    $post['message'] = parse_related_link($post['message'], $relatedtype);
                }
                if (strpos($post['message'], '[/begin]') !== FALSE) {
                    $post['message'] = preg_replace("/\\[begin(=\\s*([^\\[\\<\r\n]*?)\\s*,(\\d*),(\\d*),(\\d*),(\\d*))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/begin\\]/ies", $_G['cache']['usergroups'][$post['groupid']]['allowbegincode'] ? "parsebegin('\\2', '\\7', '\\3', '\\4', '\\5', '\\6');" : '', $post['message']);
                }
            }
        }
    }
    if (defined('IN_ARCHIVER') || defined('IN_MOBILE') || !$post['first']) {
        if (strpos($post['message'], '[page]') !== FALSE) {
            $post['message'] = preg_replace("/\\s?\\[page\\]\\s?/is", '', $post['message']);
        }
        if (strpos($post['message'], '[/index]') !== FALSE) {
            $post['message'] = preg_replace("/\\s?\\[index\\](.+?)\\[\\/index\\]\\s?/is", '', $post['message']);
        }
        if (strpos($post['message'], '[/begin]') !== FALSE) {
            $post['message'] = preg_replace("/\\[begin(=\\s*([^\\[\\<\r\n]*?)\\s*,(\\d*),(\\d*),(\\d*),(\\d*))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/begin\\]/ies", '', $post['message']);
        }
    }
    if ($imgcontent) {
        $post['message'] = '<img id="threadimgcontent" src="./' . stringtopic('', $post['tid']) . '">';
    }
    $_G['forum_firstpid'] = intval($_G['forum_firstpid']);
    $post['numbercard'] = viewthread_numbercard($post);
    $post['mobiletype'] = getstatus($post['status'], 4) ? base_convert(getstatus($post['status'], 10) . getstatus($post['status'], 9) . getstatus($post['status'], 8), 2, 10) : 0;
    return $post;
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:101,代码来源:forum_viewthread.php

示例5: editpost

 public function editpost($parameters)
 {
     $this->_init_parameters($parameters);
     $isfirstpost = $this->post['first'] ? 1 : 0;
     $isorigauthor = $this->member['uid'] && $this->member['uid'] == $this->post['authorid'];
     $this->param['audit'] = $this->post['invisible'] == -2 || $this->thread['displayorder'] == -2 ? $this->param['audit'] : 0;
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $isfirstpost && ($this->param['special'] || $this->param['sortid']))) {
         showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (!$isorigauthor && !$this->group['allowanonymous']) {
         if ($this->post['anonymous'] && !$this->param['isanonymous']) {
             $this->param['isanonymous'] = 0;
             $this->param['threadupdatearr']['author'] = $this->post['author'];
             $anonymousadd = 0;
         } else {
             $this->param['isanonymous'] = $this->post['anonymous'];
             $anonymousadd = '';
         }
     } else {
         $this->param['threadupdatearr']['author'] = $this->param['isanonymous'] ? '' : $this->post['author'];
         $anonymousadd = $this->param['isanonymous'];
     }
     if ($isfirstpost) {
         if (trim($this->param['subject']) == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
         if (!$this->param['sortid'] && !$this->thread['special'] && trim($this->param['message']) == '') {
             showmessage('post_sm_isnull');
         }
         $publishdate = null;
         if ($this->group['allowsetpublishdate'] && $this->thread['displayorder'] == -4) {
             $cron_publish_ids = dunserialize($this->cache('cronpublish'));
             if (!$this->param['cronpublish'] && in_array($this->thread['tid'], $cron_publish_ids) || $this->param['modnewthreads']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = TIMESTAMP;
                 unset($cron_publish_ids[$this->thread['tid']]);
                 $cron_publish_ids = serialize($cron_publish_ids);
                 savecache('cronpublish', $cron_publish_ids);
             } elseif ($this->param['cronpublish'] && $this->param['cronpublishdate']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = strtotime($this->param['cronpublishdate']);
                 $this->param['save'] = 1;
                 if (!in_array($this->thread['tid'], $cron_publish_ids)) {
                     $cron_publish_ids[$this->thread['tid']] = $this->thread['tid'];
                     $cron_publish_ids = serialize($cron_publish_ids);
                     savecache('cronpublish', $cron_publish_ids);
                 }
             }
         }
         $this->param['readperm'] = $this->group['allowsetreadperm'] ? intval($this->param['readperm']) : ($isorigauthor ? 0 : 'ignore');
         if ($this->thread['special'] != 3) {
             $this->param['price'] = intval($this->param['price']);
             $this->param['price'] = $this->thread['price'] < 0 && !$this->thread['special'] ? $isorigauthor || !$this->param['price'] ? -1 : $this->param['price'] : ($this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] > 0 ? $this->param['price'] : 0 : $this->group['maxprice'] : ($isorigauthor ? $this->param['price'] : $this->thread['price']));
             if ($this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
                 return $this->showmessage('post_net_price_iszero');
             }
         }
         $this->thread['status'] = setstatus(4, $this->param['ordertype'], $this->thread['status']);
         $this->thread['status'] = setstatus(15, $this->param['imgcontent'], $this->thread['status']);
         if ($this->param['imgcontent']) {
             stringtopic($this->param['message'], $this->post['tid'], true, $this->param['imgcontentwidth']);
         }
         $this->thread['status'] = setstatus(2, $this->param['hiddenreplies'], $this->thread['status']);
         $this->thread['status'] = setstatus(6, $this->param['allownoticeauthor'] ? 1 : 0, $this->thread['status']);
         $displayorder = empty($this->param['save']) ? $this->thread['displayorder'] == -4 ? -4 : $this->thread['displayorder'] : -4;
         $this->param['threadupdatearr']['typeid'] = $this->param['typeid'];
         $this->param['threadupdatearr']['sortid'] = $this->param['sortid'];
         $this->param['threadupdatearr']['subject'] = $this->param['subject'];
         if ($this->param['readperm'] !== 'ignore') {
             $this->param['threadupdatearr']['readperm'] = $this->param['readperm'];
         }
         $this->param['threadupdatearr']['price'] = $this->param['price'];
         $this->param['threadupdatearr']['status'] = $this->thread['status'];
         if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
             $this->param['threadupdatearr']['displayorder'] = 0;
             $this->param['threadupdatearr']['moderated'] = 1;
         } else {
             $this->param['threadupdatearr']['displayorder'] = $displayorder;
         }
         C::t('forum_thread')->update($this->thread['tid'], $this->param['threadupdatearr'], true);
         if ($this->thread['tid'] > 1) {
             if ($this->thread['closed'] > 1) {
                 C::t('forum_thread')->update($this->thread['closed'], array('subject' => $this->param['subject']), true);
             } elseif (empty($this->thread['isgroup'])) {
                 $threadclosed = C::t('forum_threadclosed')->fetch($thread['tid']);
                 if ($threadclosed['redirect']) {
                     C::t('forum_thread')->update($threadclosed['redirect'], array('subject' => $this->param['subject']), true);
                 }
             }
         }
         $class_tag = new tag();
         $tagstr = $class_tag->update_field($this->param['tags'], $this->thread['tid'], 'tid', $this->thread);
     } else {
         if ($this->param['subject'] == '' && $this->param['message'] == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
     }
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     if ($this->setting['editedby'] && TIMESTAMP - $this->post['dateline'] > 60 && $this->member['adminid'] != 1) {
         $editor = $this->param['isanonymous'] && $isorigauthor ? lang('forum/misc', 'anonymous') : $this->member['username'];
         $edittime = dgmdate(TIMESTAMP);
//.........这里部分代码省略.........
开发者ID:MCHacker,项目名称:docker-discuz,代码行数:101,代码来源:model_forum_post.php


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