首先,升级数据表,添加一个字段
- ALTER TABLE `pre_forum_thread` ADD `setpublishtime` INT( 10 ) NOT NULL DEFAULT '0'
复制代码
以下是文件修改操作:
template\default\forum\post.htm找到
- <!--{if $_G[gp_action] == 'edit' && $isorigauthor && ($isfirstpost && $thread['replies'] < 1 || !$isfirstpost) && !$rushreply && $_G['setting']['editperdel']}-->
复制代码 上面加
- <!--{if $_G[gp_action] == 'newthread' || ($_G[gp_action] == 'edit' && $isfirstpost) && $_G['adminid'] == '1' }-->
- <script type="text/javascript" src="static/js/calendar.js"></script>
- <input type="text" class="px" name="setpublishtime" value="$thread[setpublishtime]" style="width: 25em;margin-top: 5px;" tabindex="1"> 定时发布时间设定 <font color="red">[仅管理员可见]</font>
- <!--{/if}-->
复制代码
source\include\post\post_editpost.php
找到
- $thread['freecharge'] = $_G['setting']['maxchargespan'] && TIMESTAMP - $thread['dateline'] >= $_G['setting']['maxchargespan'] * 3600 ? 1 : 0;
复制代码 下面加
- $thread['setpublishtime'] = $thread['setpublishtime'] ? dgmdate($thread['setpublishtime'], 'Y-m-d H:i') : '';
复制代码
找到
- $displayorder = empty($_G['gp_save']) ? ($thread['displayorder'] == -4 ? 0 : $thread['displayorder']) : -4;
复制代码 下面加
- $setpublishtime = ($_G['gp_setpublishtime'] && ($_G['adminid'] == '1')) ? strtotime($_G['gp_setpublishtime']) : 0;
复制代码 找到
- DB::query("UPDATE ".DB::table('forum_thread')." SET typeid='$typeid', sortid='$sortid', subject='$subject', readperm='$readperm', price='$price' $authoradd $polladd ".($_G['forum_auditstatuson'] && $audit == 1 ? ",displayorder='$displayorder', moderated='1'" : ",displayorder='$displayorder'").", status='$thread[status]'
复制代码
后加
- ,setpublishtime='$setpublishtime'
复制代码
source\include\post\post_newthread.php
找到
- $_G['gp_hiddenreplies'] && $thread['status'] = setstatus(2, 1, $thread['status']);
复制代码 下面加
- $setpublishtime = ($_G['gp_setpublishtime'] && ($_G['adminid'] == '1')) ? strtotime($_G['gp_setpublishtime']) : 0;
复制代码 找到
- DB::query("INSERT INTO ".DB::table('forum_thread')." (fid, posttableid, readperm, price, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated, status, isgroup
复制代码 后加
找到- VALUES ('$_G[fid]', '$posttableid', '$readperm', '$price', '$typeid', '$sortid', '$author', '$_G[uid]', '$subject', '$_G[timestamp]', '$_G[timestamp]', '$author', '$displayorder', '$digest', '$special', '0', '$moderated', '$thread[status]', '$isgroup'
复制代码 后加
template\default\forum\forumdisplay_list.htm找到
- <!--{if $_G[setting][forumseparator] == 1 && $separatepos == $key + 1}-->
复制代码
上加
- <!--{if ($thread['setpublishtime'] < $_G['timestamp']) || $_G[adminid] == '1' }-->
复制代码
找到
- <!--{/loop}-->
- <!--{else}-->
- <tbody><tr><th colspan="{if !$_G['gp_archiveid'] && $_G['forum']['ismoderator']}6{else}5{/if}"><p class="emp">{lang forum_nothreads}</p></th></tr></tbody>
复制代码
上加
source\module\forum\forum_viewthread.php
找到
- if(!$_G['forum_thread']) {
- showmessage('thread_nonexistence');
- }
复制代码
下加
- if(($_G['forum_thread']['setpublishtime'] > $_G['timestamp']) && ($_G['adminid'] !== '1') ) {
- showmessage('抱歉,该贴定时时间还未到,您无法查看其内容');
- }
复制代码
source\archiver\forum\forumdisplay.php找到
- <?php if($thread['isgroup'] == 0): ?>
复制代码
改成
- <?php if(($thread['isgroup'] == 0) && (($thread['setpublishtime'] < $_G['timestamp']) || $_G['adminid'] == '1')): ?>
复制代码
完成.
|