0
|
1 |
<?php
|
|
2 |
/*
|
|
3 |
* Decir
|
|
4 |
* Version 0.1
|
|
5 |
* Copyright (C) 2007 Dan Fuhry
|
|
6 |
* install.php - Database installation wizard
|
|
7 |
*
|
|
8 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
|
|
9 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
12 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
|
|
13 |
*/
|
|
14 |
|
|
15 |
require('common.php');
|
|
16 |
|
|
17 |
$template->header();
|
|
18 |
|
|
19 |
// Not much left now but to just do it...
|
|
20 |
$q = $db->sql_query('SELECT f.forum_id,f.forum_type,f.forum_name,f.forum_desc,f.num_topics,f.num_posts,
|
|
21 |
p.post_id,t.topic_id,t.topic_title,u.username,u.user_level,p.timestamp FROM '.table_prefix.'decir_forums AS f
|
|
22 |
LEFT JOIN '.table_prefix.'decir_topics AS t
|
|
23 |
ON (t.forum_id=f.forum_id)
|
|
24 |
LEFT JOIN '.table_prefix.'decir_posts AS p
|
|
25 |
ON (p.topic_id=t.topic_id)
|
|
26 |
LEFT JOIN '.table_prefix.'users AS u
|
|
27 |
ON (u.user_id=f.last_post_user OR f.last_post_user IS NULL)
|
|
28 |
WHERE ( t.topic_id=f.last_post_topic AND p.post_id=f.last_post_id ) OR ( f.last_post_topic IS NULL AND f.last_post_id IS NULL )
|
|
29 |
GROUP BY f.parent,f.forum_id
|
|
30 |
ORDER BY f.forum_order;');
|
|
31 |
|
|
32 |
if (!$q)
|
|
33 |
$db->_die();
|
|
34 |
|
|
35 |
echo '<div class="tblholder">
|
|
36 |
<table border="0" cellspacing="1" cellpadding="4">
|
|
37 |
<tr>
|
|
38 |
<th colspan="2">Forum</th>
|
|
39 |
<th style="max-width: 50px;">Topics</th>
|
|
40 |
<th style="max-width: 50px;">Posts</th>
|
|
41 |
<th>Last post</th>
|
|
42 |
</tr>';
|
|
43 |
$cat_open = false;
|
|
44 |
if ( $row = $db->fetchrow($q) )
|
|
45 |
{
|
|
46 |
do {
|
|
47 |
switch ( $row['forum_type'] )
|
|
48 |
{
|
|
49 |
case FORUM_FORUM:
|
|
50 |
$color = ( $row['user_level'] >= USER_LEVEL_ADMIN ) ? 'AA0000' : ( ( $row['user_level'] >= USER_LEVEL_MOD ) ? '00AA00' : '0000AA' );
|
|
51 |
// Forum
|
|
52 |
echo '<tr><td class="row3" style="text-align: center;"><icon></td><td class="row2"><b><a href="' . makeUrlNS('DecirForum', $row['forum_id']) . '">'
|
|
53 |
. $row['forum_name'] . '</a></b><br />' . $row['forum_desc'].'</td>
|
|
54 |
<td class="row3" style="text-align: center;">' . $row['num_topics'] . '</td>
|
|
55 |
<td class="row3" style="text-align: center;">' . $row['num_posts'] . '</td>
|
|
56 |
<td class="row1" style="text-align: center;">
|
|
57 |
<small>
|
|
58 |
<a href="' . makeUrlNS('DecirTopic', $row['topic_id']) . '#post' . $row['post_id'] . '">' . $row['topic_title'] . '</a><br />
|
|
59 |
' . date('d M Y h:i a', $row['timestamp']) . '<br />
|
|
60 |
by <b><a style="color: #' . $color . '" href="' . makeUrlNS('User', $row['username']) . '">' . $row['username'] . '</a></b>
|
|
61 |
</small>
|
|
62 |
</td>
|
|
63 |
</tr>';
|
|
64 |
break;
|
|
65 |
case FORUM_CATEGORY:
|
|
66 |
// Category
|
|
67 |
if ( $cat_open )
|
|
68 |
echo '</tbody>';
|
|
69 |
echo '<tr><td class="row1" colspan="2"><h3 style="margin: 0; padding: 0;">' . $row['forum_name'] . '</h3></td><td class="row2" colspan="3"></td></tr>
|
|
70 |
<tbody id="forum_cat_' . $row['forum_id'] . '">';
|
|
71 |
$cat_open = true;
|
|
72 |
break;
|
|
73 |
}
|
|
74 |
} while ( $row = $db->fetchrow($q) );
|
|
75 |
}
|
|
76 |
else
|
|
77 |
{
|
|
78 |
echo '<td class="row1" colspan="4">This board has no forums.</td>';
|
|
79 |
}
|
|
80 |
if ( $cat_open )
|
|
81 |
echo '</tbody>';
|
|
82 |
echo '</table>
|
|
83 |
</div>';
|
|
84 |
|
|
85 |
$template->footer();
|
|
86 |
|
|
87 |
?>
|