-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbbsbfind.php
164 lines (149 loc) · 4.65 KB
/
bbsbfind.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
require_once("www2-funcs.php");
require_once('www2-board.php');
login_init();
bbs_session_modify_user_mode(BBS_MODE_READING);
if( !isset($_GET["board"]) && !isset($_POST["board"]))
html_error_quit("错误的讨论区");
if( isset($_GET["board"]) )
$board = $_GET["board"];
else
$board = $_POST["board"];
$brdarr = array();
$brdnum = bbs_getboard($board, $brdarr);
if ($brdnum == 0){
html_error_quit("错误的讨论区");
}
$usernum = $currentuser["index"];
if (bbs_checkreadperm($usernum, $brdnum) == 0){
html_error_quit("错误的讨论区");
}
$board = $brdarr["NAME"];
$isnormalboard = bbs_normalboard($board);
if ($isnormalboard) {
$dotdirname = bbs_get_board_index($board, $dir_modes["NORMAL"]);
if (cache_header("public",@filemtime($dotdirname),300))
return;
}
bbs_board_header($brdarr,-2,0);
$ann_path = bbs_getannpath($board);
if ($ann_path != FALSE) {
if (!strncmp($ann_path,"0Announce/",10))
$ann_path = substr($ann_path,9);
}
?>
<script type="text/javascript">
<!--
var c = new docWriter('<?php echo addslashes($board); ?>',<?php echo $brdarr["BID"]; ?>,0,0,-2,0,0,'<?php echo addslashes($ann_path); ?>',0);
//-->
</script>
<?php
if(!isset($_GET["q"])){
?>
<script type="text/javascript">
<!--
var str = '<table class="main wide"><tr height="5"><th></th></tr></table></div>';<?php /* </div>: dirty way ... for closing <div class="doc"> */ ?>
document.write(str + getFindBox('<?php echo $brdarr["NAME"]; ?>'));
//-->
</script>
<?php
page_footer();
exit;
}
if( isset( $_GET["title"] ) ){
$title = $_GET["title"];
}else
$title="";
if( isset( $_GET["title2"] ) ){
$title2 = $_GET["title2"];
}else
$title2="";
if( isset( $_GET["title3"] ) ){
$title3 = $_GET["title3"];
}else
$title3="";
if( isset( $_GET["userid"] ) ){
$userid = $_GET["userid"];
}else
$userid="";
if( isset( $_GET["dt"] ) ){
$dt = $_GET["dt"];
}else
$dt=0;
settype($dt, "integer");
if($dt <= 0)
$dt = 7;
else if($dt > 9999)
$dt = 9999;
if( isset( $_GET["mg"] ) ){
$mg = $_GET["mg"];
}else
$mg = "";
if($mg != "")
$mgon=1;
else
$mgon=0;
if( isset( $_GET["og"] ) ){
$og = $_GET["og"];
}else
$og = "";
if($og != "")
$ogon=1;
else
$ogon=0;
if( isset( $_GET["ag"] ) ){
$ag = $_GET["ag"];
}else
$ag = "";
if($ag != "")
$agon=1;
else
$agon=0;
function log_it($id, $ip, $board, $title, $title2, $title3, $userid, $dt, $mgon, $agon, $ogon, $num) {
$action = $board . " | " . $title . " | " . $title2 . " | " . $title3 . " | " . $userid . " | " . $dt . " | " . $mgon . " | " . $agon . " | " . $ogon . " | " . $num;
$action = "[".date("Y-m-d H:i:s")."] $id($ip) | ".$action."\n";
$logs = BBS_HOME . "/bbsbfind.log";
if(!($fn = fopen($logs,"a")))
return FALSE;
if (!flock ($fn, LOCK_EX))
{
fclose ($fh);
return FALSE;
}
fputs($fn,$action);
flock ($fn, LOCK_UN);
fclose($fn);
return TRUE;
}
$articles = bbs_search_articles($board, $title, $title2, $title3, $userid, $dt, $mgon, $agon, $ogon);
if( $articles <= 0 ){
html_error_quit("系统错误:".$articles);
}
// log_it($currentuser["userid"], $_SERVER["REMOTE_ADDR"], $board, $title, $title2, $title3, $userid, $dt, $mgon, $agon, $ogon, count($articles));
?>
<script>
var ta = new tabWriter(0,'main wide',0,[['编号','6%','center'],['标记','6%','center'],['作者','12%','center'],['日期','8%','center'],['标题',0,0]]);
<?php
foreach ($articles as $article)
{
$flags = $article["FLAGS"];
$col1 = $article["NUM"]+1;
$col2 = $flags[0] . $flags[3];
$col3 = '<a href="bbsqry.php?userid=' . $article["OWNER"] . '">' . $article["OWNER"] . '</a>';
$col4 = strftime("%b %e", $article["POSTTIME"]);
$col5 = '<a href="bbscon.php?bid=' . $brdnum . '&id=' . $article["ID"] . '">' . htmlspecialchars($article["TITLE"], ENT_QUOTES) . ' </a>';
echo "ta.r('$col1','$col2','$col3','$col4','$col5');\n";
}
$i = count($articles);
?>
ta.t();
</script>
</div><?php /* </div>: dirty way ... for closing <div class="doc"> */ ?>
<div class="oper">
查找讨论区"<?php echo $brdarr["NAME"];?>"内, 标题含: "<?php echo htmlspecialchars($title,ENT_QUOTES);?>"<?php if($title2!="") echo ' 和"'.htmlspecialchars($title2,ENT_QUOTES).'"';?><?php if($title3!="") echo ',不含"'.htmlspecialchars($title3,ENT_QUOTES).'"';?> 作者为: "<?php if($userid!="") echo $userid; else echo "所有者";?>", "<?php echo $dt;?>"天以内的 <?php if($mgon) echo "精华"; if($agon) echo "附件"; if($ogon) echo "主题";?>文章<br/>
共找到 <?php echo $i;?> 篇文章符合条件 <?php if($i>=999) echo "(匹配结果过多, 省略第1000以后的查询结果)";?>
[<a href="bbsdoc.php?board=<?php echo $brdarr["NAME"];?>">返回本讨论区</a>] [<a href="javascript:history.go(-1)">返回上一页</a>]
</div>
<?php
page_footer();
?>