Файл: apwa/forum.php
Строк: 151
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
// Spisok index full wap
$index_spisok = request_var('index_spisok', '');
if ($index_spisok == 'on' || $index_spisok == 'off')
{
$user->set_cookie('spisok', $index_spisok, time() + 31536000);
header('Location: ' . append_sid("{$phpbb_root_path}index.$phpEx"));
}
// Style css wap
$style_css_select = '';
$cookies_css = '';
if (is_dir($phpbb_root_path . "/styles/mobile/theme/"))
{
$style_css = request_var('style_css', '');
if ($dh = opendir($phpbb_root_path . "/styles/mobile/theme/"))
{
while (($file = readdir($dh)) !== false)
{
if( preg_match('/(.css)$/is', $file) )
{
$file = str_replace(".css", "", $file);
$selected = ($file == 'stylesheet') ? ' selected="selected"' : '';
$style_css_select .= '<option value="' . $file . '"' . $selected . '>' . htmlspecialchars($file) . '</option>';
$cookies_css .= ( $style_css == $file ) ? TRUE: FALSE;
}
}
closedir($dh);
}
if ($cookies_css)
{
$style_css = ($style_css != 'stylesheet') ? $style_css : '';
$user->set_cookie('css', $style_css, time() + 31536000);
header('Location: ' . append_sid("{$phpbb_root_path}forum.$phpEx"));
}
}
if ($config['recent_enable'])
{
include($phpbb_root_path . 'includes/recent_topics.'.$phpEx);
}
$style_count = 0;
$style_select = '';
$sql = 'SELECT style_id, style_name FROM ' . STYLES_TABLE . '
WHERE style_active = 1 AND style_id NOT IN(' . $user->data['user_style'] . ')
ORDER BY LOWER(style_name) ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$style = request_var('style', 0);
if($style)
{
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], append_sid("{$phpbb_root_path}forum.$phpEx"));
}
else
{
$url = append_sid("{$phpbb_root_path}forum.$phpEx", 'style=' . $row['style_id']);
}
++$style_count;
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $user->theme['style_id'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($row['style_name']) . '</option>';
}
$db->sql_freeresult($result);
if(strlen($style_select))
{
$template->assign_var('STYLE_SELECT', $style_select);
}
$online_users = obtain_users_online(0, 0);
if (class_exists('phpbb_gallery_integration'))
{
$total_images = phpbb_gallery_config::get('num_images');
$total_comments = phpbb_gallery_config::get('num_comments');
}
if (phpbb_gallery_config::get('rrc_gindex_mode'))
{
$enable = '0';
$lenght = '127';
$stroki = '1';
$stolb = '4';
$comment = '4';
$info = '0';
$ints = array($stroki, $stolb, $comment, '1',);
$gallery_block = new phpbb_gallery_block($enable, $lenght, $ints, $info, '0');
$gallery_block->display();
}
$welcome_user = ($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : $user->lang['GUEST'];
$s_total_online = $online_users['total_online'] . ' (' . sprintf($user->lang['GUEST_USERS_TOTAL'], $online_users['guests_online']) . ')';
// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
{
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
// Display birthdays of 29th february on 28th february in non-leap-years
$leap_year_birthdays = '';
if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L'))
{
$leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
}
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
WHERE (b.ban_id IS NULL
OR b.ban_exclude = 1)
AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays)
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . max(0, $now['year'] - $age) . ')';
}
}
$db->sql_freeresult($result);
}
// Assign index specific vars
$template->assign_vars(array(
'WELCOME_USER' => sprintf($user->lang['WELCOME_SUBJECT'], $welcome_user),
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'TOTAL_POSTS' => $config['num_posts'],
'TOTAL_TOPICS' => $config['num_topics'],
'TOTAL_USERS' => $config['num_users'],
'TOTAL_IMAGES' => $total_images,
'TOTAL_COMMENTS' => $total_comments,
'BIRTHDAY_LIST' => $birthday_list,
'S_STYLE_CSS_OPTIONS' => $style_css_select,
'S_STYLE_OPTIONS' => ($config['override_user_style'] || $style_count < 2) ? '' : style_select($user->data['user_style']),
'S_DISPLAY_CHANGE_STYLE' => true,
'S_ONLINE' => $s_total_online,
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);
// Last X [attachments] on Forum / 4seven / 2010
include_once($phpbb_root_path . 'includes/last_x_att.' . $phpEx);
if (!class_exists('phpbb_mods_who_was_here'))
{
include($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx);
phpbb_mods_who_was_here::update_session();
}
phpbb_mods_who_was_here::display();
page_header($config['site_desc']);
$template->set_filenames(array(
'body' => 'portal_index_body.html',
));
page_footer();
?>