PageRenderTime 49ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/forum.php

https://github.com/igorw-forks/icy_phoenix
PHP | 469 lines | 358 code | 57 blank | 54 comment | 82 complexity | 16605fbecb0594c538991ebffe49f962 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. *
  4. * @package Icy Phoenix
  5. * @version $Id$
  6. * @copyright (c) 2008 Icy Phoenix
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. *
  9. */
  10. /**
  11. *
  12. * @Icy Phoenix is based on phpBB
  13. * @copyright (c) 2008 phpBB Group
  14. *
  15. */
  16. define('IN_ICYPHOENIX', true);
  17. if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
  18. if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
  19. include(IP_ROOT_PATH . 'common.' . PHP_EXT);
  20. include_once(IP_ROOT_PATH . 'includes/functions_groups.' . PHP_EXT);
  21. // Start session management
  22. $userdata = session_pagestart($user_ip);
  23. init_userprefs($userdata);
  24. // End session management
  25. // Activity - BEGIN
  26. if (!empty($config['plugins']['activity']['enabled']))
  27. {
  28. include(IP_ROOT_PATH . PLUGINS_PATH . $config['plugins']['activity']['dir'] . 'includes/functions_amod_index.' . PHP_EXT);
  29. }
  30. // Activity - END
  31. //<!-- BEGIN Unread Post Information to Database Mod -->
  32. $mark_always_read = request_var('always_read', '');
  33. $mark_forum_id = request_var('forum_id', 0);
  34. if($userdata['upi2db_access'])
  35. {
  36. $always_read_topics_string = explode(',', $unread['always_read']['topics']);
  37. $always_read_forums_string = explode(',', $unread['always_read']['forums']);
  38. if (!empty($mark_always_read))
  39. {
  40. $mark_always_read_text = always_read_forum($mark_forum_id, $mark_always_read);
  41. $redirect_url = append_sid(CMS_PAGE_FORUM);
  42. meta_refresh(3, $redirect_url);
  43. $message = $mark_always_read_text . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a> ');
  44. message_die(GENERAL_MESSAGE, $message);
  45. }
  46. }
  47. //<!-- END Unread Post Information to Database Mod -->
  48. $cms_page['page_id'] = 'forum';
  49. $cms_page['page_nav'] = (!empty($cms_config_layouts[$cms_page['page_id']]['page_nav']) ? true : false);
  50. $cms_page['global_blocks'] = (!empty($cms_config_layouts[$cms_page['page_id']]['global_blocks']) ? true : false);
  51. $cms_auth_level = (isset($cms_config_layouts[$cms_page['page_id']]['view']) ? $cms_config_layouts[$cms_page['page_id']]['view'] : AUTH_ALL);
  52. check_page_auth($cms_page['page_id'], $cms_auth_level);
  53. require(IP_ROOT_PATH . 'language/lang_' . $config['default_lang'] . '/lang_main_link.' . PHP_EXT);
  54. $viewcat = (!empty($_GET[POST_CAT_URL]) ? intval($_GET[POST_CAT_URL]) : -1);
  55. $viewcat = (($viewcat <= 0) ? -1 : $viewcat);
  56. $viewcatkey = ($viewcat < 0) ? 'Root' : POST_CAT_URL . $viewcat;
  57. $mark_read = request_var('mode', '');
  58. // Handle marking posts
  59. if($mark_read == 'forums')
  60. {
  61. // Force last visit to max 60 days limit to avoid having too much unread topics
  62. if($userdata['session_logged_in'] && !$userdata['is_bot'])
  63. {
  64. if ($userdata['user_lastvisit'] < (time() - (LAST_LOGIN_DAYS_NEW_POSTS_RESET * 24 * 60 * 60)))
  65. {
  66. $userdata['user_lastvisit'] = time() - (LAST_LOGIN_DAYS_NEW_POSTS_RESET * 24 * 60 * 60);
  67. }
  68. }
  69. if ($viewcat < 0)
  70. {
  71. if($userdata['session_logged_in'] && !$userdata['is_bot'])
  72. {
  73. //<!-- BEGIN Unread Post Information to Database Mod -->
  74. if(!$userdata['upi2db_access'])
  75. {
  76. setcookie($config['cookie_name'] . '_f_all', time(), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
  77. }
  78. else
  79. {
  80. marking_posts();
  81. }
  82. //<!-- END Unread Post Information to Database Mod -->
  83. }
  84. $redirect_url = append_sid(CMS_PAGE_FORUM);
  85. meta_refresh(3, $redirect_url);
  86. }
  87. else
  88. {
  89. if($userdata['session_logged_in'] && !$userdata['is_bot'])
  90. {
  91. // get the list of object authorized
  92. $keys = array();
  93. $keys = get_auth_keys($viewcatkey);
  94. // mark each forums
  95. for ($i = 0; $i < sizeof($keys['id']); $i++)
  96. {
  97. if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
  98. {
  99. $forum_id = $tree['id'][ $keys['idx'][$i] ];
  100. $sql = "SELECT MAX(post_time) AS last_post FROM " . POSTS_TABLE . " WHERE forum_id = '" . $forum_id . "'";
  101. $result = $db->sql_query($sql);
  102. if ($row = $db->sql_fetchrow($result))
  103. {
  104. $tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array();
  105. $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
  106. if ((sizeof($tracking_forums) + sizeof($tracking_topics)) >= 150 && empty($tracking_forums[$forum_id]))
  107. {
  108. asort($tracking_forums);
  109. unset($tracking_forums[key($tracking_forums)]);
  110. }
  111. if ($row['last_post'] > $userdata['user_lastvisit'])
  112. {
  113. $tracking_forums[$forum_id] = time();
  114. setcookie($config['cookie_name'] . '_f', serialize($tracking_forums), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
  115. }
  116. }
  117. }
  118. }
  119. }
  120. $redirect_url = append_sid(CMS_PAGE_FORUM . '?' . POST_CAT_URL . '=' . $viewcat);
  121. meta_refresh(3, $redirect_url);
  122. }
  123. $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a> ');
  124. message_die(GENERAL_MESSAGE, $message);
  125. }
  126. // End handle marking posts
  127. if (($config['display_viewonline'] == 2) || (($viewcat < 0) && ($config['display_viewonline'] == 1)))
  128. {
  129. define('SHOW_ONLINE_CHAT', true);
  130. define('SHOW_ONLINE', true);
  131. if (empty($config['max_topics']) || empty($config['max_posts']) || empty($config['max_users']) || empty($config['last_user_id']))
  132. {
  133. board_stats();
  134. }
  135. $total_topics = $config['max_topics'];
  136. $total_posts = $config['max_posts'];
  137. $total_users = $config['max_users'];
  138. $newest_user = $cache->obtain_newest_user();
  139. $l_total_post_s = $lang['Posted_articles_total'];
  140. if($total_users == 0)
  141. {
  142. $l_total_user_s = $lang['Registered_users_zero_total'];
  143. }
  144. elseif($total_users == 1)
  145. {
  146. $l_total_user_s = $lang['Registered_user_total'];
  147. }
  148. else
  149. {
  150. $l_total_user_s = $lang['Registered_users_total'];
  151. }
  152. // Last Visit - BEGIN
  153. $today_visitors = array();
  154. $today_visitors = $cache->obtain_today_visitors();
  155. $today_visitors['admins'] = '<b>' . $lang['Users_Admins'] . ':</b>&nbsp;' . (empty($today_visitors['admins']) ? $lang['None'] : $today_visitors['admins']);
  156. $today_visitors['mods'] = '<b>' . $lang['Users_Mods'] . ':</b>&nbsp;' . (empty($today_visitors['mods']) ? $lang['None'] : $today_visitors['mods']);
  157. $today_visitors['users'] = '<b>' . $lang['Users_Regs'] . ':</b>&nbsp;' . (empty($today_visitors['users']) ? $lang['None'] : $today_visitors['users']);
  158. $l_today_user_s = ($today_visitors['total_users']) ? (($today_visitors['total_users'] == 1)? $lang['User_today_total'] : $lang['Users_today_total']) : $lang['Users_today_zero_total'];
  159. $l_today_r_user_s = ($today_visitors['reg_visible']) ? (($today_visitors['reg_visible'] == 1) ? $lang['Reg_user_total'] : $lang['Reg_users_total']) : $lang['Reg_users_zero_total'];
  160. $l_today_h_user_s = ($today_visitors['reg_hidden']) ? (($today_visitors['reg_hidden'] == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total']) : $lang['Hidden_users_zero_total'];
  161. $l_today_g_user_s = ($today_visitors['total_guests']) ? (($today_visitors['total_guests'] == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
  162. $l_today_users = sprintf($l_today_user_s, $today_visitors['total_users']);
  163. $l_today_users .= sprintf($l_today_r_user_s, $today_visitors['reg_visible']);
  164. $l_today_users .= sprintf($l_today_h_user_s, $today_visitors['reg_hidden']);
  165. $l_today_users .= sprintf($l_today_g_user_s, $today_visitors['total_guests']);
  166. $l_today_text = ($today_visitors['last_hour']) ? sprintf($lang['Users_lasthour_explain'], $today_visitors['last_hour']) : $lang['Users_lasthour_none_explain'];
  167. // Last Visit - END
  168. // Birthday Box - BEGIN
  169. if ($config['index_birthday'])
  170. {
  171. $template->assign_vars(array('S_BIRTHDAYS' => true));
  172. $birthdays_list = array();
  173. @include_once(IP_ROOT_PATH . 'includes/functions_calendar.' . PHP_EXT);
  174. $birthdays_list = get_birthdays_list_full();
  175. }
  176. // Birthday Box - END
  177. }
  178. $avatar_img = user_get_avatar($userdata['user_id'], $userdata['user_level'], $userdata['user_avatar'], $userdata['user_avatar_type'], $userdata['user_allowavatar']);
  179. // Check For Anonymous User
  180. if ($userdata['user_id'] != ANONYMOUS)
  181. {
  182. $username = colorize_username($userdata['user_id'], $userdata['username'], $userdata['user_color'], $userdata['user_active']);
  183. }
  184. else
  185. {
  186. $username = $lang['Guest'];
  187. $avatar_img = '<img src="' . $config['default_avatar_guests_url'] . '" alt="Avatar" />';
  188. }
  189. $link_self_img = '';
  190. $site_logo_height = '';
  191. $site_logo_width = '';
  192. if (!empty($config['index_links']))
  193. {
  194. include_once(IP_ROOT_PATH . 'includes/functions_links.' . PHP_EXT);
  195. $links_config = get_links_config(true);
  196. $link_self_img = $links_config['site_logo'];
  197. $site_logo_height = $links_config['height'];
  198. $site_logo_width = $links_config['width'];
  199. $template->assign_vars(array('S_LINKS' => true));
  200. }
  201. if ($config['site_history'] && ((time() - (int) $config['cron_site_history_last_run']) > ONLINE_REFRESH))
  202. {
  203. $current_time = time();
  204. $minutes = gmdate('is', $current_time);
  205. $hour_now = $current_time - (60 * ($minutes[0] . $minutes[1])) - ($minutes[2] . $minutes[3]);
  206. // change the number late in the next line, to whatever timezone your forum is located, this need to be hard coded in the release of this mod, the number is 1
  207. $dato = create_date('H', $current_time, 1);
  208. $timetoday = $hour_now - (3600 * $dato);
  209. $sql = 'SELECT COUNT(DISTINCT session_ip) as guests_today FROM ' . SESSIONS_TABLE . ' WHERE session_user_id="' . ANONYMOUS . '" AND session_time >= ' . $timetoday . ' AND session_time < ' . ($timetoday + 86399);
  210. $result = $db->sql_query($sql);
  211. $guest_count = $db->sql_fetchrow($result);
  212. $sql = 'SELECT user_allow_viewonline, COUNT(*) as count FROM ' . USERS_TABLE . ' WHERE user_id!="' . ANONYMOUS . '" AND user_session_time >= ' . $timetoday . ' AND user_session_time < ' . ($timetoday + 86399) . ' GROUP BY user_allow_viewonline';
  213. $result = $db->sql_query($sql);
  214. while ($reg_count = $db->sql_fetchrow ($result))
  215. {
  216. if ($reg_count['user_allow_viewonline'])
  217. {
  218. $today_visitors['reg_visible'] = $reg_count['count'];
  219. }
  220. else
  221. {
  222. $today_visitors['reg_hidden'] = $reg_count['count'];
  223. }
  224. }
  225. $db->sql_freeresult($result);
  226. $sql = 'UPDATE ' . SITE_HISTORY_TABLE . ' SET reg="' . $today_visitors['reg_visible'] . '", hidden="' . $today_visitors['reg_hidden'] . '", guests="' . $guest_count['guests_today'] . '" WHERE date=' . $hour_now;
  227. $result = $db->sql_query($sql);
  228. $affectedrows = $db->sql_affectedrows();
  229. if (!$result || !$affectedrows)
  230. {
  231. $sql = 'INSERT IGNORE INTO ' . SITE_HISTORY_TABLE . ' (date, reg, hidden, guests)
  232. VALUES (' . $hour_now . ', "' . $today_visitors['reg_visible'] . '", "' . $today_visitors['reg_hidden'] . '", "' . $guest_count['guests_today'] . '")';
  233. $db->sql_query($sql);
  234. }
  235. if (isset($result))
  236. {
  237. $db->sql_freeresult($result);
  238. }
  239. set_config('cron_site_history_last_run', time());
  240. }
  241. // set the param of the mark read func
  242. $mark = ($viewcat == -1) ? '' : '&amp;' . POST_CAT_URL . '=' . $viewcat;
  243. if (!$config['board_disable'] || ($config['board_disable'] && ($userdata['user_level'] == ADMIN)))
  244. {
  245. $template->vars['S_TPL_FILENAME'] = 'index';
  246. }
  247. build_groups_list_template();
  248. //$template->assign_block_vars('google_ad', array());
  249. if ($userdata['session_logged_in'] && !$userdata['is_bot'])
  250. {
  251. $nav_server_url = create_server_url();
  252. $breadcrumbs_links_right = '<a href="' . $nav_server_url . append_sid(CMS_PAGE_FORUM . '?mark=forums') . '">' . $lang['Mark_all_forums'] . '</a>&nbsp;' . MENU_SEP_CHAR . '&nbsp;<a href="' . $nav_server_url . append_sid(CMS_PAGE_SEARCH . '?search_id=newposts') . '">' . $lang['Search_new'] . '</a>&nbsp;' . MENU_SEP_CHAR . '&nbsp;<a href="' . $nav_server_url . append_sid(CMS_PAGE_SEARCH . '?search_id=egosearch') . '">' . $lang['Search_your_posts'] . '</a>';
  253. }
  254. $forumindex_banner_element = get_ad('fix');
  255. $template->assign_vars(array(
  256. 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
  257. 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
  258. //'TOTAL_MALE' => sprintf($l_total_male, $total_male),
  259. //'TOTAL_FEMALE' => sprintf($l_total_female, $total_female),
  260. //'TOTAL_UNKNOWN' => sprintf($l_total_unknown, $total_unknown),
  261. 'NEWEST_USER' => sprintf($lang['Newest_user'], '', $newest_user, ''),
  262. 'FORUM_IMG' => $images['forum_nor_read'],
  263. 'FORUM_NEW_IMG' => $images['forum_nor_unread'],
  264. 'FORUM_CAT_IMG' => $images['forum_sub_read'],
  265. 'FORUM_NEW_CAT_IMG' => $images['forum_sub_unread'],
  266. 'FORUM_LOCKED_IMG' => $images['forum_nor_locked_read'],
  267. 'FORUM_LINK_IMG' => $images['forum_link'],
  268. //<!-- BEGIN Unread Post Information to Database Mod -->
  269. 'FOLDER_AR_BIG' => $images['forum_nor_ar'],
  270. //<!-- END Unread Post Information to Database Mod -->
  271. // Start add - Fully integrated shoutbox MOD
  272. 'U_SHOUTBOX' => append_sid('shoutbox.' . PHP_EXT),
  273. 'L_SHOUTBOX' => $lang['Shoutbox'],
  274. 'U_SHOUTBOX_MAX' => append_sid('shoutbox_max.' . PHP_EXT),
  275. // End add - Fully integrated shoutbox MOD
  276. 'AVATAR_IMG' => $avatar_img,
  277. 'STATS_IMG' => $images['stats_image'],
  278. 'BIRTHDAY_IMG' => $images['birthday_image'],
  279. 'CAT_BLOCK_IMG' => $images['category_block'],
  280. 'USER_NAME' => $username,
  281. 'TOTAL_TOPIC' => $total_topics,
  282. // Start add - Last visit MOD
  283. 'ADMINS_TODAY_LIST' => $today_visitors['admins'],
  284. 'MODS_TODAY_LIST' => $today_visitors['mods'],
  285. 'USERS_TODAY_LIST' => $today_visitors['users'],
  286. 'L_LEGEND' => $lang['legend'],
  287. 'L_USERS' => $lang['users'],
  288. 'L_USERS_LASTHOUR' => ($today_visitors['last_hour']) ? sprintf($lang['Users_lasthour_explain'], $today_visitors['last_hour']) : $lang['Users_lasthour_none_explain'],
  289. 'L_USERS_TODAY' => $l_today_users,
  290. // End add - Last visit MOD
  291. // Start add - Birthday MOD
  292. 'L_WHOSBIRTHDAY_WEEK' => ($config['birthday_check_day'] >= 1) ? sprintf((($birthdays_list['xdays']) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $config['birthday_check_day']) . $birthdays_list['xdays'] : '',
  293. 'L_WHOSBIRTHDAY_TODAY' => ($birthdays_list['today']) ? $lang['Birthday_today'] . $birthdays_list['today'] : $lang['Nobirthday_today'],
  294. // End add - Birthday MOD
  295. 'L_FORUM' => $lang['Forum'],
  296. 'L_TOPICS' => $lang['Topics'],
  297. 'L_REPLIES' => $lang['Replies'],
  298. 'L_VIEWS' => $lang['Views'],
  299. 'L_POSTS' => $lang['Posts'],
  300. 'L_LASTPOST' => $lang['Last_Post'],
  301. 'L_NO_NEW_POSTS' => $lang['No_new_posts'],
  302. 'L_NEW_POSTS' => $lang['New_posts'],
  303. 'L_FORUM_NO_NEW_POSTS' => $lang['Forum_no_new_posts'],
  304. 'L_FORUM_NEW_POSTS' => $lang['Forum_new_posts'],
  305. 'L_CAT_NO_NEW_POSTS' => $lang['Cat_no_new_posts'],
  306. 'L_CAT_NEW_POSTS' => $lang['Cat_new_posts'],
  307. 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
  308. 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
  309. 'L_ONLINE_EXPLAIN' => $lang['Online_explain'],
  310. 'FORUMINDEX_BANNER_ELEMENT' => $forumindex_banner_element,
  311. 'L_LINKS' => $lang['Site_links'],
  312. 'U_LINKS' => append_sid('links.' . PHP_EXT),
  313. 'U_LINKS_JS' => 'links.js.' . PHP_EXT,
  314. 'U_SITE_LOGO' => $link_self_img,
  315. 'SITE_LOGO_WIDTH' => $site_logo_width,
  316. 'SITE_LOGO_HEIGHT' => $site_logo_height,
  317. 'L_MODERATOR' => $lang['Moderators'],
  318. 'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
  319. 'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
  320. //<!-- BEGIN Unread Post Information to Database Mod -->
  321. 'L_AR_POSTS' => $lang['always_read_icon'],
  322. 'L_FORUM_AR' => $lang['always_read_icon'],
  323. //<!-- END Unread Post Information to Database Mod -->
  324. 'U_MARK_READ' => append_sid(CMS_PAGE_FORUM . '?mark=forums' . $mark)
  325. )
  326. );
  327. // Okay, let's build the index
  328. // Display the board statistics
  329. if (($config['display_viewonline'] == 2) || (($viewcat < 0) && ($config['display_viewonline'] == 1)))
  330. {
  331. $template->assign_vars(array('S_VIEWONLINE' => true));
  332. if ($config['index_last_msgs'] == 1)
  333. {
  334. $template->assign_block_vars('show_recent', array());
  335. $except_forums = build_exclusion_forums_list();
  336. if(!empty($config['last_msgs_x']))
  337. {
  338. $except_forums .= ',' . $config['last_msgs_x'];
  339. }
  340. $except_forums = str_replace(' ', '', $except_forums);
  341. $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
  342. FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
  343. WHERE t.forum_id NOT IN (" . $except_forums . ")
  344. AND t.topic_status <> 2
  345. AND p.post_id = t.topic_last_post_id
  346. AND p.poster_id = u.user_id
  347. ORDER BY p.post_id DESC
  348. LIMIT " . intval($config['last_msgs_n']);
  349. $result = $db->sql_query($sql);
  350. $number_recent_topics = $db->sql_numrows($result);
  351. $recent_topic_row = array();
  352. while ($row = $db->sql_fetchrow($result))
  353. {
  354. $recent_topic_row[] = $row;
  355. }
  356. for ($i = 0; $i < $number_recent_topics; $i++)
  357. {
  358. $template->assign_block_vars('show_recent.recent_topic_row', array(
  359. 'U_TITLE' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'],
  360. 'L_TITLE' => $recent_topic_row[$i]['topic_title'],
  361. 'U_POSTER' => append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&amp;' . POST_USERS_URL . '=' . $recent_topic_row[$i]['user_id']),
  362. 'S_POSTER' => $recent_topic_row[$i]['username'],
  363. 'S_POSTTIME' => create_date($config['default_dateformat'], $recent_topic_row[$i]['post_time'], $config['board_timezone'])
  364. )
  365. );
  366. }
  367. // Recent Topics - END
  368. }
  369. if ($config['show_random_quote'] == true)
  370. {
  371. $template->assign_block_vars('switch_show_random_quote', array());
  372. }
  373. if ($config['show_chat_online'] == true)
  374. {
  375. $template->assign_block_vars('switch_ac_online', array());
  376. }
  377. if ($config['index_top_posters'] == true)
  378. {
  379. include_once(IP_ROOT_PATH . 'includes/functions_users.' . PHP_EXT);
  380. $template->assign_block_vars('top_posters', array(
  381. 'TOP_POSTERS' => top_posters(8, true, true, false),
  382. )
  383. );
  384. }
  385. }
  386. // Display the index
  387. $display = display_index($viewcatkey);
  388. // check shoutbox permissions and display only to authorized users
  389. $auth_level_req = (isset($cms_config_layouts['shoutbox']['view']) ? $cms_config_layouts['shoutbox']['view'] : AUTH_ALL);
  390. if (($config['index_shoutbox'] && (($userdata['user_level'] + 1) >= $auth_level_req) && $userdata['session_logged_in'] && !$userdata['is_bot']) || ($config['index_shoutbox'] && ($userdata['user_level'] == ADMIN)))
  391. {
  392. $template->assign_vars(array('S_SHOUTBOX' => true));
  393. }
  394. if (!$display)
  395. {
  396. message_die(GENERAL_MESSAGE, $lang['No_forums']);
  397. }
  398. // Should the news banner be shown?
  399. if($config['xs_show_news'])
  400. {
  401. include(IP_ROOT_PATH . 'includes/xs_news.' . PHP_EXT);
  402. $template->assign_block_vars('switch_show_news', array());
  403. }
  404. $forumindex_banner_top = get_ad('fit');
  405. $forumindex_banner_bottom = get_ad('fib');
  406. $template->assign_vars(array(
  407. 'FORUMINDEX_BANNER_TOP' => $forumindex_banner_top,
  408. 'FORUMINDEX_BANNER_BOTTOM' => $forumindex_banner_bottom,
  409. )
  410. );
  411. full_page_generation('index_body.tpl', $lang['Forum'], '', '');
  412. ?>