diff -r 5e1f1e916419 -r 98bbc533541c punbb/index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/index.php Sun Apr 06 00:28:50 2008 -0400 @@ -0,0 +1,270 @@ + $_ ) +{ + $$key =& $GLOBALS[$key]; +} + +($hook = get_hook('in_start')) ? eval($hook) : null; + +if ($pun_user['g_read_board'] == '0') + message($lang_common['No view']); + +// Load the index.php language file +require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php'; + +// Get list of forums and topics with new posts since last visit +if (!$pun_user['is_guest']) +{ + $query = array( + 'SELECT' => 't.forum_id, t.id, t.last_post', + 'FROM' => 'topics AS t', + 'JOINS' => array( + array( + 'INNER JOIN' => 'forums AS f', + 'ON' => 'f.id=t.forum_id' + ), + array( + 'LEFT JOIN' => 'forum_perms AS fp', + 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')' + ) + ), + 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL' + ); + + ($hook = get_hook('in_qr_get_new_topics')) ? eval($hook) : null; + $result = $pun_db->query_build($query, true) or error(__FILE__, __LINE__); + + $new_topics = array(); + while ($cur_topic = $pun_db->fetch_assoc($result)) + $new_topics[$cur_topic['forum_id']][$cur_topic['id']] = $cur_topic['last_post']; + + $tracked_topics = get_tracked_topics(); +} + +($hook = get_hook('in_pre_header_load')) ? eval($hook) : null; + +define('PUN_ALLOW_INDEX', 1); +define('PUN_PAGE', 'index'); + +require PUN_ROOT.'header.php'; + +// Print the categories and forums +$query = array( + 'SELECT' => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster', + 'FROM' => 'categories AS c', + 'JOINS' => array( + array( + 'INNER JOIN' => 'forums AS f', + 'ON' => 'c.id=f.cat_id' + ), + array( + 'LEFT JOIN' => 'forum_perms AS fp', + 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')' + ) + ), + 'WHERE' => 'fp.read_forum IS NULL OR fp.read_forum=1', + 'ORDER BY' => 'c.disp_position, c.id, f.disp_position' +); + +($hook = get_hook('in_qr_get_cats_and_forums')) ? eval($hook) : null; +$result = $pun_db->query_build($query, true) or error(__FILE__, __LINE__); + +?> +
+ +

+fetch_assoc($result)) +{ + ($hook = get_hook('in_forum_loop_start')) ? eval($hook) : null; + + $pun_page['item_mods'] = ''; + ++$pun_page['item_count']; + + if ($cur_forum['cid'] != $pun_page['cur_category']) // A new category since last iteration? + { + if ($pun_page['cur_category'] != 0) + { + +?> + + +
+ +
+

+
+ +
+ + + + + + + + + + + + +'.htmlspecialchars($cur_forum['forum_name']).''; + $cur_forum['num_topics'] = $cur_forum['num_posts'] = ' - '; + $pun_page['item_status'][] = 'redirect'; + $pun_page['item_alt_message'] = $lang_index['External forum']; + $pun_page['item_last_post'][] = $lang_common['Unknown']; + + if ($cur_forum['forum_desc'] != '') + $pun_page['item_subject'][] = $cur_forum['forum_desc']; + } + else + { + $pun_page['item_title'] = '

'.htmlspecialchars($cur_forum['forum_name']).'

'; + + // Are there new posts since our last visit? + if (!$pun_user['is_guest'] && $cur_forum['last_post'] > $pun_user['last_visit'] && (empty($tracked_topics['forums'][$cur_forum['fid']]) || $cur_forum['last_post'] > $tracked_topics['forums'][$cur_forum['fid']])) + { + // There are new posts in this forum, but have we read all of them already? + while (list($check_topic_id, $check_last_post) = @each($new_topics[$cur_forum['fid']])) + { + if (empty($tracked_topics['topics'][$check_topic_id]) || $tracked_topics['topics'][$check_topic_id] < $check_last_post) + { + $pun_page['item_status'][] = 'new'; + $pun_page['item_alt_message'] = $lang_index['Forum has new']; + break; + } + } + } + + if ($cur_forum['forum_desc'] != '') + $pun_page['item_subject'][] = $cur_forum['forum_desc']; + + if ($cur_forum['moderators'] != '') + { + $pun_page['mods_array'] = unserialize($cur_forum['moderators']); + $pun_page['item_mods'] = array(); + + while (list($mod_username, $mod_id) = @each($pun_page['mods_array'])) + $pun_page['item_mods'][] = ''.htmlspecialchars($mod_username).''; + + $pun_page['item_subject'][] = '('.sprintf($lang_index['Moderated by'], implode(', ', $pun_page['item_mods'])).')'; + } + + // If there is a last_post/last_poster. + if ($cur_forum['last_post'] != '') + { + $pun_page['item_last_post'][] = ''.format_time($cur_forum['last_post']).''; + $pun_page['item_last_post'][] = ''.sprintf($lang_common['By user'], htmlspecialchars($cur_forum['last_poster'])).''; + } + else + $pun_page['item_last_post'][] = $lang_common['Never']; + + if (empty($pun_page['item_status'])) + $pun_page['item_status'][] = 'normal'; + } + + $pun_page['item_style'] = (($pun_page['item_count'] % 2 != 0) ? 'odd' : 'even').' '.implode(' ', $pun_page['item_status']); + $pun_page['item_indicator'] = ''.$pun_page['item_alt_message'].''; + + ($hook = get_hook('in_row_pre_display')) ? eval($hook) : null; + +?> + + + + + + + + + 0) +{ + +?> + +
', $pun_page['item_subject']) ?>
+
+ + + +
+ +

+ +
+

+
+
+

+
+ +
+