Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] [HACK]社区监狱 2.0 For [D4] {有补丁!请使用分类!}

 关闭 [复制链接]
29184 发表于 2005-11-25 18:02:18 | 显示全部楼层
可以学学老八弄后台可以控制用什么积分
回复

使用道具 举报

 楼主| freddy 发表于 2005-11-25 18:02:18 | 显示全部楼层
原帖由 咕咕 于 2005-11-25 18:01 发表
郁闷....D3的后台还没弄明白....


我倒!老师早就在FD写了后台说明了!
回复

使用道具 举报

咕咕 发表于 2005-11-25 18:04:06 | 显示全部楼层
看了..还是米明白呢..可能理解能力下降=.=
回复

使用道具 举报

摇摆 发表于 2005-11-25 18:14:41 | 显示全部楼层
升级错误,MySQL 提示:Table 'cdb_postban' already exists
这个是什么原因?
回复

使用道具 举报

wenshuang 发表于 2005-11-25 18:59:31 | 显示全部楼层
HACK/破处???

what does 破处 mean?!
回复

使用道具 举报

jinlun721 发表于 2005-11-25 20:31:31 | 显示全部楼层
原帖由 jinlun721 于 2005-11-25 16:19 发表
帮忙看看 是什么原因 不显示哪?
用户名 demo
密码 demo

http://bbs.jinlunhotel.cn/index.php


我的是什么原因阿?
看我修改的文件

editpost.inc.php

<?

/*
        [DISCUZ!] include/editpost.inc.php - post editing for post module
        This is NOT a freeware, use is subject to license terms

        Version: 3.0.0
        Web: http://www.comsenz.com
        Copyright: 2001-2005 Comsenz Technology Ltd.
*/

if(!defined('IN_DISCUZ')) {
        exit('Access Denied');
}

$discuz_action = 13;

