| 
 
插件发布
| 插件名称: | 帖子的副标题 For 6.1.0 080606 GBK |  
| 插件来源: |  |  
| 适用版本: | Discuz! 6.1 |  
| 语言编码: | GBK简体 |  
| 最后更新时间: |  |  
| 插件作者: | Barracuda |  
| 插件简介: | 可以选择性的给帖子添加副标题,限制了副标题最长90个字符, 超出了提示修改 |  
| 2008年7月24日前修改的请执行以下步骤修正 感谢wxyuan90指出
 解决方案:
 
 1.已经安装的请执行一次数据库升级
 2.修改post.php复制代码UPDATE cdb_posts SET exsubject = '';
UPDATE cdb_threads SET exsubject = '';
查找
 在后面加上复制代码require_once './include/common.inc.php';
复制内容到剪贴板代码:
 因为找不到人测试,所以这类问题也没太注意.修改了的就注意下吧.复制代码$exsubject = dhtmlspecialchars($exsubject);
 现在我人在外面,回去修正下实验室的问题.
 
 ======================我是无奈的分割线========================================
 
 新安装的用户直接从这里往下执行
 
 本来还是想测试一段时间才放出来的,但是没人帮助测试...算了...直接放吧,心凉了...
 BTW:没耐心改的朋友可以跳过这个修改了
 
 测试的走这里:
 http://www.jx4n.cn/dz/bbs/index.php
 随便灌...反正是我个人的实验室,只是不要发布那些违规的信息就可以了,我怕和我一个服务器的兄弟会遭殃
 
 支持的走这里:
 http://www.jx4n.com
 我自己在运营的站,希望大家多提意见和建议,另外有没有站长群能加下我,教我一些推广的问题...或者我有什么新的想法能够邀请到一些人来测试一下...
 
 下面是正题:
 本来对这个不是很感兴趣的...只是看到discuz!里很多人需要,就随手做了个出来...参考了这个地方
 https://discuz.dismall.com/viewthread.php?tid=360378
 对快速发帖栏的副标题我去掉了,不过快速发帖以后如果需要的话可以在编辑里加上.另外说一句,Discuz!6.1.0和Discuz!4.1.0的代码和实现方式差距还是挺大的.
 
 要修改的地方比较多,所以希望大家先备份以下文件
 
 ./topicadmin.php
 ./include/newthread.inc.php
 ./include/editpost.inc.php
 ./templates/default/templates.lang.php
 ./templates/default/post_newthread.htm
 ./templates/default/post_editpost.htm
 ./templates/default/forumdisplay.htm
 ./templates/default/viewthread.htm
 .include/javascript/post_editor.js
 
 为了大家尽量不出错,我把找到标记成了这样,替换为标记成了这样,下面加上标记成了这样...大家注意一下.
 
 备份好以后往下做:
 1.升级数据库
 2.打开./topicadmin.php复制代码ALTER TABLE `cdb_posts` ADD `exsubject` char(90) NOT NULL default '';
ALTER TABLE `cdb_threads` ADD `exsubject` char(90) NOT NULL default '';
找到
 替换成复制代码$firstpost = $db->fetch_first("SELECT pid, fid, authorid, author, subject, dateline FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline LIMIT 1");
再找到复制代码$firstpost = $db->fetch_first("SELECT pid, fid, authorid, author, subject, exsubject, dateline FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline LIMIT 1");
替换成复制代码$db->query("UPDATE {$tablepre}threads SET authorid='$firstpost[authorid]', author='".addslashes($firstpost['author'])."', subject='".addslashes($firstpost['subject'])."', dateline='$firstpost[dateline]', views=views+$other[views], replies=replies+$other[replies], moderated='1' WHERE tid='$tid'");
3.打开./include/newthread.inc.php复制代码$db->query("UPDATE {$tablepre}threads SET authorid='$firstpost[authorid]', author='".addslashes($firstpost['author'])."', subject='".addslashes($firstpost['subject'])."', exsubject='".addslashes($firstpost['exsubject'])."', dateline='$firstpost[dateline]', views=views+$other[views], replies=replies+$other[replies], moderated='1' WHERE tid='$tid'");
找到
 替换为复制代码$db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, subscribed, moderated)
再找到复制代码$db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, author, authorid, subject, exsubject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, subscribed, moderated)
替换为复制代码VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$author', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest', '$special', '$attachment', '$subscribed', '$moderated')");
再找到复制代码VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$author', '$discuz_uid', '$subject', '$exsubject', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest', '$special', '$attachment', '$subscribed', '$moderated')");
替换为复制代码$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)
再找到复制代码$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, exsubject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)
替换为复制代码VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$message', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
4.打开./include/editpost.inc.php复制代码VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$exsubject', '$timestamp', '$message', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
找到
 替换为复制代码$db->query("UPDATE {$tablepre}threads SET iconid='$iconid', typeid='$typeid', subject='$subject', readperm='$readperm', price='$price' $authoradd $polladd ".($auditstatuson && $audit == 1 ? ",displayorder='0', moderated='1'" : '')." WHERE tid='$tid'", 'UNBUFFERED');
