========================标准安装开始============================
第一步:升级安装请跳过第一步,全新安装(以前没有安装过主题分类或板内分类FOR 2.0/2.2)请先升级数据库
- ALTER TABLE `cdb_threads` ADD `cate` VARCHAR( 2 ) DEFAULT '0' NOT NULL AFTER `fid` ;
- ALTER TABLE `cdb_forums` ADD `cates` VARCHAR( 150 ) DEFAULT '_所有文章' NOT NULL AFTER `name` ;
复制代码
第二步:/admin/forums.php
查找:
- showsetting('forums_edit_name', 'namenew', $forum['name'], 'text');
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- showsetting('主题分类', 'catesnew', $forum['cates'], 'text');
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
查找:
- $db->query("UPDATE $table_forums SET type='$typenew', status='$statusnew', fup='$fupnew', name='$namenew', icon='$iconnew',
- description='$descriptionnew', styleid='$styleidnew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew',
- allowimgcode='$allowimgcodenew', allowsmilies='$allowsmiliesnew', postcredits='".intval($postcreditsnew)."',
- replycredits='".intval($replycreditsnew)."', password='$passwordnew', viewperm='$viewpermnew',
- postperm='$postpermnew', replyperm='$replypermnew', getattachperm='$getattachpermnew' WHERE fid='$fid'");
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- $db->query("UPDATE $table_forums SET type='$typenew', status='$statusnew', fup='$fupnew', name='$namenew', icon='$iconnew',
- description='$descriptionnew', styleid='$styleidnew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew',
- allowimgcode='$allowimgcodenew', allowsmilies='$allowsmiliesnew', postcredits='".intval($postcreditsnew)."',
- replycredits='".intval($replycreditsnew)."', password='$passwordnew', viewperm='$viewpermnew',
- postperm='$postpermnew', replyperm='$replypermnew', getattachperm='$getattachpermnew' WHERE fid='$fid'");
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change Start//
- $db->query("UPDATE $table_forums SET type='$typenew', status='$statusnew', fup='$fupnew', name='$namenew', icon='$iconnew',
- description='$descriptionnew', cates='$catesnew', styleid='$styleidnew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew',
- allowimgcode='$allowimgcodenew', allowsmilies='$allowsmiliesnew', postcredits='".intval($postcreditsnew)."',
- replycredits='".intval($replycreditsnew)."', password='$passwordnew', viewperm='$viewpermnew',
- postperm='$postpermnew', replyperm='$replypermnew', getattachperm='$getattachpermnew' WHERE fid='$fid'");
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change End//
复制代码
第三步:forumdisplay.php
查找:
- $discuz_action = 2;
- $navigation = '';
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- if (preg_match("/[^0-9]/",$cateid)) {$cateid="";}
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
查找:
- $forumdisplayadd = $filteradd = '';
- if(!empty($filter)) {
- if(is_numeric($filter)) {
- $forumdisplayadd .= "&filter=$filter";
- $filteradd = "AND lastpost>='".($timestamp - $filter)."'";
- } elseif($filter == 'digest') {
- $forumdisplayadd .= "&filter=digest";
- $filteradd = "AND digest>'0'";
- }
- } else {
- $filter = '';
- }
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- $forumdisplayadd = $filteradd = '';
- if(!empty($filter)) {
- if(is_numeric($filter)) {
- $forumdisplayadd .= "&filter=$filter";
- $filteradd = "AND lastpost>='".($timestamp - $filter)."'";
- } elseif($filter == 'digest') {
- $forumdisplayadd .= "&filter=digest";
- $filteradd = "AND digest>'0'";
- }
- } else {
- $filter = '';
- }
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $forumdisplayadd = $caturladd = $filteradd = $cateidadd ='';
- if(!empty($filter)) {
- if($filter != 'digest') {
- $forumdisplayadd .= "&filter=$filter";
- $filteradd = "AND lastpost>='".($timestamp - $filter)."'";
- } elseif($filter == 'digest') {
- $forumdisplayadd .= "&filter=digest";
- $caturladd .= "&filter=digest";
- $filteradd = "AND digest<>'0'";
- }
- } else {
- $filter = '';
- }
- if(!empty($cateid)) {
- $forumdisplayadd .= "&cateid=$cateid";
- $cateidadd = "AND cate=$cateid ";
- } else {
- $cateid = '';
- }
- $cates=explode("|",$forum[cates]);$cat_count=$i=count($cates);
- if($cat_count==1):
- $subjectcate = $thecates = $cate_must_script = $cate_must_alert = $thecates = "";
- else:
- for($i = 0; $i < count($cates); $i++):
- $thecates2 = $thecates1 = explode("_",$cates[$i]);
- if($i == 0){if($thecates1[0]=="on"){$thecates1[0]="";}}
- if($thecates1[0]==$cateid ){$subject_class=$thecates1[1];
- $thecates .= "<td width=9><img src=images/attachicons/ttl.gif width=9 height=27></td><td
- background=images/attachicons/ttc.gif>$thecates1[1]</td><td
- width=9><img src=images/attachicons/ttr.gif width=9 height=27></td>"; }else{$thecates.="<td width=9><img
- src="images/attachicons/tl.gif" width=9 height=27></td><td background="images/attachicons/tc.gif"><a href="?fid=$forum[fid]$caturladd&cateid=$thecates1[0]">$thecates1[1]</a></td><td width=9><img src="images/attachicons/tr.gif" width=9
- height=27></td>"; }
- if($i == 0){if($thecates2[0]=="on"){$cate_must_script="||theform.cate.value == """;$cate_must_alert="专题分类亦为必选!";}else{$cate_must_script = $cate_must_alert ="";};$thecates2[0]="";$thecates2[1]="选择专题";};if($thecates2[0]==$cateid){$subjectcate .= "<option value="$thecates2[0]" selected >$thecates2[1]</option>";}else{$subjectcate .= "<option value="$thecates2[0]">$thecates2[1]</option>"; }
- endfor;
- $thecates="<TABLE CELLSPACING=0 CELLPADDING=0 border=0 align="left"><TR>".$thecates."</TR></TABLE>";
- $subjectcate= "<select name=cate>".$subjectcate."</select>";
- endif;
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
查找:
- if(!empty($filter)) {
- $query = $db->query("SELECT COUNT(*) FROM $table_threads WHERE fid='$fid' $filteradd");
- $threadcount = $db->result($query, 0);
- } else {
- $threadcount = $forum['threads'];
- }
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- if(!empty($filter)) {
- $query = $db->query("SELECT COUNT(*) FROM $table_threads WHERE fid='$fid' $filteradd");
- $threadcount = $db->result($query, 0);
- } else {
- $threadcount = $forum['threads'];
- }
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- if(!empty($filter)||!empty($cateid)) {
- $query = $db->query("SELECT COUNT(*) FROM $table_threads WHERE fid='$fid' $filteradd $cateidadd");
- $threadcount = $db->result($query, 0);
- } else {
- $threadcount = $forum['threads'];
- }
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
复制代码
查找:
- $query = $db->query("SELECT t.* FROM $table_threads t USE INDEX(displayorder)
- WHERE t.fid='$fid' $filteradd
- ORDER BY t.displayorder DESC, t.lastpost $ascdesc
- LIMIT $start_limit, $tpp ");
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- $query = $db->query("SELECT t.* FROM $table_threads t USE INDEX(displayorder)
- WHERE t.fid='$fid' $filteradd
- ORDER BY t.displayorder DESC, t.lastpost $ascdesc
- LIMIT $start_limit, $tpp ");
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change Start//
- $query = $db->query("SELECT t.* FROM $table_threads t USE INDEX(displayorder)
- WHERE t.fid='$fid' $filteradd $cateidadd
- ORDER BY t.displayorder DESC, t.lastpost $ascdesc
- LIMIT $start_limit, $tpp ");
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change End//
复制代码
查找:
- $check[$filter] = 'selected="selected"';
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $check[$cateid] = 'selected="selected"';
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
第四步:post.php
查找:
- define('CURRSCRIPT', 'post');
- require './include/common.php';
- $ismoderator = modcheck($discuz_user);
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $cateid = dhtmlspecialchars($cateid);
- $subjectcate = "";
- $cates=explode("|",$forum[cates]);
- if(count($cates)==1):
- $subjectcate = $cate_must_script = $cate_must_alert = "";
- else:
- $i=count($cates);for($i = 0; $i < count($cates); $i++) {
- $thecates1 = explode("_",$cates[$i]);if($i == 0){if($thecates1[0]=="on"){$cate_must_script="||theform.cate.value == """;$cate_must_alert="专题分类亦为必选!";}else{$cate_must_script = $cate_must_alert ="";};$thecates1[0]="";$thecates1[1]="选择专题";};if($thecates1[0]==$cateid){$subjectcate .= "<option value="$thecates1[0]" selected >$thecates1[1]</option>";}else{
- $subjectcate .= "<option value="$thecates1[0]">$thecates1[1]</option>"; }
- }
- endif;
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
查找:
- if($tid && $fid) {
- $query = $db->query("SELECT * FROM $table_threads WHERE tid='$tid'");
- $thread = $db->fetch_array($query);
- $fid = $thread['fid'];
- $navigation = "» <a href="viewthread.php?tid=$tid">$thread[subject]</a>";
- $navtitle = " - $thread[subject]";
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $subjectcate = "";
- $cates=explode("|",$forum[cates]);
- if(count($cates)==1):
- $subjectcate = $cate_must_script = $cate_must_alert = "";
- else:
- $i=count($cates);for($i = 0; $i < count($cates); $i++) {
- $thecates1 = explode("_",$cates[$i]);if($i == 0){if($thecates1[0]=="on"){$cate_must_script="theform.cate.value == ""||";$cate_must_alert="专题分类亦为必选!";}else{$cate_must_script = $cate_must_alert ="";};$thecates1[0]="";$thecates1[1]="选择专题";};if($thecates1[0]==$thread[cate]){$subjectcate .= "<option value="$thecates1[0]" selected >$thecates1[1]</option>";}else{
- $subjectcate .= "<option value="$thecates1[0]">$thecates1[1]</option>"; }
- }
- endif;
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
第五步:include/editpost.php
查找:
- $postinfo['subject'] = str_replace('"', """, $postinfo['subject']);
复制代码
其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $postinfo['cate'] = dhtmlspecialchars($postinfo['cate']);
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
复制代码
查找:
- $db->query("UPDATE $table_threads SET iconid='$iconid', subject='$subject' WHERE tid='$tid'", 'UNBUFFERED');
- if($pollopts) {
- $db->query("UPDATE $table_polls SET pollopts='$pollopts' WHERE tid='$tid'", 'UNBUFFERED');
- }
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- $db->query("UPDATE $table_threads SET iconid='$iconid', subject='$subject' WHERE tid='$tid'", 'UNBUFFERED');
- if($pollopts) {
- $db->query("UPDATE $table_polls SET pollopts='$pollopts' WHERE tid='$tid'", 'UNBUFFERED');
- }
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change Start//
- $db->query("UPDATE $table_threads SET iconid='$iconid', cate='$cate', subject='$subject' WHERE tid='$tid'", 'UNBUFFERED');
- if($pollopts) {
- $db->query("UPDATE $table_polls SET pollopts='$pollopts' WHERE tid='$tid'", 'UNBUFFERED');
- }
- //=D25 Subject classification=Ver.2.5.0 by Aday=Change End//
复制代码
第六步:include/newthread.php
查找:
- $db->query("INSERT INTO $table_threads (fid, creditsrequire, iconid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, poll, attachment)
- VALUES ('$fid', '$viewperm', '$iconid', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$discuz_user', '$displayorder', '$digest', '$poll', '".attachtype($last_attach_type, 'id')."')");
- $tid = $db->insert_id();
复制代码
替换为:
- /******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE Start******
- $db->query("INSERT INTO $table_threads (fid, creditsrequire, iconid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, poll, attachment)
- VALUES ('$fid', '$viewperm', '$iconid', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$discuz_user', '$displayorder', '$digest', '$poll', '".attachtype($last_attach_type, 'id')."')");
- $tid = $db->insert_id();
- ******=D25 Subject classification=Ver.2.5.0 by Aday=REMOVE End******/
- //=D25 Subject classification=Ver.2.5.0 by Aday=Chanage Start//
- $db->query("INSERT INTO $table_threads (fid, cate, creditsrequire, iconid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, poll, attachment)
- VALUES ('$fid', '$cate', '$viewperm', '$iconid', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$discuz_user', '$displayorder', '$digest', '$poll', '".attachtype($last_attach_type, 'id')."')");
- $tid = $db->insert_id();
- //=D25 Subject classification=Ver.2.5.0 by Aday=Chanage End//
复制代码
第七步:post_newthread.htm
查找
- <tr>
- <td bgcolor="{ALTBG1}" width="20%">{lang subject}:</td>
- <td bgcolor="{ALTBG2}"><input type="text" name="subject" size="45" value="$subject" tabindex="3"></td>
- </tr>
复制代码
在下面添加
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=Start//>
- <!--{if !empty($subjectcate)}-->
- <tr>
- <td bgcolor="{ALTBG1}" width="20%">专题:</td>
- <td bgcolor="{ALTBG2}"><select name=cate>$subjectcate </select> (请选择所属类别)</td>
- </tr>
- <!--{/if}-->
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=End//>
复制代码
查找:
- theform.subject.value == "" || theform.message.value == ""
复制代码
其后添加:
查找:
其后添加:
第八步:post_editpost.htm
查找
- <tr>
- <td bgcolor="{ALTBG1}" width="20%">{lang subject}:</td>
- <td bgcolor="{ALTBG2}">
- <input type="text" name="subject" size="45" value="$postinfo[subject]" tabindex="3">
- <input type="hidden" name="origsubject" value="$postinfo[subject]">
- </td></tr>
复制代码
在下面添加
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=Start//>
- <!--{if !empty($subjectcate)}-->
- <tr>
- <td bgcolor="{ALTBG1}" width="20%">专题:</td>
- <td bgcolor="{ALTBG2}"><select name=cate>$subjectcate </select> (请选择所属类别)</td>
- </tr>
- <!--{/if}-->
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=End//>
复制代码
查找:
- theform.subject.value == "" || theform.message.value == ""
复制代码
其前添加:
查找:
其后添加:
第九步:forumdisplay.htm
查找:
- <tr><td class="multi">$multipage</td>
- <td align="right">
- <!--{if $allowpost}--><a href="post.php?action=newthread&fid=$fid"><img src="{IMGDIR}/newtopic.gif" border="0"></a><!--{/if}-->
- <!--{if $allowpostpoll}--><a href="post.php?action=newthread&fid=$fid&poll=yes"><img src="{IMGDIR}/poll.gif" border="0"></a><!--{/if}-->
- </td></tr>
复制代码
其下面添加:
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=Start//>
- <tr><td class="multi">$thecates</td></tr>
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=End//>
复制代码
查找:
- <tr><td colspan="2" class="header">{lang post_fastpost}</td></tr>
- <tr>
- <td width="18%" bgcolor="{ALTBG1}">
复制代码
其后添加:$subjectcate
查找:注意这个添加共有4个
- <a href="post.php?action=newthread&fid=$fid
复制代码
后面添加&cateid=$cateid
查找:
- theform.subject.value == "" || theform.message.value == ""
复制代码 其后添加:
查找:
其后添加:
========================标准安装结束============================
========================批量选项安装开始========================
如果要安装批量专题分类:
第一步:topicadmin.php
查找:
- if(!$discuz_user || !$discuz_pw || !modcheck($discuz_user)) {
- showmessage('admin_nopermission', NULL, 'HALTED');
- }
复制代码 其后插入:
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- $subjectcate = "";
- $cates=explode("|",$forum[cates]);
- $i=count($cates);for($i = 0; $i < count($cates); $i++) {
- $thecates1 = explode("_",$cates[$i]);if($thecates1[0]==$thread[cate]){$subjectcate .=
- "<option value="$thecates1[0]" selected >$thecates1[1]</option>";}else{
- $subjectcate .= "<option value="$thecates1[0]">$thecates1[1]</option>"; }
- }
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
查找:
- $db->query("DELETE FROM $table_threads WHERE tid IN ($tids)");
- $db->query("DELETE FROM $table_posts WHERE tid IN ($tids)");
- updateforumcount($fid);
- modlog();
- showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");
复制代码
其后插入
- //=D25 Subject classification=Ver.2.5.0 by Aday=Start//
- }elseif($operation == 'cate' && $allowmove){
- accesscheck($query);
- if(!cate) {
- showmessage('admin_cate_invalid');
- }
- $db->query("UPDATE $table_threads SET cate='$cate' WHERE (tid IN ($tids)) AND fid='$fid'");
- modlog();
- showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page&cateid=$cate");
- //=D25 Subject classification=Ver.2.5.0 by Aday=End//
复制代码
第二步:topicadmin_moderate.htm
查找
- <tr>
- <td bgcolor="{ALTBG1}" width="21%">{lang level}:</td>
- <td bgcolor="{ALTBG2}">
- <input type="radio" name="level" value="0" checked> {lang admin_unstick}
- <input type="radio" name="level" value="1"> <img src="{IMGDIR}/star.gif">
- <input type="radio" name="level" value="2"> <img src="{IMGDIR}/star.gif"><img src="{IMGDIR}/star.gif">
- <input type="radio" name="level" value="3"> <img src="{IMGDIR}/star.gif"><img src="{IMGDIR}/star.gif"><img src="{IMGDIR}/star.gif"></td>
- </tr>
复制代码
在其下面插入:
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=Start// >
- <!--{elseif $operation =='cate'}-->
- <tr>
- <td bgcolor="{ALTBG1}" width="21%">目标类别</td>
- <td bgcolor="{ALTBG2}">
- <select name="cate">
- $subjectcate
- </select>
- </tr>
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=End// >
复制代码
第三步:forumdisplay.htm
查找:
- <!--{if $allowmove}-->
- <input type="radio" name="operation" value="move">
- {lang moderate_move}
- <!--{/if}-->
复制代码
其下添加:
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=Start//>
- <!--{if $allowmove}-->
- <input type="radio" name="operation" value="cate">
- 专题分类
- <!--{/if}-->
- <!//=D25 Subject classification=Ver.2.5.0 by Aday=End//>
复制代码
========================批量选项安装结束========================
[ Last edited by adaysky on 2005-1-19 at 20:05 ] |