$query = $db->query("SELECT m.adminid, p.first, p.authorid, p.author, p.dateline, u.allowhtml FROM {$tablepre}posts p
        LEFT JOIN {$tablepre}members m ON m.uid=p.authorid
        LEFT JOIN {$tablepre}usergroups u ON u.groupid=m.groupid
        WHERE pid='$pid' AND tid='$tid' AND fid='$fid'");

$orig = $db->fetch_array($query);

$isfirstpost = $orig['first'] ? 1 : 0;
$isorigauthor = $discuz_uid && $discuz_uid == $orig['authorid'];
$alloweditpost = $alloweditpost && !(in_array($orig['adminid'], array(1, 2, 3)) && $adminid > $orig['adminid']) ? 1 : 0;

if((!$forum['ismoderator'] || !$alloweditpost) && !$isorigauthor) {
        showmessage('post_edit_nopermission', NULL, 'HALTED');
} elseif($isorigauthor && !$forum['ismoderator']) {
        if($edittimelimit && $timestamp - $orig['dateline'] > $edittimelimit * 60) {
                showmessage('post_edit_timelimit', NULL, 'HALTED');
        } elseif(($isfirstpost && $modnewthreads) || (!$isfirstpost && $modnewreplies)) {
                showmessage('post_edit_moderate');
        }
}

if(!submitcheck('editsubmit')) {

        include_once language('misc');

        $typeselect = typeselect($thread['typeid']);

        $icons = '';
        if(is_array($_DCACHE['icons']) && $isfirstpost) {
                $key = 1;
                foreach($_DCACHE['icons'] as $id => $icon) {
                        $icons .= ' <input type="radio" name="iconid" value="'.$id.'" '.($thread['iconid'] == $id ? 'checked' : '').'><img src="'.SMDIR.'/'.$icon.'">';
                        $icons .= !(++$key % 10) ? '<br>' : '';
                }
        }

        $query = $db->query("SELECT * FROM {$tablepre}posts WHERE pid='$pid' AND tid='$tid' AND fid='$fid'");
        $postinfo = $db->fetch_array($query);

        $usesigcheck = $postinfo['usesig'] ? 'checked' : '';
        $urloffcheck = $postinfo['parseurloff'] ? 'checked' : '';
        $smileyoffcheck = $postinfo['smileyoff'] == 1 ? 'checked' : '';
        $codeoffcheck = $postinfo['bbcodeoff'] == 1 ? 'checked' : '';
        $htmloncheck = $postinfo['htmlon'] ? 'checked' : '';

        $polloptions = '';
        if($isfirstpost && $alloweditpoll && $thread['poll']) {
                $query = $db->query("SELECT pollopts FROM {$tablepre}polls WHERE tid='$tid'");
                $polloptions = unserialize($db->result($query, 0));
                for($i = 0; $i < count($polloptions['options']); $i++) {
                        $polloptions['options'][$i][0] = htmlspecialchars(stripslashes($polloptions['options'][$i][0]))."\n";
                }
        }

        $threadpermselect = $postpermoption = $attachpermoption = '';
        if ($allowthreadperms ){
                foreach ($allowthreadperms as $permid=>$perm){
                       
                        $perm['title']= strip_tags($perm['title']).($perm['sell'] ? ' - $$ ' : '');

                        $postpermoption .= ( $isfirstpost && $perm['thread'] && ( (!$perm['sell'] && $allowsetpostperm ) || ($perm['sell'] && $allowsetpostprice) ) ) ? "<option value=\"$permid\"".($permid==$thread['permid']?' selected':'').">$perm[title]</option>" :'';
                        $attachpermoption .= ($perm['attach'] &&  ( (!$perm['sell'] && $allowsetattachperm ) || ($perm['sell'] && $allowsetattachprice) )) ? "<option value=\"$permid\">$perm[title]</option>":'';
                }
                $threadpermselect .= $postpermoption ? '<select name="permid"><option value="0">&nbsp;</option>'.$postpermoption.'</select>': '';
        }


        if($postinfo['attachment']) {
                require_once DISCUZ_ROOT.'./include/attachment.func.php';

                $attachments = array();
                $query = $db->query("SELECT * FROM {$tablepre}attachments WHERE pid='$postinfo[pid]'");
                while($attach = $db->fetch_array($query)) {
                        $attach['dateline'] = gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600);
                        $attach['filesize'] = sizecount($attach[filesize]);
                        $attach['filetype'] = attachtype(fileext($attach['attachment'])."\t".$attach['filetype']);
                        $attachments[] = $attach;
                }
        }

        $postinfo['subject'] = str_replace('"', "&quot;", $postinfo['subject']);
        $postinfo['message'] = dhtmlspecialchars($postinfo['message']);
        $postinfo['message'] = preg_replace($language['post_edit_regexp'], '', $postinfo['message']);

        if(!empty($previewpost)) {
                $postinfo['message'] = $message;
        }

        $attachupload = getattacharray(count($attachments));
        include template('post_editpost');

} else {

//===========板块禁言检查begin========
if (!$ismoderator) {
    if (!postban_check($forum[fid], $discuz_user)) showmessage('你在本板块被禁言,不能发贴和编辑');
}
//===========板块禁言检查end==========

        if(empty($delete)) {

                if($post_invalid = checkpost()) {
                        showmessage($post_invalid);
                }

                if(!empty($_FILES['attach'])) {
                        checklowerlimit($creditspolicy['postattach']);
                }
                if($isfirstpost) {
                        if($subject == '' || $message == '') {
                                showmessage('post_sm_isnull');
                        }

                        $typeid = isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0;
                        $iconid = isset($_DCACHE['icons'][$iconid]) ? $iconid : 0;

                        if(!$typeid && $forum['threadtypes']['required']) {
                                showmessage('post_type_isnull');
                        }

                        $viewpermadd = '';
                        if ($allowsetpostperm && $isfirstpost){
                                availableperms( &$permid, &$readperm, 'thread',1);
                                $viewpermadd = ", readperm='$readperm', permid='$permid'";
                        }

                        $polladd = '';
                        if(($alloweditpoll || $thread['authorid'] == $discuz_uid) && $thread['poll'] && !empty($polloptions)) {
                                $query = $db->query("SELECT pollopts FROM {$tablepre}polls WHERE tid='$tid'");
                                $pollarray = unserialize($db->result($query, 0));

                                $optsdeleted = 0;
                                $pollarray['max'] = 0;
                                foreach($polloptions as $key => $option) {
                                        if(trim($option)) {
                                                $pollarray['options'][$key][0] = $option;
                                                if($pollarray['options'][$key][1] > $pollarray['max']) {
                                                        $pollarray['max'] = $pollarray['options'][$key][1];
                                               
                                                }
                                        } else {
                                                $optsdeleted = 1;
                                                $pollarray['total'] -= $pollarray['options'][$key][1];
                                                unset($pollarray['options'][$key]);
                                        }
                                }

                                if($optsdeleted) {
                                        $newoptions = array();
                                        foreach($pollarray['options'] as $option) {
                                                $newoptions[] = $option;
                                        }
                                        $pollarray['options'] = $newoptions;
                                        unset($newoptions);
                                }

                                if($pollarray['options']) {
                                        $polladd = ', poll=\'1\'';
                                        $pollarray['multiple'] = !empty($multiplepoll);
                                        $pollopts = addslashes(serialize($pollarray));
                                        $db->query("UPDATE {$tablepre}polls SET pollopts='$pollopts' WHERE tid='$tid'", 'UNBUFFERED');
                                } else {
                                        $polladd = ', poll=\'0\'';
                                        $db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'", 'UNBUFFERED');
                                }

                        }

                        $db->query("UPDATE {$tablepre}threads SET iconid='$iconid',  typeid='$typeid',subject='$subject' $polladd $viewpermadd WHERE tid='$tid'", 'UNBUFFERED');

                } else {
                        if($subject == '' && $message == '') {
                                showmessage('post_sm_isnull');
                        }
                }

                if($editedby && ($timestamp - $orig['dateline']) > 60 && $adminid != 1) {
                        include_once language('misc');

                        $editdate = gmdate($_DCACHE['settings']['dateformat'], $timestamp + $timeoffset * 3600);
                        $edittime = gmdate($_DCACHE['settings']['timeformat'], $timestamp + $timeoffset * 3600);
                        eval("\$message .= \"$language[post_edit]\";");
                }

                $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));
                $smileyoff = checksmilies($message, !empty($smileyoff));
                $htmlon = $orig['allowhtml'] && !empty($htmlon) ? 1 : 0;

                $tattachment = 0;
                $pattachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0;

                if ( is_array($attachpermid) && count($attachpermid) && $allowsetattachperm){
                        foreach( $attachpermid as $key=>$val ){
                                availableperms( &$attachpermid[$key], &$attachreadperm[$key],'attach');
                        }
                }else{
                        $attachpermid = $attachreadperm = array();
                }

                $query = $db->query("SELECT aid, displayorder, permid,readperm,description FROM {$tablepre}attachments WHERE pid='$pid'");
                while($attach = $db->fetch_array($query)) {
       
                        $readpermadd = ( $attach['readperm'] != $attachreadperm[$attach['aid']] ||  (int)$attach['permid'] != $attachpermid[$attach['aid']]) ? ", readperm='{$attachreadperm[$attach[aid]]}',permid='{$attachpermid[$attach[aid]]}'":'';

                        $orderadd = $attachorder[$attach['aid']] != (int)$attach['displayorder'] ? ", displayorder='{$attachorder[$attach[aid]]}'":'';

                        $descadd = dhtmlspecialchars($attachdesc[$attach['aid']]) != $attach['description'] ? ", description='".dhtmlspecialchars($attachdesc[$attach['aid']])."'":'';

                        if($readpermadd || $orderadd || $descadd){
                                $db->query("UPDATE {$tablepre}attachments SET aid='$attach[aid]' $readpermadd $orderadd $descadd WHERE aid='$attach[aid]'");
                        }
                }

                if(!empty($deleteaid) || $pattachment) {

                        if($deleteaids = implode_ids($deleteaid)) {

                                $query = $db->query("SELECT aid, attachment FROM {$tablepre}attachments WHERE aid IN ($deleteaids) AND pid='$pid'");
                                $deleteaidnum = $db->num_rows($query);
                                $deleteaids = '0';
                                while($attach = $db->fetch_array($query)) {
                                        @unlink($attachdir.'/'.$attach['attachment']);
                                        $deleteaids .= ','.$attach['aid'];
                                }
                                if ( $deleteaidnum ){
                                        $db->query("DELETE FROM {$tablepre}attachments WHERE aid IN ($deleteaids)");
                                        updatecredits($discuz_uid, $creditspolicy['postattach'], -$deleteaidnum);
                                }

                        }

                        if($pattachment) {

                                foreach($attachments as $attach) {
                                        $db->query("INSERT INTO {$tablepre}attachments (tid, pid,displayorder, dateline, permid,readperm, filename, description, filetype, filesize, attachment, downloads)
                                        VALUES ('$tid', '$pid','$attach[order]' ,'$timestamp','$attach[permid]','$attach[readperm]', '$attach[name]',  '$attach[description]','$attach[type]', '$attach[size]', '$attach[attachment]', '0')");
                                }
                                updatecredits($discuz_uid, $creditspolicy['postattach'], count($attachments));
                        } else {
                                $query = $db->query("SELECT aid FROM {$tablepre}attachments WHERE pid='$pid' LIMIT 1");
                                $pattachment = $db->result($query, 0) ? 1 : 0;
                        }

                        if($pattachment) {
                                $tattachment = 1;
                        } else {
                                $query = $db->query("SELECT a.aid FROM {$tablepre}posts p, {$tablepre}attachments a WHERE p.tid='$tid' AND p.invisible='0' AND a.pid=p.pid LIMIT 1");
                                $tattachment = $db->result($query, 0) ? 1 : 0;
                        }

                        $db->query("UPDATE {$tablepre}threads SET attachment='$tattachment' WHERE tid='$tid'");

                }

                $db->query("UPDATE {$tablepre}posts SET message='$message', usesig='$usesig', htmlon='$htmlon', bbcodeoff='$bbcodeoff', parseurloff='$parseurloff', smileyoff='$smileyoff', subject='$subject'
                        ".($pattachment ? ", attachment='1'" : '')." WHERE pid='$pid'");

                if(!$isorigauthor) {
                        updatemodworks('EDT', 1);
                        require_once DISCUZ_ROOT.'./include/misc.func.php';
                        modlog($thread, 'EDT');
                }

        } else {

                if(!$isorigauthor || ($isfirstpost && $thread['replies'] >= 1)) {
                        showmessage('post_edit_nopermission', NULL, 'HALTED');
                }

                updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));

                $thread_attachment = $post_attachment = 0;
                $query = $db->query("SELECT pid, attachment FROM {$tablepre}attachments WHERE tid='$tid'");
                while($attach = $db->fetch_array($query)) {
                        if($attach['pid'] == $pid) {
                                $post_attachment = 1;
                                @unlink($attachdir.'/'.$attach['attachment']);
                        } else {
                                $thread_attachment = 1;
                        }
                }

                if($post_attachment) {
                        $db->query("DELETE FROM {$tablepre}attachments WHERE pid='$pid'", 'UNBUFFEREED');
                       
                       
                }

                $db->query("DELETE FROM {$tablepre}posts WHERE pid='$pid'");

                if($isfirstpost) {
                        $forumadd = 'threads=threads-1, posts=posts-1';
                        $db->query("DELETE FROM {$tablepre}threadsmod WHERE tid='$tid'", 'UNBUFFERED');
                        $db->query("DELETE FROM {$tablepre}threads WHERE tid='$tid'", 'UNBUFFERED');
                        $db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'", 'UNBUFFERED');
                } else {
                        $forumadd = 'posts=posts-1';
                        $query = $db->query("SELECT author, dateline FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline DESC LIMIT 1");
                        $lastpost = $db->fetch_array($query);
                        $lastpost['author'] = addslashes($lastpost['author']);
                        $db->query("UPDATE {$tablepre}threads SET replies=replies-1, attachment='$thread_attachment', lastposter='$lastpost[author]', lastpost='$lastpost[dateline]' WHERE tid='$tid'", 'UNBUFFERED');
                }

                $forum['lastpost'] = explode("\t", $forum['lastpost']);
                if($orig['dateline'] == $forum['lastpost'][2] && $orig['author'] == $forum['lastpost'][3]) {
                        $query = $db->query("SELECT tid, subject, lastpost, lastposter FROM {$tablepre}threads
                                WHERE fid='$fid' AND displayorder>='0' ORDER BY lastpost DESC LIMIT 1");
                        $lastthread = $db->fetch_array($query);
                        $forumadd .= ", lastpost='$lastthread[tid]\t$lastthread[subject]\t".addslashes($lastthread['lastpost'])."\t".addslashes($lastthread['lastposter'])."'";
                }

                $db->query("UPDATE {$tablepre}forums SET $forumadd WHERE fid='$fid'", 'UNBUFFERED');
        }

        (!empty($delete) && $isfirstpost) ? showmessage('post_edit_delete_succeed', "forumdisplay.php?fid=$fid") :
                showmessage('post_edit_succeed', "viewthread.php?tid=$tid&page=$page&extra=$extra#pid$pid");

}