再找到复制代码$db->query("UPDATE {$tablepre}threads SET iconid='$iconid', typeid='$typeid', subject='$subject', exsubject='$exsubject', readperm='$readperm', price='$price' $authoradd $polladd ".($auditstatuson && $audit == 1 ? ",displayorder='0', moderated='1'" : '')." WHERE tid='$tid'", 'UNBUFFERED');
替换为复制代码smileyoff='$smileyoff', subject='$subject' ".($pattachment ? ", attachment='1'" : '')." $anonymousadd ".($auditstatuson && $audit == 1 ? ",invisible='0'" : '')." WHERE pid='$pid'");
5.打开./templates/default/templates.lang.php复制代码smileyoff='$smileyoff', subject='$subject', exsubject='$exsubject' ".($pattachment ? ", attachment='1'" : '')." $anonymousadd ".($auditstatuson && $audit == 1 ? ",invisible='0'" : '')." WHERE pid='$pid'");
找到下面加上再找到
 下面加上复制代码'post_subject_toolong' => '您的标题超过 80 个字符的限制。',
6.打开./templates/default/post_newthread.htm复制代码'post_exsubject_toolong' => '您的副标题超过 90 个字符的限制。',
找到
 下面加上复制代码lang['post_subject_toolong'] = '{lang post_subject_toolong}';
再找到复制代码lang['post_exsubject_toolong'] = '{lang post_exsubject_toolong}';
下面加上复制代码                <tr>
                        <th style="border-bottom: 0"><label for="subject">{lang subject}</label></th>
                        <td style="border-bottom: 0">
                                $typeselect
                                <input type="text" name="subject" id="subject" size="45" value="$subject" tabindex="3" />
                        </td>
                </tr>
7.打开./templates/default/post_editpost.htm复制代码                <tr>
                        <th style="border-bottom: 0"><label for="exsubject">{lang exsubject}</label></th>
                        <td style="border-bottom: 0"><input type="text" name="exsubject" id="exsubject" size="56" value="$exsubject" tabindex="3" />
                        </td>
                </tr>
找到
 下面加上复制代码lang['post_subject_toolong'] = '{lang post_subject_toolong}';
再找到复制代码lang['post_exsubject_toolong'] = '{lang post_exsubject_toolong}';
下面加上复制代码<input type="hidden" name="origsubject" value="$postinfo[subject]" />
<!--{if $special == 6}-->
        <input type="hidden" name="subjectu8" value="" />
        <input type="hidden" name="tagsu8" value="" />
        <input type="hidden" name="vid" value="1" />
<!--{/if}-->
</td></tr>
8.打开./templates/default/forumdisplay.htm复制代码<!--{if $isfirstpost}-->
<tr>
<td class="altbg1" width="20%">{lang exsubject}:</td>
<td class="altbg2"> 
<input type="text" name="exsubject" size="56" value="$postinfo[exsubject]" tabindex="3">
<input type="hidden" name="origexsubject" value="$postinfo[exsubject]">
</td>
</tr>
<!--{/if}-->
找到
 下面加上复制代码<!--{if $thread['new']}-->
                                                <a href="redirect.php?tid=$thread[tid]&goto=newpost$highlight#newpost" 
class="new">New</a>
                                        <!--{/if}-->
再找到复制代码<!--{if $thread['exsubject']}--><br><span style="font-size:11px">$thread[exsubject]</span><!--{/if}-->
下面加上复制代码                else if(mb_strlen(theform.subject.value) > 80) {
                        alert("{lang post_subject_toolong}");
                        theform.subject.focus();
                        return false;
                }
9.打开./templates/default/viewthread.htm复制代码                else if(mb_strlen(theform.exsubject.value) > 90) {
                        alert("{lang post_exsubject_toolong}");
                        theform.exsubject.focus();
                        return false;
                }
找到
 替换成复制代码                <h1>$thread[subject]
                </h1>
10.打开.include/javascript/post_editor.js复制代码<h1>$thread[subject]<!--{if $thread['exsubject']}--> [ $thread[exsubject] ]<!--{/if}--></h1>
找到
 后面加上复制代码else if(mb_strlen(theform.subject.value) > 80) {
                alert(lang['post_subject_toolong']);
                theform.subject.focus();
                return false;
        }
11.修改post.php复制代码else if(mb_strlen(theform.exsubject.value) > 90) {
                alert(lang['post_exsubject_toolong']);
                theform.exsubject.focus();
                return false;
        }
查找
 在后面加上复制代码require_once './include/common.inc.php';
复制内容到剪贴板代码:
 然后就可以收工了...看了一天代码,眼睛都迷糊了...编辑了一下,好看多了...复制代码$exsubject = dhtmlspecialchars($exsubject);
 
 如果做好了的话实现不了的话,你可以选择仔细检查一次或者把备份好的文件替换回去,因为这次改的东西实在是太多了.就不会像我以前的那两个东西一样免费提供技术支持和协助安装了,实在是有需求的,但是又不会装的话,我可以考虑收RMB滴= =#还有请不要说这些东西密密麻麻...我改的人还需要从如此多的密密麻麻的东西找出相应的东西,告诉了你方法还不耐烦的话,我觉得你不太适合做这一行...谢谢...
 
 附我的另外俩个玩意
 添加wap发帖标记的方法:
 https://discuz.dismall.com/thread-970888-1-1.html
 类铁血水印添加:
 https://discuz.dismall.com/thread-993160-1-1.html
 
 再宣传下我的网站...
 http://www.jx4n.com
 成天做东西,做到没空去宣传...用了的朋友希望多去支持支持,这样我才有更多的时间来弄一些你们需要的东西.谢谢.
 
 就这样...写帖子真累...
 
 [ 本帖最后由 barracuda 于 2008-7-26 20:33 编辑 ]
 | 
 评分
3
查看全部评分
 |