ルートディレクトリのattachment.phpファイルを変更する必要があります
if (!empty($checktwo)) {
Add
} else {
echo before the last ?> $attachexists = $ispaid = FALSE; を追加します。 <script>alert('プロンプトしたい内容を書いてください')</script>";
echo "";
}
このマシンで Discuz をセットアップしました! 5.0.1 のデバッグに成功しました
完全なコードは次のとおりです:
/*
[Discuz!] (C)2001-2006 Comsenz Inc .
これはフリーウェアではありません。使用にはライセンス条項が適用されます
$RCSfile:attachment.php,v $
$リビジョン: 1.13 $
$Date: 2006/08/11 06:51:07 $
*/
require_once './include/common.inc.php';
$discuz_action = 14;
if($attachrefcheck && $_SERVER['HTTP_REFERER'] && preg_replace("/https?://([^/]+) .* /i", "\1", $_SERVER['HTTP_REFERER']) != $_SERVER['HTTP_HOST']) {
//header("場所: {$boardurl}images/common/invalidreferer.gif" );
showmessage('attachment_referer_invalid', NULL, 'HALTED');
/*
$query = $db->query("SELECT a.*, t.fid, p.authorid FROM {$tablepre}添付ファイル a 、{$tablepre}スレッド t、{$tablepre}投稿 p
WHERE a.aid='$aid' AND t.tid=a.tid AND p.pid=a.pid AND t.displayorder>='0 ' AND p.invisible='0'");
$attach = $db->fetch_array($query);
*/
periodscheck('attachbanperiods');
$attachexists = $ispaid = FALSE;
if ( !empty ($checktwo)) {
if(!empty($aid)) {
$query = $db->query("SELECT * FROM {$tablepre}attachments WHERE aid='$aid'"); if( $attach = $db->fetch_array($query)) {
$query = $db->query("SELECT tid、fid、price、special FROM {$tablepre}threads WHERE tid='$attach[ tid] ' AND displayorder>='0'");
$thread = $db->fetch_array($query);
if($thread['fid']) {
$query = $db->query (" SELECT authorid FROM {$tablepre}posts WHERE pid='$attach[pid]' AND hidden='0'");
if($db->num_rows($query)) {
$attach['authorid '] = $db->result($query, 0);
$attachexists = TRUE
}
}
}
if($attach['readperm'] && $attach['readperm; '] > $readaccess) && $adminid showmessage('attachment_forum_nopermission', NULL, 'NOPERM');
if (!$thread['special'] && $thread['price'] > 0 && (!$discuz_uid || ($discuz_uid && $discuz_uid != $attach['authorid'] && $adminid <= 0) )) {
$query = $db->query("SELECT uid FROM {$tablepre}paymentlog WHERE uid='$discuz_uid' AND tid='$attach[tid]'"); -> ;result($query, 0)) {
$ispaid = TRUE;
} else {
showmessage('attachment_payto', 'viewthread.php?tid='.$attach['tid']); }
$filename = $attachdir.'/'.$attach['attachment'];
if(is_readable($filename) && $attachexists) {
$query = $db->query("SELECT f.viewperm, f. getattachperm、f.getattachcredits、a.allowgetattach FROM {$tablepre}フォーラムフィールド f
LEFT JOIN {$tablepre}ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.fid= '$ thread[fid]'");
$forum = $db->fetch_array($query);
if(!$ispaid) {
if(!$forum['allowgetattach']) {
if(! $forum ['getattachperm'] && !$allowgetattach) {
showmessage('group_nopermission', NULL, 'NOPERM'); elseif(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] &&!forumperm($forum['viewperm']))) {
showmessage ('attachment_forum_nopermission', NULL, 'NOPERM');
}
}
}
if(!($isimage = preg_match("/^image/.+/", $attach['filetype']))) {
check lowerlimit($creditspolicy['getattach'], -1 );
}
if(empty($noupdate)) {
if($delayviewcount == 2 || $delayviewcount == 3) {
$logfile = './forumdata/cache/cache_attachviews.log';
if(substr($timestamp, -1) == '0') {
require_once DISCUZ_ROOT.'./include/misc.func.php';
updateviews('attachments', 'aid', 'downloads', $logfile);
}
if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
fwrite($fp, "$aidn");
fclose($fp);
} elseif($adminid == 1) {
showmessage('view_log_invalid');
}
} else {
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
}
}
if(!$isimage) {
$forum['getattachcredits'] = $forum['getattachcredits'] ? unserialize($forum['getattachcredits']) : array();
$getattachcredits = $forum['getattachcredits'] ? $forum['getattachcredits'] : $creditspolicy['getattach'];
updatecredits($discuz_uid, $getattachcredits, -1);
}
$filesize = ファイルサイズ($filename);
ob_end_clean();
header('キャッシュ制御: max-age=31536000');
header('有効期限: '.gmdate('D, d M Y H:i:s', $timestamp + 31536000).' GMT');
header('Content-Encoding: none');
$attach['filename'] = (strto lower($charset) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? urlencode($attach['filename']) : $attach['filename'];
if($isimage && !empty($noupdate)) {
header('Content-Disposition: inline; filename='.$attach['filename']);
} else {
header('Content-Disposition: attachment; filename='.$attach['filename']);
}
header('Content-Type: '.$attach['filetype']);
@$fp = fopen($filename, 'rb');
@flock($fp, 2);
$attachment = @fread($fp, $filesize);
@fclose($fp);
echo $attachment;
} else {
showmessage('attachment_nonexistence');
}
} else {
echo "<script>alert('$PHP_SELF')</script>";
echo "";
}
?>