?>

-----------------------------------
修改的global.func.php

<?php

/*
        [DISCUZ!] include/global.func.php - Crossday Discuz! Board global functions
        This is NOT a freeware, use is subject to license terms

        Version: 3.0.0
        Web: http://www.comsenz.com
        Copyright: 2001-2005 Comsenz Technology Ltd.
*/

if(!defined('IN_DISCUZ')) {
        exit('Access Denied');
}

function authcode($string, $operation, $key = '') {
        $key = $key ? $key : $GLOBALS['discuz_auth_key'];
        $coded = '';
        $keylength = strlen($key);
        $string = $operation == 'DECODE' ? base64_decode($string) : $string;
        for($i = 0; $i < strlen($string); $i += $keylength) {
                $coded .= substr($string, $i, $keylength) ^ $key;
        }

        $coded = $operation == 'ENCODE' ? str_replace('=', '', base64_encode($coded)) : $coded;
        return $coded;
}

function avatarshow($id, $gender = 0) {
        global $discuz_uid, $avatarshowid, $avatarshow_license, $avatarshowlink, $avatarshowheight, $avatarshowwidth;
        return '<iframe marginwidth="0" marginheight="0" frameborder="0" scrolling="no" height="'.$avatarshowheight.'" width="'.$avatarshowwidth.'" src="api/avatarshow.php?uid='.$discuz_uid.'&thisid='.$avatarshowid.'&id='.$id.'&license='.$avatarshow_license.'&width='.$avatarshowwidth.'&height='.$avatarshowheight.'gender='.$gender.'&link='.$avatarshowlink.'"></iframe>';
}

function clearcookies() {
        global $timestamp, $cookiepath, $cookiedomain, $discuz_uid, $discuz_user, $discuz_pw, $discuz_secques, $adminid, $groupid, $credits;
        dsetcookie('auth', '', -86400 * 365);
        dsetcookie('visitedfid', '', -86400 * 365);

        // clear cookies defined in older version (transitional operation)
        dsetcookie('_discuz_uid', '', -86400 * 365, 0);
        dsetcookie('_discuz_pw', '', -86400 * 365, 0);
        dsetcookie('_discuz_secques', '', -86400 * 365, 0);
        dsetcookie('onlinedetail', '', -86400 * 365, 0);
        // end

        $discuz_uid = $adminid = $credits = 0;
        $discuz_user = $discuz_pw = $discuz_secques = '';
}

function checklowerlimit($creditsarray, $coef = 1) {
        if(is_array($creditsarray)) {
                global $extcredits, $id;
                foreach($creditsarray as $id => $addcredits) {
                        if($addcredits * $coef < 0 && $GLOBALS['extcredits'.$id] < $extcredits[$id]['lowerlimit']) {
                                showmessage('credits_policy_lowerlimit');
                        }
                }
        }       
}

function cutstr($string, $length) {
        $strcut = '';
        if(strlen($string) > $length) {
                for($i = 0; $i < $length - 3; $i++) {
                        $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
                }
                return $strcut.' ...';
        } else {
                return $string;
        }
}

function daddslashes($string, $force = 0) {
        if(!$GLOBALS['magic_quotes_gpc'] || $force) {
                if(is_array($string)) {
                        foreach($string as $key => $val) {
                                $string[$key] = daddslashes($val, $force);
                        }
                } else {
                        $string = addslashes($string);
                }
        }
        return $string;
}

function debuginfo() {
        if($GLOBALS['debug']) {
                global $db, $discuz_starttime, $debuginfo;
                $mtime = explode(' ', microtime());
                $debuginfo = array('time' => number_format(($mtime[1] + $mtime[0] - $discuz_starttime), 6), 'queries' => $db->querynum);
                return TRUE;
        } else {
                return FALSE;
        }
}

function dexit($message = '') {
        echo $message;
        output();
        exit();
}

function dhtmlspecialchars($string, $is_url = 0) {
        if(is_array($string)) {
                foreach($string as $key => $val) {
                        $string[$key] = dhtmlspecialchars($val);
                }
        } else {
                if (!$is_url) $string = str_replace('&', '&amp;', $string);
                $string = preg_replace('/&amp;((#(\d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)/', '&\\1',
                        str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string));
        }
        return $string;
}

function disuploadedfile($file) {
        return function_exists('is_uploaded_file') && is_uploaded_file($file) ? TRUE : FALSE;
}

function dreferer($default = 'index.php') {
        global $referer;

        if(empty($referer) && isset($GLOBALS['_SERVER']['HTTP_REFERER'])) {
                $referer = preg_replace("/([\?&])((sid\=[a-z0-9]{6})(&|$))/i", '\\1', $GLOBALS['_SERVER']['HTTP_REFERER']);
                $referer = substr($referer, -1) == '?' ? substr($referer, 0, -1) : $referer;
        } else {
                $referer = dhtmlspecialchars($referer,1);
        }

        if(!strpos($referer, '.php') || strpos($referer, 'logging.php')) {
                $referer = $default;
        }
        return $referer;               
}

function dsetcookie($var, $value, $life = 0, $prefix = 1) {
        global $tablepre, $cookiedomain, $cookiepath, $timestamp, $_SERVER;       
        setcookie(($prefix ? $tablepre : '').$var, $value,
                $life ? $timestamp + $life : 0, $cookiepath,
                $cookiedomain, $_SERVER['SERVER_PORT'] == 443 ? 1 : 0);
}

function errorlog($type, $message, $halt = 1) {
        @$fp = fopen(DISCUZ_ROOT.'./forumdata/errorlog.php', 'a');
        @fwrite($fp, "$GLOBALS[timestamp]\t$type\t$GLOBALS[discuz_user]\t".str_replace(array("\r", "\n"), array(' ', ' '), trim(dhtmlspecialchars($message)))."\n");
        @fclose($fp);
        if($halt) {
                dexit();
        }
}

function fileext($filename) {
        return trim(substr(strrchr($filename, '.'), 1));
}

function formhash() {
        global $discuz_user, $discuz_uid, $discuz_pw, $timestamp;
        return substr(md5(substr($timestamp, 0, -7).$discuz_user.$discuz_uid.$discuz_pw), 8, 8);
}

