author | Dan |
Wed, 17 Oct 2007 20:23:51 -0400 | |
changeset 1 | 6f8b7c6fac02 |
parent 0 | 0417a5a0c7be |
child 5 | 6eea55374f5b |
permissions | -rw-r--r-- |
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 |
|
1
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
52 |
if ( $row['post_id'] ) |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
53 |
{ |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
54 |
$last_post_data = '<small> |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
55 |
<a href="' . makeUrlNS('DecirTopic', $row['topic_id']) . '#post' . $row['post_id'] . '">' . $row['topic_title'] . '</a><br /> |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
56 |
' . date('d M Y h:i a', $row['timestamp']) . '<br /> |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
57 |
by <b><a style="color: #' . $color . '" href="' . makeUrlNS('User', $row['username']) . '">' . $row['username'] . '</a></b> |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
58 |
</small>'; |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
59 |
} |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
60 |
else |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
61 |
{ |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
62 |
$last_post_data = 'No posts'; |
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
63 |
} |
0 | 64 |
echo '<tr><td class="row3" style="text-align: center;"><icon></td><td class="row2"><b><a href="' . makeUrlNS('DecirForum', $row['forum_id']) . '">' |
65 |
. $row['forum_name'] . '</a></b><br />' . $row['forum_desc'].'</td> |
|
66 |
<td class="row3" style="text-align: center;">' . $row['num_topics'] . '</td> |
|
67 |
<td class="row3" style="text-align: center;">' . $row['num_posts'] . '</td> |
|
68 |
<td class="row1" style="text-align: center;"> |
|
1
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
69 |
' . $last_post_data . ' |
0 | 70 |
</td> |
71 |
</tr>'; |
|
72 |
break; |
|
73 |
case FORUM_CATEGORY: |
|
74 |
// Category |
|
75 |
if ( $cat_open ) |
|
76 |
echo '</tbody>'; |
|
77 |
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> |
|
78 |
<tbody id="forum_cat_' . $row['forum_id'] . '">'; |
|
79 |
$cat_open = true; |
|
80 |
break; |
|
81 |
} |
|
82 |
} while ( $row = $db->fetchrow($q) ); |
|
83 |
} |
|
84 |
else |
|
85 |
{ |
|
1
6f8b7c6fac02
Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents:
0
diff
changeset
|
86 |
echo '<td class="row1" colspan="5">This board has no forums.</td>'; |
0 | 87 |
} |
88 |
if ( $cat_open ) |
|
89 |
echo '</tbody>'; |
|
90 |
echo '</table> |
|
91 |
</div>'; |
|
92 |
||
93 |
$template->footer(); |
|
94 |
||
95 |
?> |