/
main_page.php3
100 lines (93 loc) · 2.47 KB
/
main_page.php3
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
<?
# Mantis - a php based bugtracking system
# Copyright (C) 2000 Kenzaburo Ito - kenito@300baud.org
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
?>
<? include( "core_API.php" ) ?>
<? login_cookie_check() ?>
<? print_html_top() ?>
<? print_head_top() ?>
<? print_title( $g_window_title ) ?>
<? print_css( $g_css_include_file ) ?>
<? include( $g_meta_include_file ) ?>
<? print_head_bottom() ?>
<? print_body_top() ?>
<? print_header( $g_page_title ) ?>
<?
db_mysql_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );
### get news count
$query = "SELECT COUNT(id)
FROM $g_mantis_news_table";
$result = mysql_query( $query );
$total_news_count = mysql_result( $result, 0 );
### Show all news items
if ( isset( $f_show ) ) {
$query = "SELECT *
FROM $g_mantis_news_table
ORDER BY id DESC";
}
### Show only $g_limit items
else {
$query = "SELECT *
FROM $g_mantis_news_table
ORDER BY id DESC
LIMIT $g_news_view_limit";
}
$result = db_mysql_query( $query );
$news_count = mysql_num_rows( $result );
?>
<p>
<? print_menu( $g_menu_include_file ) ?>
<?
for ($i=0;$i<$news_count;$i++) {
$row = mysql_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, "v" );
$v_headline = string_display( $v_headline );
$v_body = string_display( $v_body );
$v_date_posted = date( "m-d H:i", sql_to_unix_time( $v_date_posted ) );
## grab the username and email of the poster
$query = "SELECT username, email
FROM $g_mantis_user_table
WHERE id='$v_poster_id'";
$result2 = mysql_query( $query );
if ( $result2 ) {
$row = mysql_fetch_array( $result2 );
$t_poster_name = $row["username"];
$t_poster_email = $row["email"];
}
?>
<p>
<div align=center>
<table width=75% bgcolor=<? echo $g_primary_border_color." ".$g_primary_table_tags ?>>
<tr>
<td bgcolor=<? echo $g_primary_color_dark ?>>
<b><? echo $v_headline ?></b> -
<i><? echo $v_date_posted ?></i> -
<a href="mailto:<? echo $t_poster_email ?>"><? echo $t_poster_name ?></a>
</td>
</tr>
<tr>
<td bgcolor=<? echo $g_primary_color_light ?>>
<br>
<blockquote>
<? echo $v_body ?>
</blockquote>
</td>
</tr>
</table>
</div>
<?
}
?>
<?
if ( $total_news_count > $news_count ) {
PRINT "<p>";
PRINT "<div align=center>";
PRINT "<a href=\"$g_main_page?f_show=all\">more news</a>";
PRINT "</div>";
}
?>
<? print_footer() ?>
<? print_body_bottom() ?>
<? print_html_bottom() ?>