function getgroupid($uid, $group, &$member) {
        global $creditsformula, $db, $tablepre;

        $updatearray = array();
        eval("\$credits = @round($creditsformula);");

        if($credits != $member['credits']) {
                $updatearray[] = "credits='$credits'";
        }
        if($group['type'] == 'member' && !($member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower'])) {
                $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND $member[credits]>=creditshigher AND $member[credits]<creditslower LIMIT 1");
                if($db->num_rows($query)) {
                        $member['groupid'] = $db->result($query, 0);
                        $updatearray[] = "groupid='$member[groupid]'";
                }
        }

        if($updatearray) {
                $db->query("UPDATE {$tablepre}members SET ".implode(', ', $updatearray)." WHERE uid='$uid'");
        }
        return $member['groupid'];
}
function image($imageinfo, $basedir = '', $remark = '') {
        if($basedir) {
                $basedir .= '/';
        }
        if(strstr($imageinfo, ',')) {
                $flash = explode(",", $imageinfo);
                return "<embed src=\"$basedir".trim($flash[0])."\" width=\"".trim($flash[1])."\" height=\"".trim($flash[2])."\" type=\"application/x-shockwave-flash\" $remark></embed>";
        } else {
                return "<img src=\"$basedir$imageinfo\" $remark border=\"0\">";
        }
}

function ipbanned($onlineip) {
        global $timestamp, $cachelost;

        $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/cache_ipbanned.php') ? '' : ' ipbanned';
        if(empty($_DCACHE['ipbanned'])) {
                return FALSE;
        } else {
                if($_DCACHE['ipbanned']['expiration'] < $timestamp) {
                        @unlink(DISCUZ_ROOT.'./forumdata/cache/cache_ipbanned.php');
                }
                return preg_match("/(".$_DCACHE['ipbanned']['regexp'].")/", $onlineip) ? TRUE : FALSE;
        }
}

function isemail($email) {
        return strlen($email) > 8 && preg_match("/^[-_+.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+([a-z]{2,4})|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email);
}

function ispage($number) {
        return !empty($number) && preg_match ("/^([0-9]+)$/", $number);
}

function language($file, $templateid = 0, $tpldir = '') {
        $tpldir = $tpldir ? $tpldir : TPLDIR;
        $templateid = $templateid ? $templateid : TEMPLATEID;

        $languagepack = DISCUZ_ROOT.'./'.$tpldir.'/'.$file.'.lang.php';
        if(file_exists($languagepack)) {
                return $languagepack;
        } elseif($templateid != 1 && $tpldir != './templates/default') {
                return language($file, 1, './templates/default');
        } else {
                return FALSE;
        }
}

function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0) {
        $multipage = '';
        $mpurl .= strpos($mpurl, '?') ? '&' : '?';
        if($num > $perpage) {
                $page = 10;
                $offset = 2;

                $realpages = @ceil($num / $perpage);
                $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages;
               
                if($page > $pages) {
                        $from = 1;
                        $to = $pages;
                } else {
                        $from = $curpage - $offset;
                        $to = $curpage + $page - $offset - 1;
                        if($from < 1) {
                                $to = $curpage + 1 - $from;
                                $from = 1;
                                if(($to - $from) < $page && ($to - $from) < $pages) {
                                        $to = $page;
                                }
                        } elseif($to > $pages) {
                                $from = $curpage - $pages + $to;
                                $to = $pages;
                                if(($to - $from) < $page && ($to - $from) < $pages) {
                                        $from = $pages - $page + 1;
                                }
                        }
                }

                $multipage = ($curpage - $offset > 1 && $pages > $page ? '<td>&nbsp;<a href="'.$mpurl.'page=1"><b>|</b>&lt;&nbsp;</td>' : '').
                        ($curpage > 1 ? '<td>&nbsp;<a href="'.$mpurl.'page='.($curpage - 1).'">&lt;</a>&nbsp;</td>' : '');
                for($i = $from; $i <= $to; $i++) {
                        $multipage .= $i == $curpage ? '<td bgcolor="'.ALTBG2.'">&nbsp;<u><b>'.$i.'</b></u>&nbsp;</td>' :
                                '<td>&nbsp;<a href="'.$mpurl.'page='.$i.'">'.$i.'</a>&nbsp;</td>';
                }

                $multipage .= ($curpage < $pages ? '<td>&nbsp;<a href="'.$mpurl.'page='.($curpage + 1).'">&gt;</a>&nbsp;</td>' : '').
                        ($to < $pages ? '<td>&nbsp;<a href="'.$mpurl.'page='.$pages.'">&gt;<b>|</b></a>&nbsp;</td>' : '').
                        ($curpage == $maxpages ? '<td>&nbsp;<a href="misc.php?action=maxpages&pages='.$maxpages.'">&gt;<b>?</b></a>&nbsp;</td>' : '').
                        ($pages > $page ? '<td style="padding: 0"><input type="text" name="custompage" size="2" style="border: 1px solid '.BORDERCOLOR.'" onKeyDown="if(event.keyCode==13) window.location=\''.$mpurl.'page=\'+this.value;"></td>' : '');

                $multipage = $multipage ? '<table cellspacing="0" cellpadding="0" border="0"><tr><td height="3"></td></tr><tr><td>'.
                        '<table cellspacing="'.INNERBORDERWIDTH.'" cellpadding="2" class="tableborder"><tr bgcolor="'.ALTBG1.'" class="smalltxt"><td class="header">&nbsp;'.$num.'&nbsp;</td><td class="header">&nbsp;'.$curpage.'/'.$realpages.'&nbsp;</td>'.$multipage.'</tr></table>'.
                        '</td></tr><tr><td height="3"></td></tr></table>' : '';
        }
        return $multipage;
}

function output() {
        global $sid, $transsidstatus;

        if(empty($GLOBALS['_DCOOKIE']['sid']) && $transsidstatus) {
                $content = preg_replace(array(        "/\<a(\s*[^\>]+\s*)href\=([\"|\']?)([^\"\'\s]+)/ies",
                                                "/(\<form.+?\>)/is"),
                                        array(        "transsid('\\3','<a\\1href=\\2')",
                                                 "\\1\n<input type=\"hidden\" name=\"sid\" value=\"$sid\">"),
                                        ob_get_contents());
                ob_end_clean();
                $GLOBALS['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
                echo $content;
        }
}

function quescrypt($questionid, $answer) {
        return $questionid > 0 && $answer != '' ? substr(md5($answer.md5($questionid)), 16, 8) : '';
}

function random($length, $numeric = 0) {
        mt_srand((double)microtime() * 1000000);
        if($numeric) {
                $hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1));
        } else {
                $hash = '';
                $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
                $max = strlen($chars) - 1;
                for($i = 0; $i < $length; $i++) {
                        $hash .= $chars[mt_rand(0, $max)];
                }
        }
        return $hash;
}

function sendmail($email_to, $email_subject, $email_message, $email_from = '') {
        extract($GLOBALS, EXTR_SKIP);
        require_once DISCUZ_ROOT.'./include/sendmail.inc.php';
}

function sendpm($toid, $subject, $message, $fromid = '', $from = '', $new = 1) {
        extract($GLOBALS, EXTR_SKIP);
        include language('pms');
        if(isset($language[$subject])) {
                eval("\$subject = addslashes(\"".$language[$subject]."\");");
        }
        if(isset($language[$message])) {
                eval("\$message = addslashes(\"".$language[$message]."\");");
        }

        if(!$fromid && !$from) {
                $fromid = $discuz_uid;
                $from = $discuz_user;
        }

        $db->query("INSERT INTO {$tablepre}pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) SELECT '$from', '$fromid', uid, 'inbox','$new', '$subject', '$timestamp', '$message' FROM {$tablepre}members WHERE uid IN ($toid)",'UNBUFFERED');

        $db->query("UPDATE {$tablepre}members SET newpm='$new' WHERE uid IN ($toid)",'UNBUFFERED');
}

function showmessage($show_message, $url_forward = '', $extra = '') {
        extract($GLOBALS, EXTR_SKIP);

        global $discuz_action, $debuginfo, $seccode, $fid, $tid;
        if(in_array($extra, array('HALTED', 'NOPERM'))) {
                $fid = $tid = 0;
                $discuz_action = 254;
        } else {
                $discuz_action = 255;
        }

        include language('messages');

        if(isset($language[$show_message])) {
                eval("\$show_message = \"".$language[$show_message]."\";");
        }
        $url_redirect = $url_forward ? '<meta http-equiv="refresh" content="3;url='.
                (empty($_DCOOKIE['sid']) && $transsidstatus ? transsid($url_forward) : $url_forward).
                '">' : NULL;

        if($extra == 'NOPERM' && !$passport_status) {
                //get secure code checking status (pos. -2)
                if($seccodecheck = substr(sprintf('%05b', $seccodestatus), -2, 1)) {
                        $seccode = random(4, 1);
                }
                include template('nopermission');
        } else {
                include template('showmessage');
        }

        dexit();
}

