137 generate_config_cache(); |
137 generate_config_cache(); |
138 require PUN_ROOT.'cache/cache_config.php'; |
138 require PUN_ROOT.'cache/cache_config.php'; |
139 } |
139 } |
140 |
140 |
141 // Make sure we (guests) have permission to read the forums |
141 // Make sure we (guests) have permission to read the forums |
142 $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
142 $result = $pun_db->query('SELECT g_read_board FROM '.$pun_db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $pun_db->error()); |
143 if ($db->result($result) == '0') |
143 if ($pun_db->result($result) == '0') |
144 exit('No permission'); |
144 exit('No permission'); |
145 |
145 |
146 |
146 |
147 // Attempt to load the common language file |
147 // Attempt to load the common language file |
148 @include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php'; |
148 @include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php'; |
215 echo "\t".'<link>'.$pun_config['o_base_url'].'/</link>'."\r\n"; |
215 echo "\t".'<link>'.$pun_config['o_base_url'].'/</link>'."\r\n"; |
216 echo "\t".'<description>'.pun_htmlspecialchars($rss_description.' '.$pun_config['o_board_title']).'</description>'."\r\n"; |
216 echo "\t".'<description>'.pun_htmlspecialchars($rss_description.' '.$pun_config['o_board_title']).'</description>'."\r\n"; |
217 echo "\t".'<language>en-us</language>'."\r\n"; |
217 echo "\t".'<language>en-us</language>'."\r\n"; |
218 |
218 |
219 // Fetch 15 topics |
219 // Fetch 15 topics |
220 $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT 15') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); |
220 $result = $pun_db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$pun_db->prefix.'topics AS t INNER JOIN '.$pun_db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$pun_db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT 15') or error('Unable to fetch topic list', __FILE__, __LINE__, $pun_db->error()); |
221 |
221 |
222 while ($cur_topic = $db->fetch_assoc($result)) |
222 while ($cur_topic = $pun_db->fetch_assoc($result)) |
223 { |
223 { |
224 if ($pun_config['o_censoring'] == '1') |
224 if ($pun_config['o_censoring'] == '1') |
225 $cur_topic['subject'] = censor_words($cur_topic['subject']); |
225 $cur_topic['subject'] = censor_words($cur_topic['subject']); |
226 |
226 |
227 echo "\t".'<item>'."\r\n"; |
227 echo "\t".'<item>'."\r\n"; |
242 $show = isset($_GET['show']) ? intval($_GET['show']) : 15; |
242 $show = isset($_GET['show']) ? intval($_GET['show']) : 15; |
243 if ($show < 1 || $show > 50) |
243 if ($show < 1 || $show > 50) |
244 $show = 15; |
244 $show = 15; |
245 |
245 |
246 // Fetch $show topics |
246 // Fetch $show topics |
247 $result = $db->query('SELECT t.id, t.subject FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); |
247 $result = $pun_db->query('SELECT t.id, t.subject FROM '.$pun_db->prefix.'topics AS t INNER JOIN '.$pun_db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$pun_db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $pun_db->error()); |
248 |
248 |
249 while ($cur_topic = $db->fetch_assoc($result)) |
249 while ($cur_topic = $pun_db->fetch_assoc($result)) |
250 { |
250 { |
251 if ($pun_config['o_censoring'] == '1') |
251 if ($pun_config['o_censoring'] == '1') |
252 $cur_topic['subject'] = censor_words($cur_topic['subject']); |
252 $cur_topic['subject'] = censor_words($cur_topic['subject']); |
253 |
253 |
254 if (pun_strlen($cur_topic['subject']) > $max_subject_length) |
254 if (pun_strlen($cur_topic['subject']) > $max_subject_length) |
273 require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
273 require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
274 |
274 |
275 // Fetch users online info and generate strings for output |
275 // Fetch users online info and generate strings for output |
276 $num_guests = $num_users = 0; |
276 $num_guests = $num_users = 0; |
277 $users = array(); |
277 $users = array(); |
278 $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); |
278 $result = $pun_db->query('SELECT user_id, ident FROM '.$pun_db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $pun_db->error()); |
279 |
279 |
280 while ($pun_user_online = $db->fetch_assoc($result)) |
280 while ($pun_user_online = $pun_db->fetch_assoc($result)) |
281 { |
281 { |
282 if ($pun_user_online['user_id'] > 1) |
282 if ($pun_user_online['user_id'] > 1) |
283 { |
283 { |
284 $users[] = '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>'; |
284 $users[] = '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>'; |
285 ++$num_users; |
285 ++$num_users; |
306 { |
306 { |
307 // Load the index.php language file |
307 // Load the index.php language file |
308 require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
308 require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
309 |
309 |
310 // Collect some statistics from the database |
310 // Collect some statistics from the database |
311 $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); |
311 $result = $pun_db->query('SELECT COUNT(id)-1 FROM '.$pun_db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $pun_db->error()); |
312 $stats['total_users'] = $db->result($result); |
312 $stats['total_users'] = $pun_db->result($result); |
313 |
313 |
314 $result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error()); |
314 $result = $pun_db->query('SELECT id, username FROM '.$pun_db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $pun_db->error()); |
315 $stats['last_user'] = $db->fetch_assoc($result); |
315 $stats['last_user'] = $pun_db->fetch_assoc($result); |
316 |
316 |
317 $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); |
317 $result = $pun_db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$pun_db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $pun_db->error()); |
318 list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
318 list($stats['total_topics'], $stats['total_posts']) = $pun_db->fetch_row($result); |
319 |
319 |
320 echo $lang_index['No of users'].': '.$stats['total_users'].'<br />'; |
320 echo $lang_index['No of users'].': '.$stats['total_users'].'<br />'; |
321 echo $lang_index['Newest user'].': <a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a><br />'; |
321 echo $lang_index['Newest user'].': <a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a><br />'; |
322 echo $lang_index['No of topics'].': '.$stats['total_topics'].'<br />'; |
322 echo $lang_index['No of topics'].': '.$stats['total_topics'].'<br />'; |
323 echo $lang_index['No of posts'].': '.$stats['total_posts']; |
323 echo $lang_index['No of posts'].': '.$stats['total_posts']; |