function showstars($num) {
        global $starthreshold;

        $alt = 'alt="Rank: '.$num.'"';
        if(empty($starthreshold)) {
                for($i = 0; $i < $num; $i++) {
                        echo '<img src="'.IMGDIR.'/star_level1.gif" '.$alt.'>';
                }
        } else {
                for($i = 3; $i > 0; $i--) {
                        $numlevel = intval($num / pow($starthreshold, ($i - 1)));
                        $num = ($num % pow($starthreshold, ($i - 1)));
                        for($j = 0; $j < $numlevel; $j++) {
                                echo '<img src="'.IMGDIR.'/star_level'.$i.'.gif" '.$alt.'>';
                        }
                }
        }
}

function strexists($haystack, $needle) {
        return !(strpos($haystack, $needle) === FALSE);
}

function submitcheck($var, $allowget = 0, $seccodecheck = 0) {
        if($GLOBALS[$var]) {
                global $_SERVER, $adminid,$seccodeverify,$seccode;
                if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && $GLOBALS['formhash'] == formhash() && ($adminid <= 0 ||
                        preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
                        if($seccodecheck ) {
                                if($seccode && $seccodeverify && (intval($seccodeverify) == intval($seccode))) {
                                        $seccode = random(4, 1);
                                        return TRUE;
                                } else {
                                        showmessage('submit_seccode_invalid');
                                }
                        } else {
                                return TRUE;
                        }
                } else {
                        showmessage('submit_invalid');
                }
        } else {
                return FALSE;
        }
}

function template($file, $templateid = 0, $tpldir = '') {
        global $tplrefresh;

        $tpldir = $tpldir ? $tpldir : TPLDIR;
        $templateid = $templateid ? $templateid : TEMPLATEID;

        $tplfile = DISCUZ_ROOT.'./'.$tpldir.'/'.$file.'.htm';
        $objfile = DISCUZ_ROOT.'./forumdata/templates/'.$templateid.'_'.$file.'.tpl.php';
        if(TEMPLATEID != 1 && $templateid != 1 && !file_exists($tplfile)) {
                return template($file, 1, './templates/default/');
        }
        if($tplrefresh == 1 || ($tplrefresh > 1 && substr($GLOBALS['timestamp'], -1) > $tplrefresh)) {
                if(@filemtime($tplfile) > @filemtime($objfile)) {
                        require_once DISCUZ_ROOT.'./include/template.func.php';
                        parse_template($file, $templateid, $tpldir);
                }
        }
        return $objfile;
}

function transsid($url, $tag = '') {
        global $sid;
        $tag = stripslashes($tag);
        if(!$tag || (!preg_match("/^(http:\/\/|mailto:|#|javascript)/i", $url) && !strpos($url, 'sid='))) {
                if($pos = strpos($url, '#')) {
                        $urlret = substr($url, $pos);
                        $url = substr($url, 0, $pos);
                } else {
                        $urlret = '';
                }
                $url .= (strpos($url, '?') ? '&' : '?').'sid='.$sid.$urlret;
        }
        return $tag.$url;
}

function implode_ids( $array ){
       
        return  (is_array($array) && count($array)) ? '\''.implode('\',\'', $array).'\'' : '';
}

function adminlevel($adminid ,$groupid, $radminid){
        if ($adminid < 1) {
                return 0;
        }else{
                return (4 - $adminid) * 3  - (( $adminid <> $groupid )? 1:0) - (($radminid == $adminid) ? 1:0);
        }
}

function periodscheck($periods, $showmessage = 1) {
        global $timestamp, $disableperiodctrl, $_DCACHE, $banperiods;

        if(!$disableperiodctrl && $_DCACHE['settings'][$periods]) {
                $now = gmdate('G.i', $timestamp + $_DCACHE['settings']['timeoffset'] * 3600);
                foreach(explode("\r\n", str_replace(':', '.', $_DCACHE['settings'][$periods])) as $period) {
                        list($periodbegin, $periodend) = explode('-', $period);
                        if(($periodbegin > $periodend && ($now >= $periodbegin || $now < $periodend)) || ($oeriodbegin < $periodend && $now >= $periodbegin && $now < $periodend)) {
                                $banperiods = str_replace("\r\n", ', ', $_DCACHE['settings'][$periods]);
                                if($showmessage) {
                                        showmessage('period_nopermission', NULL, 'NOPERM');
                                } else {
                                        return TRUE;
                                }
                        }
                }
        }
        return FALSE;
}

function typeselect($curtypeid = 0) {
        if($threadtypes = $GLOBALS['forum']['threadtypes']) {
                $html = '<select name="typeid"><option value="0">&nbsp;</option>';
                foreach($threadtypes['types'] as $typeid => $name) {
                        $html .= '<option value="'.$typeid.'" '.($curtypeid == $typeid ? 'selected' : '').'>'.strip_tags($name).'</option>';
                }
                $html .= '</select>';
                return $html;
        } else {
                return '';
        }
}

function threadpermselect( $curpermid = 0 , $selectname='permid') {
        global $threadperms,$extcredits, $forum ;
        if($extcredits && $threadperms && $forum['threadperms']) {

                $html = '<select name="'.$selectname.'"><option value="0">&nbsp;</option>';

                $perms = $forum['threadperms'];
                foreach( $perms as $id =>$forumperm) {

                        if ( ($id < 9 && isset( $extcredits[$id])) || ( $id >80 && isset( $threadperms[$id])) ){       
                                $forum['threadperms'][$id] = $threadperms[$id];
                                if (isset($forumperm['min'])){
                                        $forum['threadperms'][$id]['min'] = $forumperm['min'];
                                }
                                if (isset($forumperm['max'])){
                                        $forum['threadperms'][$id]['max'] = $forumperm['max'];
                                }

                                $title = $forum['threadperms'][$id]['title'] = $id<9 ? $extcredits[$id]['title'] : $forum['threadperms'][$id]['title'];

                                $html .= '<option value="'.$id.'" '.($curpermid == $id ? 'selected' : '').'>'.strip_tags($title).'</option>';
                        }else{
                                unset($forum['threadperms'][$id]);
                        }
                }
                $html .= '</select>';
                return $html;
        } else {
                return '';
        }
}

function updatecredits($uid, $creditsarray, $coef = 1, $extrasql = '') {
        if($uid && ((!empty($creditsarray) && is_array($creditsarray)) || $extrasql)) {
                global $db, $tablepre;
                $creditsadd = $comma = '';
                foreach($creditsarray as $id => $addcredits) {
                        if(!empty($addcredits)) {
                                $creditsadd .= $comma.'extcredits'.$id.'=extcredits'.$id.'+('.intval($addcredits).')*('.$coef.')';
                                $comma = ', ';
                        }
                }

                if($creditsadd || $extrasql) {
                        $db->query("UPDATE {$tablepre}members SET $creditsadd ".($creditsadd && $extrasql ? ', ' : '')." $extrasql WHERE uid='$uid'", 'UNBUFFERED');
                }
        }
}

function updatesession() {
        if(empty($GLOBALS['sessionupdated'])) {
                global $db, $tablepre, $sessionexists, $sessionupdated, $sid, $onlineip, $discuz_uid, $discuz_user, $timestamp, $lastactivity, $seccode,$lastolupdate, $oltimespan, $onlinehold, $groupid, $styleid, $invisible, $discuz_action, $fid, $tid, $bloguid, $onlinehold;
               
                $fid                        = (int)$fid;
                $seccode                = (int)$seccode;
                $tid                        = (int)$tid;
                $lastolupdate        = (int)$lastolupdate;
               
                if($sessionexists == 1) {

                        if($oltimespan && $discuz_uid && $lastactivity && ($timestamp - ($lastolupdate ? $lastolupdate : $lastactivity) > $oltimespan * 60) ) {
                                $lastolupdate = $timestamp;
                                $db->query("UPDATE {$tablepre}onlinetime SET total=total+'$oltimespan', thismonth=".(gmdate('Yn', $timestamp) == gmdate('Yn', $lastactivity) ? 'thismonth' : 0)."+'$oltimespan', lastolupdate='$lastolupdate' WHERE uid='$discuz_uid' AND lastolupdate<=".($timestamp - $oltimespan*60));
                                       
                                if(!$db->affected_rows()) {
                                        $db->query("INSERT INTO {$tablepre}onlinetime (uid, thismonth, total, lastolupdate)
                                        VALUES ('$discuz_uid', '$oltimespan', '$oltimespan', '$timestamp')", 'SILENT');
                                }
                        }
                        $db->query("UPDATE {$tablepre}sessions SET uid='$discuz_uid', username='$discuz_user', groupid='$groupid', styleid='$styleid', invisible='$invisible', action='$discuz_action', lastactivity='$timestamp', fid='$fid', tid='$tid', seccode='$seccode', bloguid='$bloguid', lastolupdate='$lastolupdate' WHERE sid='$sid'");

                } else {

                        $ips = explode('.', $onlineip);

                        $db->query("DELETE FROM {$tablepre}sessions WHERE sid='$sid' OR lastactivity<($timestamp-$onlinehold) OR ('$discuz_uid'<>'0' AND uid='$discuz_uid') OR (uid='0' AND ip1='$ips[0]' AND ip2='$ips[1]' AND ip3='$ips[2]' AND ip4='$ips[3]' AND lastactivity>$timestamp-60)");
                        $db->query("INSERT INTO {$tablepre}sessions (sid, ip1, ip2, ip3, ip4, uid, username, groupid, styleid, invisible, action, lastactivity, lastolupdate, seccode, fid, tid, bloguid)
                                VALUES ('$sid', '$ips[0]', '$ips[1]', '$ips[2]', '$ips[3]', '$discuz_uid', '$discuz_user', '$groupid', '$styleid', '$invisible', '$discuz_action', '$timestamp', '0','$seccode', '$fid', '$tid', '$bloguid')", 'SILENT');
                        if($discuz_uid) {
                                $db->query("UPDATE {$tablepre}members SET lastip='$onlineip', lastvisit=lastactivity, lastactivity='$timestamp' WHERE uid='$discuz_uid'", 'UNBUFFERED');
                                if($oltimespan && gmdate('Yn', $timestamp) != gmdate('Yn', $lastactivity)) {
                                        $db->query("UPDATE {$tablepre}onlinetime SET thismonth='0' WHERE uid='$discuz_uid'");
                                }
                        }

                }

                $sessionupdated = 1;
        }
}


function updatemodworks($action,$times=1) {
        global $modworkstatus,$db,$tablepre,$discuz_uid,$timestamp;

        if ( !$modworkstatus || empty($discuz_uid) || !intval($times) ) return;
        if (in_array($action,array( 'uid','EDT','DEL','DLP','PRN','UDL','DIG','UDG','CLS','OPN','STK','UST','SPL','MRG','HLT','UHL','BMP','MOV','TYP','RFD'))){
                $db->query("UPDATE {$tablepre}modworks set $action=$action+$times ,lastactive='$timestamp' WHERE uid='$discuz_uid'");
                if (!$db->affected_rows()){
                        $db->query("REPLACE INTO {$tablepre}modworks (uid , $action, lastactive) VALUES ('$discuz_uid','$times','$timestamp')",'SILENT');
                }
        }
}

function getthreadperms() {

        global $threadperms,$extcredits, $forum ;

        $return = array();

        if (empty($threadperms) || !( $perms = $forum['threadperms'] ) ) return $return;

        foreach( $perms as $id =>$forumperm) {
                if ( isset( $extcredits[$id]) || ( $id>8 && isset( $threadperms[$id])) ){
                        $return[$id] = $threadperms[$id];
                        $return[$id]['min'] = (isset($forumperm['min'])) ? $forumperm['min']: $return[$id]['min'];
                        $return[$id]['max'] = (isset($forumperm['max'])) ? $forumperm['max']: $return[$id]['max'];
                        $return[$id]['title'] = ( $id<9 ) ? $extcredits[$id]['title'] : $threadperms[$id]['title'];
                        $return[$id]['unit'] = ( $id<9 ) ? $extcredits[$id]['unit'] : $threadperms['unit'];
                        $return[$id]['thread'] = (isset($forumperm['thread'])) ? $forumperm['thread'] :'';
                        $return[$id]['attach'] = (isset($forumperm['attach'])) ? $forumperm['attach'] :'';
                        $return[$id]['sell'] = $forumperm['sell'];
                }
        }
        return $return;
}

function checkperms( $permid, $readperm, $operation="thread", $showmessage='0',$showpayment='0') {
        global $allowthreadperms;
        $return = 0;
        if( empty($permid) || !$allowthreadperms[$permid][$operation] ){
                $return = 1;
        } elseif( !empty($allowthreadperms[$permid]['sell'])){
                $return = 2;
        } elseif( $permid<9 ){
                $return = ($GLOBALS['extcredits'.$permid] < $readperm) ?  0 : 1;
        } elseif( $permid== 9 ){
                $return = ($GLOBALS['credits'] < $readperm) ?  0 : 1;
        } elseif( $permid== 10 ){
                $return = ($GLOBALS['readaccess'] < $readperm) ?  0 : 1;
        } elseif($checkcode = $allowthreadperms[$permid]['checkcode']){
                $discuz_checkperms = 0;
                @eval($checkcode);
                $return = $discuz_checkperms ? 1 : 0;
        }
        return $return;
}

function availableperms( $permid, $readperm,$type='thread',$showmessage = 0){
        global $allowthreadperms,$allowsetattachperm, $allowsetpostperm;

        if ($type == 'thread') {
                $permid = !empty($allowthreadperms[$permid][$type]) && $allowsetpostperm ? $permid : 0;
        }else{
                $permid = !empty($allowthreadperms[$permid][$type]) && $allowsetattachperm? $permid : 0;
        }
       
        if ( $permid ){
                $readperm = is_numeric($readperm) ? (float)$readperm : '';
                $readperm = $allowthreadperms[$permid]['sell'] && $readperm<0 ? 0 readperm;
        }else{
                $permid = 0;
                $readperm ='';
                return $permid;
        }
       
        if ($permid && is_numeric($readperm)){
                if ( (is_numeric($allowthreadperms[$permid]['min']) && $readperm<$allowthreadperms[$permid]['min']) || (is_numeric($allowthreadperms[$permid]['max']) && $readperm>$allowthreadperms[$permid]['max'])){
                        if ($showmessage){
                                showmessage('readperm_limit_error');
                        }else{
                                $permid = 0;
                                $readperm ='';
                        }
                }
        }else{
                $permid = 0;
                $readperm ='';
        }
        return $permid;
}
//==============禁言检查函数Begin===============

function postban_check($fid, $theuser){
    global $isadmin, $issupermod, $db, $postban;
    if (!$fid || !$theuser) return 1;
    if ($isadmin || $issupermod) return 1;
    else {
        $timestamp = time();
        $fid=intval($fid);
        if ($fid < 1) return 0;
        $post_bancount=$db->result($db->query("select count(*) FROM cdb_postban where (fid='$fid' or fid='65535')

AND username='$theuser' AND timelimit > $timestamp"), 0);
        if ($post_bancount) return 0;
        else return 1;
    }
}
//=====================END========================

?>

---------------------------
修改的newreply.inc.php

<?php

/*
        [DISCUZ!] include/newreply.inc.php - post replying for post module
        This is NOT a freeware, use is subject to license terms

        Version: 3.0.0
        Web: http://www.comsenz.com
        Copyright: 2001-2005 Comsenz Technology Ltd.
*/

if(!defined('IN_DISCUZ')) {
        exit('Access Denied');
}

$discuz_action = 12;

if(!$discuz_uid && !((!$forum['replyperm'] && $allowreply) || ($forum['replyperm'] && strstr($forum['replyperm'], "\t$groupid\t")))) {
        showmessage('group_nopermission', NULL, 'NOPERM');
} elseif(empty($forum['allowreply'])) {
        if(!$forum['replyperm'] && !$allowreply) {
                showmessage('group_nopermission', NULL, 'NOPERM');
        } elseif($forum['replyperm'] && !strstr($forum['replyperm'], "\t$groupid\t")) {
                showmessage('post_forum_newreply_nopermission', NULL, 'HALTED');
        }
}

if(empty($thread)) {
        showmessage('thread_nonexistence');
}

checklowerlimit($replycredits);
if(!submitcheck('replysubmit')) {

        if(isset($repquote)) {

                include_once language('misc');

                $query = $db->query("SELECT tid, fid, first, author, message, useip, dateline FROM {$tablepre}posts WHERE pid='$repquote' AND invisible='0'");
                $thaquote = $db->fetch_array($query);
                if($thaquote['tid'] != $tid) {
                        showmessage('undefined_action', NULL, 'HALTED');
                }

                $message = (!$thaquote['first'] || !$thread['permid']) ? $thaquote['message'] : $language['post_perms_isset'];


                $time = gmdate("$dateformat $timeformat", $thaquote['dateline'] + ($timeoffset * 3600));
                $message = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "$language[post_hidden]", $message);
                $message = preg_replace("/(\[quote])(.*)(\[\/quote])/siU", "", $message);
                $message = preg_replace($language['post_edit_regexp'], '', $message);
                $message = cutstr(dhtmlspecialchars($message), 200);

                $thaquote['useip'] = substr($thaquote['useip'], 0, strrpos($thaquote['useip'], '.')).'.x';
                $thaquote['author'] = $thaquote['author'] ? "$thaquote[author]" : "Guest from $thaquote[useip]";

                eval("\$language['post_reply_quote'] = \"$language[post_reply_quote]\";");
                $message = "[quote]$language[post_reply_quote]\n\n$message
\n";
                $attachupload = getattacharray();

        }

        if($thread['replies'] <= $ppp) {
                $postlist = array();
                $query = $db->query("SELECT * FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline DESC");
                while($post = $db->fetch_array($query)) {
                        $post['thisbg'] = $thisbg = isset($thisbg) && $thisbg == 'altbg1' ? 'altbg2' : 'altbg1';
                        $post['dateline'] = gmdate("$dateformat $timeformat", $post[dateline] + $timeoffset * 3600);;
                       
                        if(!$post['first'] || !$thread['permid']){
                                $post['message'] = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "$language[post_hidden]", $post['message']);
                               
                                $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'], $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'], $forum['allowhtml'], $forum['jammer']);
                        }else{
                                $post['message'] = $language['post_perms_isset_html'];
                        }
                        $postlist[] = $post;
                }
        }

        $postpermoption = $attachpermoption = $threadpermselect ='';
        if ($allowthreadperms){
                foreach ($allowthreadperms as $permid=>$perm){
                        $perm['title']= strip_tags($perm['title']).($perm['sell'] ? ' - $$ ' : '');
                        $attachpermoption .= ($perm['attach'] &&  ( (!$perm['sell'] && $allowsetattachperm ) || ($perm['sell'] && $allowsetattachprice) )) ? "<option value=\"$permid\">$perm[title]</option>":'';
                }
        }

        $attachupload = getattacharray();

        include template('post_newreply');

} else {

        require_once DISCUZ_ROOT.'./include/forum.func.php';

//===========板块禁言检查begin========
if (!$ismoderator) {
    if (!postban_check($forum[fid], $discuz_user)) showmessage('你在本板块被禁言,不能发贴和编辑');
}
//===========板块禁言检查end==========

        if($subject == '' && $message == '') {
                showmessage('post_sm_isnull');
        }

        if($thread['closed'] && !$forum['ismoderator']) {
                showmessage('post_thread_closed');
        }

        if($post_autoclose = checkautoclose()) {
                showmessage($post_autoclose);
        }

        if($post_invalid = checkpost()) {
                showmessage($post_invalid);
        }

        if(checkflood()) {
                showmessage('post_flood_ctrl');
        }

        if(!empty($_FILES['attach'])) {
                checklowerlimit($creditspolicy['postattach']);
        }
        $attachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0;
        $lastnotifytime = $timestamp - 86400;
        $emails = $comma = '';
        $query = $db->query("SELECT email FROM {$tablepre}subscriptions WHERE uid<>'$discuz_uid' AND tid='$tid' AND lastnotify<'$lastnotifytime'");
        while($subs = $db->fetch_array($query)) {
                $emails .= $comma.$subs['email'];
                $comma = ', ';
        }
        if($emails) {
                sendmail($emails, 'email_notify_subject', 'email_notify_message');
                $db->query("UPDATE {$tablepre}subscriptions SET lastnotify=$timestamp WHERE tid='$tid' AND lastnotify<'$lastnotifytime'", 'UNBUFFERED');
        }
        if(!empty($emailnotify) && $discuz_uid) {
                $db->query("INSERT INTO {$tablepre}subscriptions (uid, email, tid)
                                VALUES ('$discuz_uid', '$email', '$tid')", 'SILENT');
        }


        $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));
        $smileyoff = checksmilies($message, !empty($smileyoff));
        $parseurloff = !empty($parseurloff);
        $htmlon = $allowhtml && !empty($htmlon) ? 1 : 0;

        $pinvisible = $modnewreplies ? 2 : 0;

        $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)
                        VALUES ('$fid', '$tid', '0','$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$message', '$onlineip', '$pinvisible', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
        $pid = $db->insert_id();

        if($attachment) {
                foreach($attachments as $attach) {

                        $db->query("INSERT INTO {$tablepre}attachments (tid, pid,displayorder, dateline, permid,readperm, filename, description, filetype, filesize, attachment, downloads)
                                VALUES ('$tid', '$pid','$attach[order]' ,'$timestamp','$attach[permid]','$attach[readperm]', '$attach[name]',  '$attach[description]','$attach[type]', '$attach[size]', '$attach[attachment]', '0')");
                }
                updatecredits($discuz_uid, $creditspolicy['postattach'], count($attachments));
        }

        if($modnewreplies) {
                empty($blog) ? showmessage('post_reply_mod_succeed', "forumdisplay.php?fid=$fid") :
                        showmessage('post_reply_mod_blog_succeed', "blog.php?tid=$tid&starttime=$starttime&endtime=$endtime&page=$page");
        } else {
                $db->query("UPDATE {$tablepre}threads SET lastposter='$discuz_user', lastpost='$timestamp', replies=replies+1 ".($attachment ? ', attachment=\'1\'' : '')." WHERE tid='$tid' AND fid='$fid'", 'UNBUFFERED');

                updatepostcredits('+', $discuz_uid, $replycredits);

                $lastpost = "$thread[tid]\t".addslashes($thread['subject'])."\t$timestamp\t$discuz_user";
                $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', posts=posts+1, todayposts=".todayposts()." WHERE fid='$fid'", 'UNBUFFERED');
                if($forum['type'] == 'sub') {
                        $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED');
                }

                @$topicpages = ceil(($thread['replies'] + 2) / $ppp);

                empty($blog) ? showmessage('post_reply_succeed', "viewthread.php?tid=$tid&pid=$pid&page=$topicpages#pid$pid") :
                        showmessage('post_reply_blog_succeed', "blog.php?tid=$tid&starttime=$starttime&endtime=$endtime&page=$page");
        }

}

?>
[/quote]
-----------------
回复

使用道具 举报

jinlun721 发表于 2005-11-25 20:31:52 | 显示全部楼层
修改的newthread.inc.php

<?php

/*
        [DISCUZ!] include/newthread.inc.php - starting new thread for post module
        This is NOT a freeware, use is subject to license terms

        Version: 3.0.0
        Web: http://www.comsenz.com
        Copyright: 2001-2005 Comsenz Technology Ltd.
*/

if(!defined('IN_DISCUZ')) {
        exit('Access Denied');
}

$discuz_action = 11;

if(empty($forum['fid']) || $forum['type'] == 'group') {
        showmessage('forum_nonexistence');
}

if(!$discuz_uid && !((!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")))) {
        showmessage('group_nopermission', NULL, 'NOPERM');
} elseif(empty($forum['allowpost'])) {
        if(!$forum['postperm'] && !$allowpost) {
                showmessage('group_nopermission', NULL, 'NOPERM');
        } elseif($forum['postperm'] && !strstr($forum['postperm'], "\t$groupid\t")) {
                showmessage('post_forum_newthread_nopermission', NULL, 'HALTED');
        }
}

checklowerlimit($postcredits);
if(!submitcheck('topicsubmit')) {

        $typeselect = typeselect($typeid);
       
        $threadpermselect = $postpermoption = $attachpermoption = '';
        if ($allowthreadperms){
                foreach ($allowthreadperms as $permid=>$perm){
                        $perm['title']= strip_tags($perm['title']).($perm['sell'] ? ' - $$ ' : '');
                        $postpermoption .= ( $perm['thread'] && ( (!$perm['sell'] && $allowsetpostperm ) || ($perm['sell'] && $allowsetpostprice) ) ) ? "<option value=\"$permid\"".($permid==$thread['permid']?' selected':'').">$perm[title]</option>" :'';
                        $attachpermoption .= ($perm['attach'] &&  ( (!$perm['sell'] && $allowsetattachperm ) || ($perm['sell'] && $allowsetattachprice) )) ? "<option value=\"$permid\">$perm[title]</option>":'';
                }
                $threadpermselect .= $postpermoption ? '<select name="permid"><option value="0">&nbsp;</option>'.$postpermoption.'</select>': '';
        }

        $icons = '';
        if(is_array($_DCACHE['icons'])) {
                $key = 1;
                foreach($_DCACHE['icons'] as $id => $icon) {
                        $icons .= ' <input type="radio" name="iconid" value="'.$id.'"><img src="'.SMDIR.'/'.$icon.'">';
                        $icons .= !(++$key % 10) ? '<br>' : '';
                }
        }

        $attachupload = getattacharray();

        include template('post_newthread');

} else {
//===========板块禁言检查begin========
if (!$ismoderator) {
    if (!postban_check($forum[fid], $discuz_user)) showmessage('你在本板块被禁言,不能发贴和编辑');
}
//===========板块禁言检查end==========


        if($subject == '' || $message == '') {
                showmessage('post_sm_isnull');
        }

        if($post_invalid = checkpost()) {
                showmessage($post_invalid);
        }

        if(checkflood()) {
                showmessage('post_flood_ctrl');
        }

        if(!empty($_FILES['attach'])) {
                checklowerlimit($creditspolicy['postattach']);
        }
        $typeid = isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0;
       
        availableperms( &$permid,&$readperm, 'thread',1);

        $iconid = !empty($iconid) && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0;
        $displayorder = $modnewthreads ? -2 : (($forum['ismoderator'] && $sticktopic) ? 1 : 0);
        $digest = ($forum['ismoderator'] && $addtodigest) ? 1 : 0;
        $blog = $allowuseblog && $addtoblog ? 1 : 0;

        if(!$typeid && $forum['threadtypes']['required']) {
                showmessage('post_type_isnull');
        }
        if(isset($poll) && $allowpostpoll && trim($polloptions)) {
                $poll = 1;
                $pollarray = array();
                $polloptions = explode("\n", $polloptions);
                if(count($polloptions) > $maxpolloptions) {
                        showmessage('post_poll_option_toomany');
                }

                foreach($polloptions as $polloption) {
                        $polloption = trim($polloption);
                        if($polloption) {
                                $pollarray['options'][] = array($polloption, 0);
                        }
                }
                $pollarray['multiple'] = !empty($multiplepoll);
                $pollarray['voters'] = array();
                $pollopts = addslashes(serialize($pollarray));
        } elseif(isset($trade) && $allowposttrade && !empty($seller) && !empty($item_name) && !empty($item_price)) {
                include language('misc');

                $message = "$language[post_trade_seller]: $seller\r\n\r\n".
                        "$language[post_trade_name]: $item_name\r\n\r\n".
                        "$language[post_trade_price]: $item_price $language[post_trade_yuan]\r\n\r\n".
                        (!empty($item_quality) ? "$language[post_trade_quality]: $item_quality\r\n\r\n" : '').
                        (!empty($item_locus) ? "$language[post_trade_locus]: $item_locus\r\n\r\n" : '').
                        "$language[post_trade_postage]: ".(empty($postage_mail) && empty($postage_express) ? $language['post_trade_postage_seller'] : $language['post_trade_postage_buyer']).(!empty($postage_mail) ? ", $language[post_trade_postage_mail] $postage_mail $language[post_trade_yuan]" : '').(!empty($postage_express) ? ", $language[post_trade_postage_express] $postage_express $language[post_trade_yuan]" : '')."\r\n\r\n".
                        "$language[post_trade_description]:\r\n\r\n".
                        "[payto]\r\n".
                        "(seller)$seller(/seller)\r\n".
                        "(subject)$item_name(/subject)\r\n".
                        "(body)".cutstr($message, 400)."(/body)\r\n".
                        "(price)$item_price(/price)\r\n".
                        "(ordinary_fee)$postage_mail(/ordinary_fee)\r\n".
                        "(express_fee)$postage_express(/express_fee)\r\n".
                        "[/payto]\r\n\r\n".
                        $message;
                $iconid = 25;
        } else {
                $poll = 0;
                $pollopts = '';
        }

        $moderated = $digest || $displayorder > 0 ? 1 : 0;
        $attachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0;

        $db->query("INSERT INTO {$tablepre}threads (fid, readperm, permid, iconid, typeid,author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, blog, poll, attachment, moderated)
                VALUES ('$fid', '$readperm', '$permid', '$iconid', '$typeid','$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$discuz_user', '$displayorder', '$digest', '$blog', '$poll', '$attachment', '$moderated')");
        $tid = $db->insert_id();

        if($moderated) {
                updatemodlog($tid, ($displayorder > 0 ? 'STK' : 'DIG'));
        }

        if($poll) {
                $db->query("INSERT INTO {$tablepre}polls (tid, pollopts)
                        VALUES ('$tid', '$pollopts')");
        }

        $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));

        $smileyoff = checksmilies($message, !empty($smileyoff));
        $parseurloff = !empty($parseurloff);
        $htmlon = $allowhtml && !empty($htmlon) ;

        $pinvisible = $modnewthreads ? -2 : 0;
        //$usesig = (int)$usesig;
        $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)
                VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$message', '$onlineip', '$pinvisible', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
        $pid = $db->insert_id();

        if($attachment) {
                foreach($attachments as $attach) {

                        $db->query("INSERT INTO {$tablepre}attachments (tid, pid,displayorder, dateline, permid,readperm, filename, description, filetype, filesize, attachment, downloads)
                                VALUES ('$tid', '$pid','$attach[order]' ,'$timestamp','$attach[permid]','$attach[readperm]', '$attach[name]',  '$attach[description]','$attach[type]', '$attach[size]', '$attach[attachment]', '0')");
                }
                updatecredits($discuz_uid, $creditspolicy['postattach'], count($attachments));
        }

        if($modnewthreads) {
                showmessage('post_newthread_mod_succeed', "forumdisplay.php?fid=$fid");
        } else {
                updatepostcredits('+', $discuz_uid, $postcredits);

                $lastpost = "$tid\t$subject\t$timestamp\t$discuz_user";
                $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', threads=threads+1, posts=posts+1, todayposts=".todayposts()." WHERE fid='$fid'", 'UNBUFFERED');
                if($forum['type'] == 'sub') {
                        $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED');
                }

                if(!empty($emailnotify) && $discuz_uid) {
                        $query = $db->query("SELECT tid FROM {$tablepre}subscriptions WHERE uid='$discuz_uid' AND tid='$tid'");
                        if(!$db->result($query, 0)) {
                                $db->query("INSERT INTO {$tablepre}subscriptions (uid, email, tid)
                                        VALUES ('$discuz_uid', '$email', '$tid')", 'UNBUFFERED');
                        }
                }
                showmessage('post_newthread_succeed', "viewthread.php?tid=$tid");
        }

}

?>


----------------------------

升级数据库及导入都正常的 怎么没有逮人功能?文件也都上船了 奇怪了
回复

使用道具 举报

 楼主| freddy 发表于 2005-11-25 21:34:39 | 显示全部楼层
不可能没有逮人功能的.除非你的权限有问题.
回复

使用道具 举报

 楼主| freddy 发表于 2005-11-25 21:36:26 | 显示全部楼层
回复

使用道具 举报

jinlun721 发表于 2005-11-25 21:40:31 | 显示全部楼层
原帖由 freddy 于 2005-11-25 21:36 发表
http://bbs.jinlunhotel.cn/plugin ... jail&action=add

监狱首页 怎么显示阿
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-6 02:06 , Processed in 0.162287 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表