Move over to own Repository :)
This commit is contained in:
113
root/portal/block/announcements.php
Normal file
113
root/portal/block/announcements.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
|
||||
'S_DISPLAY_ANNOUNCEMENTS' => true,
|
||||
));
|
||||
|
||||
#if (!isset($HTTP_GET_VARS['article']))
|
||||
$news = request_var('announcement', -1);
|
||||
if($news < 0)
|
||||
{
|
||||
$fetch_news = phpbb_fetch_posts('', $portal_config['portal_number_of_announcements'], $portal_config['portal_announcements_length'], $portal_config['portal_announcements_day'], 'announcements');
|
||||
|
||||
if (count($fetch_news) == 0)
|
||||
{
|
||||
$template->assign_block_vars('announcements_row', array(
|
||||
'S_NO_TOPICS' => true,
|
||||
'S_NOT_LAST' => false
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < count($fetch_news); $i++)
|
||||
{
|
||||
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
||||
{
|
||||
$open_bracket = '[ ';
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $user->lang['READ_FULL'];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$open_bracket = '';
|
||||
$close_bracket = '';
|
||||
$read_full = '';
|
||||
}
|
||||
// unread?
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$template->assign_block_vars('announcements_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
'POSTER' => $fetch_news[$i]['username'],
|
||||
'U_USER_PROFILE' => (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
|
||||
'TIME' => $fetch_news[$i]['topic_time'],
|
||||
'TEXT' => $fetch_news[$i]['post_text'],
|
||||
'REPLIES' => $fetch_news[$i]['topic_replies'],
|
||||
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
|
||||
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
|
||||
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 't=' . $fetch_news[$i]['topic_id']),
|
||||
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&' . (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 't=' . $fetch_news[$i]['topic_id']),
|
||||
'U_READ_FULL' => append_sid("{$phpbb_root_path}portal.$phpEx", 'announcement=' . $i),
|
||||
'L_READ_FULL' => $read_full,
|
||||
'OPEN' => $open_bracket,
|
||||
'CLOSE' => $close_bracket,
|
||||
'S_NOT_LAST' => ($i < count($fetch_news) - 1) ? true : false,
|
||||
'S_POLL' => $fetch_news[$i]['poll'],
|
||||
// 'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'),
|
||||
'S_UNREAD_INFO' => $unread_topic,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], 0, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
||||
$fetch_news = $fetch_news = phpbb_fetch_posts('', $portal_config['portal_number_of_announcements'], 0, 0, 'announcements');
|
||||
|
||||
$i = $news;
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$template->assign_block_vars('announcements_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
'POSTER' => $fetch_news[$i]['username'],
|
||||
'TIME' => $fetch_news[$i]['topic_time'],
|
||||
'TEXT' => $fetch_news[$i]['post_text'],
|
||||
'REPLIES' => $fetch_news[$i]['topic_replies'],
|
||||
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
|
||||
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
|
||||
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 't=' . $fetch_news[$i]['topic_id']),
|
||||
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&' . (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&' : '') . 't=' . $fetch_news[$i]['topic_id']),
|
||||
'S_POLL' => $fetch_news[$i]['poll'],
|
||||
'S_UNREAD_INFO' => $unread_topic,
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
54
root/portal/block/attachments.php
Normal file
54
root/portal/block/attachments.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
// Just grab all attachment info from database
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
ORDER BY filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_attachments_number']);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$size_lang = ($row['filesize'] >= 1048576) ? $user->lang['MB'] : (($row['filesize'] >= 1024) ? $user->lang['KB'] : $user->lang['BYTES']);
|
||||
$row['filesize'] = ($row['filesize'] >= 1048576) ? round((round($row['filesize'] / 1048576 * 100) / 100), 2) : (($row['filesize'] >= 1024) ? round((round($row['filesize'] / 1024 * 100) / 100), 2) : $row['filesize']);
|
||||
|
||||
$replace = str_replace(array('_','.zip','.jpg','.gif','.png','.ZIP','.JPG','.GIF','.PNG','.','-'), ' ', $row['real_filename']);
|
||||
|
||||
$template->assign_block_vars('attach', array(
|
||||
'FILESIZE' => $row['filesize'] . ' ' . $size_lang,
|
||||
'FILETIME' => $user->format_date($row['filetime']),
|
||||
'DOWNLOAD_COUNT' => (int) $row['download_count'], // grab downloads count
|
||||
'REAL_FILENAME' => $replace,
|
||||
'PHYSICAL_FILENAME' => basename($row['physical_filename']),
|
||||
'ATTACH_ID' => $row['attach_id'],
|
||||
'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
|
||||
'POST_MSG_ID' => $row['post_msg_id'], // grab post ID to redirect to post
|
||||
'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $row['attach_id']),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ATTACHMENTS' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
52
root/portal/block/birthday_list.php
Normal file
52
root/portal/block/birthday_list.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
// Generate birthday list if required ... / borrowed from index.php (RC4)
|
||||
$birthday_list = '';
|
||||
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||
{
|
||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
||||
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
||||
AND 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 .= ' (' . ($now['year'] - $age) . ')';
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Assign index specific vars
|
||||
$template->assign_vars(array(
|
||||
'BIRTHDAY_LIST' => $birthday_list,
|
||||
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
76
root/portal/block/change_style.php
Normal file
76
root/portal/block/change_style.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$lang = request_var('lang', '', false, true);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'language/' . $lang . "/common.$phpEx"))
|
||||
{
|
||||
$this->lang_name = $lang;
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
|
||||
|
||||
$cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000);
|
||||
$this->set_cookie('lang', $lang, $cookie_expire);
|
||||
unset($cookie_expire);
|
||||
}
|
||||
|
||||
$requested_style = request_var('style', 0, false, true);
|
||||
|
||||
if ($requested_style && (!$config['override_user_style'] || $auth->acl_get('a_styles')))
|
||||
{
|
||||
$style = $requested_style;
|
||||
|
||||
$cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000);
|
||||
$this->set_cookie('style', $style, $cookie_expire);
|
||||
unset($cookie_expire);
|
||||
}
|
||||
|
||||
$all = false;
|
||||
$default = '';
|
||||
|
||||
$sql_where = (!$all) ? 'WHERE style_active = 1 ' : '';
|
||||
$sql = 'SELECT style_id, style_name, style_copyright
|
||||
FROM ' . STYLES_TABLE . "
|
||||
$sql_where
|
||||
ORDER BY style_name";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$style_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
|
||||
$style_options .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
|
||||
|
||||
$template->assign_block_vars('styles', array(
|
||||
'STYLE_ID' => $row['style_id'],
|
||||
'STYLE_NAME' => $row['style_name'],
|
||||
'STYLE_COPY' => $row['style_copyright'],
|
||||
'U_STYLE' => append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
|
||||
'S_DISPLAY_CHANGE_STYLE' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
44
root/portal/block/donate.php
Normal file
44
root/portal/block/donate.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($portal_config['portal_pay_acc'])
|
||||
{
|
||||
if ($portal_config['portal_pay_c_block'])
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_PAY_C' => true,
|
||||
));
|
||||
}
|
||||
|
||||
if ($portal_config['portal_pay_s_block'])
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_PAY_S' => true,
|
||||
));
|
||||
}
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'PAY_ACC' => $portal_config['portal_pay_acc'],
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
71
root/portal/block/friends.php
Normal file
71
root/portal/block/friends.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$s_display_friends = false;
|
||||
|
||||
// Output listing of friends online
|
||||
$update_time = $config['load_online_time'] * 60;
|
||||
|
||||
$sql = $db->sql_build_query('SELECT_DISTINCT', array(
|
||||
'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_allow_viewonline, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',
|
||||
'FROM' => array(
|
||||
USERS_TABLE => 'u',
|
||||
ZEBRA_TABLE => 'z'
|
||||
),
|
||||
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(SESSIONS_TABLE => 's'),
|
||||
'ON' => 's.session_user_id = z.zebra_id'
|
||||
)
|
||||
),
|
||||
|
||||
'WHERE' => 'z.user_id = ' . $user->data['user_id'] . '
|
||||
AND z.friend = 1
|
||||
AND u.user_id = z.zebra_id',
|
||||
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.user_allow_viewonline, u.user_colour',
|
||||
'ORDER_BY' => 'u.username_clean ASC',
|
||||
));
|
||||
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_online_friends']);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$which = (time() - $update_time < $row['online_time'] && $row['viewonline'] && $row['user_allow_viewonline']) ? 'online' : 'offline';
|
||||
$s_display_friends = ($row['user_id']) ? true : false;
|
||||
|
||||
$template->assign_block_vars("friends_{$which}", array(
|
||||
'USER_ID' => $row['user_id'],
|
||||
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_FRIENDS' => $s_display_friends,
|
||||
'S_ZEBRA_ENABLED' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
8
root/portal/block/index.html
Normal file
8
root/portal/block/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
</body>
|
||||
</html>
|
||||
59
root/portal/block/latest_bots.php
Normal file
59
root/portal/block/latest_bots.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
// Last x visited bots
|
||||
$sql = 'SELECT username, user_colour, user_lastvisit
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type = ' . USER_IGNORE . '
|
||||
ORDER BY user_lastvisit DESC';
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_last_visited_bots_number']);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// if ($row['user_lastvisit'] == 0)
|
||||
if (!$row['user_lastvisit'])
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LAST_BOTS' => false,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LAST_BOTS' => true,
|
||||
));
|
||||
|
||||
$template->assign_block_vars('last_visited_bots', array(
|
||||
'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']),
|
||||
'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']),
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $portal_config['portal_last_visited_bots_number']),
|
||||
'S_LAST_VISITED_BOTS' => ($portal_config['portal_load_last_visited_bots']) ? true : false,
|
||||
));
|
||||
|
||||
?>
|
||||
44
root/portal/block/latest_members.php
Normal file
44
root/portal/block/latest_members.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = 'SELECT user_id, username, user_regdate, user_colour
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_inactive_time = 0
|
||||
ORDER BY user_regdate DESC';
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_last_member']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
|
||||
{
|
||||
$template->assign_block_vars('latest_members', array(
|
||||
'USERNAME' => censor_text($row['username']),
|
||||
'USERNAME_COLOR'=> ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : '',
|
||||
'U_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
|
||||
'JOINED' => $user->format_date($row['user_regdate'], $format = 'd M'),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LATEST_MEMBERS' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
174
root/portal/block/leaders.php
Normal file
174
root/portal/block/leaders.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
// Display a listing of board admins, moderators
|
||||
$user->add_lang('groups');
|
||||
|
||||
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
|
||||
|
||||
$admin_id_ary = $mod_id_ary = $forum_id_ary = array();
|
||||
foreach ($user_ary as $forum_id => $forum_ary)
|
||||
{
|
||||
foreach ($forum_ary as $auth_option => $id_ary)
|
||||
{
|
||||
if (!$forum_id && $auth_option == 'a_')
|
||||
{
|
||||
$admin_id_ary = array_merge($admin_id_ary, $id_ary);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mod_id_ary = array_merge($mod_id_ary, $id_ary);
|
||||
}
|
||||
|
||||
if ($forum_id)
|
||||
{
|
||||
foreach ($id_ary as $id)
|
||||
{
|
||||
$forum_id_ary[$id][] = $forum_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$admin_id_ary = array_unique($admin_id_ary);
|
||||
$mod_id_ary = array_unique($mod_id_ary);
|
||||
|
||||
// Admin group id...
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name = 'ADMINISTRATORS'";
|
||||
$result = $db->sql_query($sql);
|
||||
$admin_group_id = (int) $db->sql_fetchfield('group_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT forum_id, forum_name
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_type = ' . FORUM_POST;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$forums = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$forums[$row['forum_id']] = $row['forum_name'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', array(
|
||||
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.user_colour, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id',
|
||||
'FROM' => array(
|
||||
USERS_TABLE => 'u',
|
||||
GROUPS_TABLE => 'g'
|
||||
),
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
||||
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id']
|
||||
)),
|
||||
'WHERE' => $db->sql_in_set('u.user_id', array_unique(array_merge($admin_id_ary, $mod_id_ary))) . '
|
||||
AND u.group_id = g.group_id',
|
||||
'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC'
|
||||
));
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$which_row = (in_array($row['user_id'], $admin_id_ary)) ? 'admin' : 'mod';
|
||||
|
||||
// We sort out admins not having the admin group as default
|
||||
// The drawback is that only those admins are displayed which are within
|
||||
// the special group 'Administrators' and also having it assigned as their default group.
|
||||
// - might change
|
||||
if ($which_row == 'admin' && $row['default_group'] != $admin_group_id)
|
||||
{
|
||||
// Remove from admin_id_ary, because the user may be a mod instead
|
||||
unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]);
|
||||
|
||||
if (!in_array($row['user_id'], $mod_id_ary))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$which_row = 'mod';
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
|
||||
{
|
||||
$group_name = $user->lang['GROUP_UNDISCLOSED'];
|
||||
$u_group = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
||||
$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
|
||||
}
|
||||
|
||||
$template->assign_block_vars($which_row, array(
|
||||
'USER_ID' => $row['user_id'],
|
||||
'GROUP_NAME' => $group_name,
|
||||
'GROUP_COLOR' => $row['group_colour'],
|
||||
|
||||
'U_GROUP' => $u_group,
|
||||
|
||||
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
/*we may delete this?
|
||||
// Generate online information for user
|
||||
if ($config['load_onlinetrack'] && sizeof($id_cache))
|
||||
{
|
||||
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
|
||||
FROM ' . SESSIONS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
|
||||
GROUP BY session_user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$update_time = $config['load_online_time'] * 60;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline'] && $user_cache[$row['session_user_id']]['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
unset($id_cache);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'ONLINE_IMG'=> ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
|
||||
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
|
||||
));
|
||||
*/
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LEADERS' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
31
root/portal/block/link_us.php
Normal file
31
root/portal/block/link_us.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
//doing the easy way ;)
|
||||
$u_link = $config['server_protocol'] . $config['server_name'] . $config['script_path'];
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LINK_US' => true,
|
||||
'LINK_US_TXT' => sprintf($user->lang['LINK_US_TXT'], $config['sitename']),
|
||||
'U_LINK_US' => '<a href="' . $u_link . '" ' . (($config['site_desc']) ? 'title="' . $config['site_desc'] . '"' : '' ) . '>' . (($config['sitename']) ? $config['sitename'] : $u_link ) . '</a>',
|
||||
));
|
||||
|
||||
?>
|
||||
26
root/portal/block/links.php
Normal file
26
root/portal/block/links.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LINKS' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
32
root/portal/block/login_box.php
Normal file
32
root/portal/block/login_box.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$s_display = true;
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'U_PORTAL' => append_sid("{$phpbb_root_path}portal.$phpEx"),
|
||||
'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false,
|
||||
'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
|
||||
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
|
||||
));
|
||||
|
||||
?>
|
||||
22
root/portal/block/main_menu.php
Normal file
22
root/portal/block/main_menu.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
//we main delete this aswell? Oo
|
||||
?>
|
||||
164
root/portal/block/mini_cal.php
Normal file
164
root/portal/block/mini_cal.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @copyright (c) Adrian Cockburn - phpbb@netclectic.com (mini calendar)
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
define ('IN_MINI_CAL', 1);
|
||||
|
||||
include_once($phpbb_root_path . '/portal/includes/mini_cal/mini_cal_config.'.$phpEx);
|
||||
include_once($phpbb_root_path . '/portal/includes/mini_cal/mini_cal_common.'.$phpEx);
|
||||
include_once($phpbb_root_path . '/portal/includes/mini_cal/calendarSuite.'.$phpEx);
|
||||
// get the mode (if any)
|
||||
$mini_cal_mode = 0;
|
||||
if( isset($_GET['mode']) || isset($_POST['mode']) )
|
||||
{
|
||||
$mini_cal_mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
|
||||
}
|
||||
$mini_cal_mode = ($mini_cal_mode == 'personal') ? $mini_cal_mode : 'default';
|
||||
|
||||
// get the user (for personal calendar)
|
||||
if( isset($_GET['u']) || isset($_POST['u']) )
|
||||
{
|
||||
$mini_cal_user = ( isset($_POST['u']) ) ? intval($_POST['u']) : intval($_GET['u']);
|
||||
}
|
||||
|
||||
// get the calendar month
|
||||
$mini_cal_month = 0;
|
||||
if( isset($_GET['m']) || isset($_POST['m']) )
|
||||
{
|
||||
$mini_cal_month = ( isset($_POST['m']) ) ? intval($_POST['m']) : intval($_GET['m']);
|
||||
}
|
||||
|
||||
// initialise our calendarsuite class
|
||||
$mini_cal = new calendarSuite();
|
||||
|
||||
// setup our mini_cal template
|
||||
$template->set_filenames(array(
|
||||
'mini_cal_body' => 'portal/block/mini_cal_body.html'
|
||||
));
|
||||
|
||||
// initialise some variables
|
||||
$mini_cal_today = date('Ymd', time());
|
||||
$s_cal_month = ($mini_cal_month != 0) ? $mini_cal_month . ' month' : $mini_cal_today;
|
||||
$mini_cal->getMonth($s_cal_month);
|
||||
$mini_cal_count=MINI_CAL_FDOW;
|
||||
$mini_cal_this_year = $mini_cal->dateYYYY;
|
||||
$mini_cal_this_month = $mini_cal->dateMM;
|
||||
$mini_cal_this_day = $mini_cal->dateDD;
|
||||
$mini_cal_month_days = $mini_cal->daysMonth;
|
||||
|
||||
if ( MINI_CAL_CALENDAR_VERSION != 'NONE' )
|
||||
{
|
||||
// include the required events calendar support
|
||||
$mini_cal_inc = 'mini_cal_' . MINI_CAL_CALENDAR_VERSION;
|
||||
include_once($phpbb_root_path . 'portal/includes/mini_cal/' . $mini_cal_inc . '.' . $phpEx);
|
||||
|
||||
// include the required events calendar support
|
||||
$mini_cal_auth = getMiniCalForumsAuth($user);
|
||||
$mini_cal_event_days = getMiniCalEventDays($mini_cal_auth['view']);
|
||||
getMiniCalEvents($mini_cal_auth);
|
||||
getMiniCalPostForumsList($mini_cal_auth['post']);
|
||||
}
|
||||
|
||||
// output the days for the current month
|
||||
// if MINI_CAL_DATE_SEARCH = POSTS then hyperlink any days which have already past
|
||||
// if MINI_CAL_DATE_SEARCH = EVENTS then hyperkink any which have events
|
||||
$holiday=0;
|
||||
for($i=0; $i < $mini_cal_month_days;)
|
||||
{
|
||||
// is this the first day of the week?
|
||||
if($mini_cal_count==MINI_CAL_FDOW)
|
||||
{
|
||||
$template->assign_block_vars('mini_cal_row', array());
|
||||
}
|
||||
|
||||
// is this a valid weekday?
|
||||
if($mini_cal_count==($mini_cal->day[$i][7]))
|
||||
{
|
||||
$mini_cal_this_day = $mini_cal->day[$i][0];
|
||||
|
||||
$d_mini_cal_today = $mini_cal_this_year . ( ($mini_cal_this_month <= 9) ? '0' . $mini_cal_this_month : $mini_cal_this_month ) . ( ($mini_cal_this_day <= 9) ? '0' . $mini_cal_this_day : $mini_cal_this_day );
|
||||
$mini_cal_day = ( $mini_cal_today == $d_mini_cal_today ) ? '<span class="' . MINI_CAL_TODAY_CLASS . '" style="font-weight: bold; border-style: outset; border-width: thin; color:' . $portal_config['portal_minicalendar_today_color'] . ';">' . $mini_cal_this_day . '</span>' : $mini_cal_this_day;
|
||||
|
||||
if ( (MINI_CAL_CALENDAR_VERSION != 'NONE') && (MINI_CAL_DATE_SEARCH == 'EVENTS') )
|
||||
{
|
||||
$mini_cal_day_link = '<a href="' . getMiniCalSearchURL($d_mini_cal_today) . '" class="' . MINI_CAL_DAY_LINK_CLASS . '" style="color: ' . $portal_config['portal_minicalendar_day_link_color'] . ';">' . ( $mini_cal_day ) . '</a>';
|
||||
$mini_cal_day = ( in_array($mini_cal_this_day, $mini_cal_event_days) ) ? $mini_cal_day_link : $mini_cal_day;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nix_mini_cal_today = gmmktime($config['board_timezone'], 0, 0, $mini_cal_this_month, $mini_cal_this_day, $mini_cal_this_year);
|
||||
$mini_cal_day_link = '<a href="' . append_sid($phpbb_root_path . "search.$phpEx?search_id=unanswered&st=" . $nix_mini_cal_today) . '" class="' . MINI_CAL_DAY_LINK_CLASS . '" style="color: ' . $portal_config['portal_minicalendar_day_link_color'] . ';">' . ( $mini_cal_day ) . '</a>';
|
||||
$mini_cal_day = ( $mini_cal_today >= $d_mini_cal_today ) ? $mini_cal_day_link : $mini_cal_day;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('mini_cal_row.mini_cal_days', array(
|
||||
'MINI_CAL_DAY' => $mini_cal_day
|
||||
));
|
||||
$i++;
|
||||
}
|
||||
// no day
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('mini_cal_row.mini_cal_days', array(
|
||||
'MINI_CAL_DAY' => ' '
|
||||
));
|
||||
}
|
||||
|
||||
// is this the last day of the week?
|
||||
if ($mini_cal_count==6)
|
||||
{
|
||||
// if so then reset the count
|
||||
$mini_cal_count=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise increment the count
|
||||
$mini_cal_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// output our general calendar bits
|
||||
$prev_qs = setQueryStringVal('m', $mini_cal_month -1);
|
||||
$next_qs = setQueryStringVal('m', $mini_cal_month +1);
|
||||
$down = $mini_cal_month - 1;
|
||||
$up = $mini_cal_month + 1;
|
||||
$prev_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m=$down") . '"><img src="' . "{$phpbb_root_path}portal/images/mini_cal_icon_left_arrow.png" . '" title="' . $user->lang['View_previous_month'] . '" height="16" width="16" alt="<<" /></a>';
|
||||
$next_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m=$up") . '"><img src="' . "{$phpbb_root_path}portal/images/mini_cal_icon_right_arrow.png" . '" title="' . $user->lang['View_next_month'] . '" height="16" width="16" alt=">>" /></a>';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MINICAL' => true,
|
||||
'L_MINI_CAL_MONTH' => $user->lang['mini_cal']['long_month'][$mini_cal->day[0][4]] . " " . $mini_cal->day[0][5],
|
||||
'L_MINI_CAL_ADD_EVENT' => $user->lang['Mini_Cal_add_event'],
|
||||
'L_MINI_CAL_CALENDAR' => $user->lang['Mini_Cal_calendar'],
|
||||
'L_MINI_CAL_EVENTS' => $user->lang['Mini_Cal_events'],
|
||||
'L_MINI_CAL_NO_EVENTS' => $user->lang['Mini_Cal_no_events'],
|
||||
'L_MINI_CAL_SUN' => $user->lang['mini_cal']['day'][1],
|
||||
'L_MINI_CAL_MON' => $user->lang['mini_cal']['day'][2],
|
||||
'L_MINI_CAL_TUE' => $user->lang['mini_cal']['day'][3],
|
||||
'L_MINI_CAL_WED' => $user->lang['mini_cal']['day'][4],
|
||||
'L_MINI_CAL_THU' => $user->lang['mini_cal']['day'][5],
|
||||
'L_MINI_CAL_FRI' => $user->lang['mini_cal']['day'][6],
|
||||
'L_MINI_CAL_SAT' => $user->lang['mini_cal']['day'][7],
|
||||
'U_PREV_MONTH' => $prev_month,
|
||||
'U_NEXT_MONTH' => $next_month,
|
||||
));
|
||||
|
||||
?>
|
||||
117
root/portal/block/news.php
Normal file
117
root/portal/block/news.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Fetch Posts for news from portal/includes/functions.php
|
||||
//
|
||||
$template->assign_vars(array(
|
||||
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
|
||||
'S_DISPLAY_NEWS' => true,
|
||||
));
|
||||
|
||||
#if (!isset($HTTP_GET_VARS['article']))
|
||||
$news = request_var('news', -1);
|
||||
if($news < 0)
|
||||
{
|
||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
||||
|
||||
if (count($fetch_news) == 0)
|
||||
{
|
||||
$template->assign_block_vars('news_row', array(
|
||||
'S_NO_TOPICS' => true,
|
||||
'S_NOT_LAST' => false
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < count($fetch_news); $i++)
|
||||
{
|
||||
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
||||
{
|
||||
$open_bracket = '[ ';
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $user->lang['READ_FULL'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$open_bracket = '';
|
||||
$close_bracket = '';
|
||||
$read_full = '';
|
||||
}
|
||||
// unread?
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$template->assign_block_vars('news_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
'POSTER' => $fetch_news[$i]['username'],
|
||||
'U_USER_PROFILE' => (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
|
||||
'TIME' => $fetch_news[$i]['topic_time'],
|
||||
'TEXT' => $fetch_news[$i]['post_text'],
|
||||
'REPLIES' => $fetch_news[$i]['topic_replies'],
|
||||
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
|
||||
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
|
||||
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'U_READ_FULL' => append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
|
||||
'L_READ_FULL' => $read_full,
|
||||
'OPEN' => $open_bracket,
|
||||
'CLOSE' => $close_bracket,
|
||||
'S_NOT_LAST' => ($i < count($fetch_news) - 1) ? true : false,
|
||||
'S_POLL' => $fetch_news[$i]['poll'],
|
||||
'S_UNREAD_INFO' => $unread_topic,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], 0, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
||||
|
||||
$i = $news;
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$template->assign_block_vars('news_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
//'FORUM_NAME' => $fetch_news[$i]['forum_name'],
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
'POSTER' => $fetch_news[$i]['username'],
|
||||
'TIME' => $fetch_news[$i]['topic_time'],
|
||||
'TEXT' => $fetch_news[$i]['post_text'],
|
||||
'REPLIES' => $fetch_news[$i]['topic_replies'],
|
||||
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
|
||||
//'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'],
|
||||
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
|
||||
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'S_POLL' => $fetch_news[$i]['poll'],
|
||||
'S_UNREAD_INFO' => $unread_topic,
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
395
root/portal/block/poll.php
Normal file
395
root/portal/block/poll.php
Normal file
@@ -0,0 +1,395 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
// Initial var setup
|
||||
$forum_id = request_var('f', 0);
|
||||
$topic_id = request_var('t', ((!empty($portal_config['portal_poll_topic_id'])) ? $portal_config['portal_poll_topic_id'] : 0));
|
||||
$topic_id = preg_replace('/[^0-9]/', '', $topic_id); // just a temporary solution to get rid of sql errors
|
||||
$post_id = request_var('p', 0);
|
||||
$voted_id = request_var('vote_id', array('' => 0));
|
||||
|
||||
$start = request_var('start', 0);
|
||||
$view = request_var('view', '');
|
||||
|
||||
$sort_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0));
|
||||
$sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'));
|
||||
$sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'));
|
||||
|
||||
$update = request_var('update', false);
|
||||
|
||||
// Do we have a topic or post id?
|
||||
if (!$topic_id && !$post_id)
|
||||
{
|
||||
// trigger_error('NO_TOPIC');
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
|
||||
// Find topic id if user requested a newer or older topic
|
||||
if ($view && !$post_id)
|
||||
{
|
||||
if (!$forum_id)
|
||||
{
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
WHERE topic_id = $topic_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_id = (int) $db->sql_fetchfield('forum_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
trigger_error('NO_TOPIC');
|
||||
}
|
||||
}
|
||||
|
||||
// Check for global announcement correctness?
|
||||
if ((!isset($row) || !$row['forum_id']) && !$forum_id)
|
||||
{
|
||||
//trigger_error('NO_TOPIC');
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
else if (isset($row) && $row['forum_id'])
|
||||
{
|
||||
$forum_id = $row['forum_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// This rather complex gaggle of code handles querying for topics but
|
||||
// also allows for direct linking to a post (and the calculation of which
|
||||
// page the post is on and the correct display of viewtopic)
|
||||
$sql_array = array(
|
||||
'SELECT' => 't.*, f.*',
|
||||
|
||||
'FROM' => array(
|
||||
FORUMS_TABLE => 'f',
|
||||
)
|
||||
);
|
||||
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql_array['SELECT'] .= ', tw.notify_status';
|
||||
$sql_array['LEFT_JOIN'] = array();
|
||||
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(TOPICS_WATCH_TABLE => 'tw'),
|
||||
'ON' => 'tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id'
|
||||
);
|
||||
}
|
||||
|
||||
if (!$post_id)
|
||||
{
|
||||
$sql_array['WHERE'] = "t.topic_id = $topic_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id" . ((!$auth->acl_get('m_approve', $forum_id)) ? ' AND p.post_approved = 1' : '');
|
||||
$sql_array['FROM'][POSTS_TABLE] = 'p';
|
||||
}
|
||||
|
||||
$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id';
|
||||
|
||||
$sql_array['WHERE'] .= ')';
|
||||
$sql_array['FROM'][TOPICS_TABLE] = 't';
|
||||
|
||||
// Join to forum table on topic forum_id unless topic forum_id is zero
|
||||
// whereupon we join on the forum_id passed as a parameter ... this
|
||||
// is done so navigation, forum name, etc. remain consistent with where
|
||||
// user clicked to view a global topic
|
||||
$sql = $db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $db->sql_query($sql);
|
||||
$topic_data = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$topic_data)
|
||||
{
|
||||
// If post_id was submitted, we try at least to display the topic as a last resort...
|
||||
if ($post_id && $forum_id && $topic_id)
|
||||
{
|
||||
redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"));
|
||||
}
|
||||
|
||||
//trigger_error('NO_TOPIC');
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
|
||||
$forum_id = (int) $topic_data['forum_id'];
|
||||
$topic_id = (int) $topic_data['topic_id'];
|
||||
|
||||
// Setup look and feel
|
||||
$user->setup('viewtopic', $topic_data['forum_style']);
|
||||
|
||||
if (!$topic_data['topic_approved'] && !$auth->acl_get('m_approve', $forum_id))
|
||||
{
|
||||
//trigger_error('NO_TOPIC');
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
|
||||
// Start auth check
|
||||
if (!$auth->acl_get('f_read', $forum_id))
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
//trigger_error('SORRY_AUTH_READ');
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
|
||||
//login_box('', $user->lang['LOGIN_VIEWFORUM']);
|
||||
$portal_config['portal_poll_topic'] = false;
|
||||
}
|
||||
|
||||
// Forum is passworded ... check whether access has been granted to this
|
||||
// user this session, if not show login box
|
||||
if ($topic_data['forum_password'])
|
||||
{
|
||||
login_forum_box($topic_data);
|
||||
}
|
||||
|
||||
// Post ordering options
|
||||
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
||||
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
||||
$sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject');
|
||||
|
||||
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
|
||||
|
||||
// General Viewtopic URL for return links
|
||||
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param");
|
||||
|
||||
// This is only used for print view so ...
|
||||
$server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/';
|
||||
|
||||
// Does this topic contain a poll?
|
||||
if (!empty($topic_data['poll_start']))
|
||||
{
|
||||
$sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
|
||||
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p
|
||||
WHERE o.topic_id = $topic_id
|
||||
AND p.post_id = {$topic_data['topic_first_post_id']}
|
||||
AND p.topic_id = o.topic_id
|
||||
ORDER BY o.poll_option_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$poll_info = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$poll_info[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$cur_voted_id = array();
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql = 'SELECT poll_option_id
|
||||
FROM ' . POLL_VOTES_TABLE . '
|
||||
WHERE topic_id = ' . $topic_id . '
|
||||
AND vote_user_id = ' . $user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$cur_voted_id[] = $row['poll_option_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cookie based guest tracking ... I don't like this but hum ho
|
||||
// it's oft requested. This relies on "nice" users who don't feel
|
||||
// the need to delete cookies to mess with results.
|
||||
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]))
|
||||
{
|
||||
$cur_voted_id = explode(',', $_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]);
|
||||
$cur_voted_id = array_map('intval', $cur_voted_id);
|
||||
}
|
||||
}
|
||||
|
||||
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
|
||||
($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change'])) &&
|
||||
(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
|
||||
$topic_data['topic_status'] != ITEM_LOCKED &&
|
||||
$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;
|
||||
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false;
|
||||
|
||||
if ($update && $s_can_vote)
|
||||
{
|
||||
if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'])
|
||||
{
|
||||
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");
|
||||
|
||||
meta_refresh(5, $redirect_url);
|
||||
|
||||
$message = (!sizeof($voted_id)) ? 'NO_VOTE_OPTION' : 'TOO_MANY_VOTE_OPTIONS';
|
||||
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
foreach ($voted_id as $option)
|
||||
{
|
||||
if (in_array($option, $cur_voted_id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
|
||||
SET poll_option_total = poll_option_total + 1
|
||||
WHERE poll_option_id = ' . (int) $option . '
|
||||
AND topic_id = ' . (int) $topic_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql_ary = array(
|
||||
'topic_id' => (int) $topic_id,
|
||||
'poll_option_id' => (int) $option,
|
||||
'vote_user_id' => (int) $user->data['user_id'],
|
||||
'vote_user_ip' => (string) $user->ip,
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($cur_voted_id as $option)
|
||||
{
|
||||
if (!in_array($option, $voted_id))
|
||||
{
|
||||
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
|
||||
SET poll_option_total = poll_option_total - 1
|
||||
WHERE poll_option_id = ' . (int) $option . '
|
||||
AND topic_id = ' . (int) $topic_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . '
|
||||
WHERE topic_id = ' . (int) $topic_id . '
|
||||
AND poll_option_id = ' . (int) $option . '
|
||||
AND vote_user_id = ' . (int) $user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
|
||||
{
|
||||
$user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||
SET poll_last_vote = ' . time() . "
|
||||
WHERE topic_id = $topic_id";
|
||||
//, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now
|
||||
$db->sql_query($sql);
|
||||
|
||||
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");
|
||||
|
||||
meta_refresh(5, $redirect_url);
|
||||
trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'));
|
||||
}
|
||||
|
||||
$poll_total = 0;
|
||||
foreach ($poll_info as $poll_option)
|
||||
{
|
||||
$poll_total += $poll_option['poll_option_total'];
|
||||
}
|
||||
|
||||
if ($poll_info[0]['bbcode_bitfield'])
|
||||
{
|
||||
$poll_bbcode = new bbcode();
|
||||
}
|
||||
else
|
||||
{
|
||||
$poll_bbcode = false;
|
||||
}
|
||||
|
||||
for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)
|
||||
{
|
||||
$poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']);
|
||||
$poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', $poll_info[$i]['poll_option_text']);
|
||||
|
||||
if ($poll_bbcode !== false)
|
||||
{
|
||||
$poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
|
||||
}
|
||||
|
||||
$topic_data['poll_title'] = censor_text($topic_data['poll_title']);
|
||||
$topic_data['poll_title'] = str_replace("\n", '<br />', $topic_data['poll_title']);
|
||||
|
||||
if ($poll_bbcode !== false)
|
||||
{
|
||||
$poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
|
||||
}
|
||||
$topic_data['poll_title'] = smiley_text($topic_data['poll_title']);
|
||||
|
||||
unset($poll_bbcode);
|
||||
|
||||
foreach ($poll_info as $poll_option)
|
||||
{
|
||||
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
|
||||
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
|
||||
|
||||
$template->assign_block_vars('poll_option', array(
|
||||
'POLL_OPTION_ID' => $poll_option['poll_option_id'],
|
||||
'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
|
||||
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
|
||||
'POLL_OPTION_PERCENT' => $option_pct_txt,
|
||||
'POLL_OPTION_PCT' => round($option_pct * 100),
|
||||
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 10)),
|
||||
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false
|
||||
));
|
||||
}
|
||||
|
||||
$poll_end = $topic_data['poll_length'] + $topic_data['poll_start'];
|
||||
|
||||
$template->assign_vars(array(
|
||||
'POLL_QUESTION' => $topic_data['poll_title'],
|
||||
'TOTAL_VOTES' => $poll_total,
|
||||
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
|
||||
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
|
||||
|
||||
'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']),
|
||||
'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '',
|
||||
|
||||
'S_HAS_POLL' => true,
|
||||
'S_CAN_VOTE' => $s_can_vote,
|
||||
'S_DISPLAY_RESULTS' => $s_display_results,
|
||||
'S_IS_MULTI_CHOICE' => ($topic_data['poll_max_options'] > 1) ? true : false,
|
||||
'S_POLL_ACTION' => $viewtopic_url,
|
||||
|
||||
'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll'
|
||||
));
|
||||
unset($poll_end, $poll_info, $voted_id);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_POLL' => true
|
||||
));
|
||||
|
||||
?>
|
||||
63
root/portal/block/random_member.php
Normal file
63
root/portal/block/random_member.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_inactive_time = 0
|
||||
ORDER BY RAND()
|
||||
LIMIT 0,1';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
$avatar_img = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
|
||||
|
||||
$rank_title = $rank_img = '';
|
||||
get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);
|
||||
|
||||
$username = $row['username'];
|
||||
$user_id = (int) $row['user_id'];
|
||||
$colour = $row['user_colour'];
|
||||
|
||||
$template->assign_block_vars('random_member', array(
|
||||
//'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
|
||||
'USERNAME' => get_username_string('username', $user_id, $username, $colour),
|
||||
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
|
||||
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
|
||||
|
||||
'RANK_TITLE' => $rank_title,
|
||||
'RANK_IMG' => $rank_img,
|
||||
'RANK_IMG_SRC' => $rank_img_src,
|
||||
|
||||
'USER_POSTS' => (int) $row['user_posts'],
|
||||
'AVATAR_IMG' => $avatar_img,
|
||||
'JOINED' => $user->format_date($row['user_regdate'], 'd.M.Y'),
|
||||
'USER_OCC' => censor_text($row['user_occ']),
|
||||
'USER_FROM' => censor_text($row['user_from']),
|
||||
'U_WWW' => censor_text($row['user_website']),
|
||||
));
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANDOM_MEMBER' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
158
root/portal/block/recent.php
Normal file
158
root/portal/block/recent.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Exclude forums
|
||||
//
|
||||
$sql_where = '';
|
||||
if ($portal_config['portal_exclude_forums'])
|
||||
{
|
||||
$exclude_forums = explode(',', $portal_config['portal_exclude_forums']);
|
||||
foreach ($exclude_forums as $i => $id)
|
||||
{
|
||||
if ($id > 0)
|
||||
{
|
||||
$sql_where .= ' AND forum_id <> ' . trim($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Recent announcements
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_status <> ' . FORUM_LINK . '
|
||||
AND topic_approved = 1
|
||||
AND ( topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ' )
|
||||
' . $sql_where . '
|
||||
ORDER BY topic_time DESC';
|
||||
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title']) )
|
||||
{
|
||||
// auto auth
|
||||
if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
|
||||
{
|
||||
$template->assign_block_vars('latest_announcements', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// Recent hot topics
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_approved = 1
|
||||
AND topic_replies >=' . $config['hot_threshold'] . '
|
||||
' . $sql_where . '
|
||||
ORDER BY topic_time DESC';
|
||||
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title']) )
|
||||
{
|
||||
// auto auth
|
||||
if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
|
||||
{
|
||||
$template->assign_block_vars('latest_hot_topics', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// Recent topic (only show normal topic)
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_status <> ' . FORUM_LINK . '
|
||||
AND topic_approved = 1
|
||||
AND topic_type = ' . POST_NORMAL . '
|
||||
' . $sql_where . '
|
||||
ORDER BY topic_time DESC';
|
||||
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title']) )
|
||||
{
|
||||
// auto auth
|
||||
if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
|
||||
{
|
||||
$template->assign_block_vars('latest_topics', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
/*//we may also delete this?
|
||||
//
|
||||
// Recent active topic
|
||||
//
|
||||
$last_post_time_sql = ($sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($sort_days * 24 * 3600)) : '';
|
||||
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id, topic_time, topic_first_poster_name
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_status <> ' . FORUM_LINK . "
|
||||
$last_post_time_sql
|
||||
AND topic_moved_id = 0
|
||||
AND topic_approved = 1
|
||||
AND topic_type = " . POST_NORMAL . '
|
||||
' . $sql_where . '
|
||||
ORDER BY topic_time DESC';
|
||||
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title']) )
|
||||
{
|
||||
// auto auth
|
||||
if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
|
||||
{
|
||||
$template->assign_block_vars('active_topics', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'DATE' => $user->format_date($row['topic_time']),
|
||||
'POSTER' => $row['topic_first_poster_name'],
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
*/
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RECENT' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
28
root/portal/block/search.php
Normal file
28
root/portal/block/search.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_PORTALSEARCH' => true,
|
||||
'S_SEARCH_ACTION' => "{$phpbb_root_path}search.$phpEx",
|
||||
|
||||
));
|
||||
|
||||
?>
|
||||
149
root/portal/block/statistics.php
Normal file
149
root/portal/block/statistics.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
// switch idea from phpBB2 :p
|
||||
function get_db_stat($mode)
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
switch( $mode )
|
||||
{
|
||||
case 'announcmenttotal':
|
||||
$sql = 'SELECT COUNT(distinct t.topic_id) AS announcment_total
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||
WHERE t.topic_type = ' . POST_ANNOUNCE . '
|
||||
AND p.post_id = t.topic_first_post_id';
|
||||
break;
|
||||
case 'stickytotal':
|
||||
$sql = 'SELECT COUNT(distinct t.topic_id) AS sticky_total
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||
WHERE t.topic_type = ' . POST_STICKY . '
|
||||
AND p.post_id = t.topic_first_post_id';
|
||||
break;
|
||||
case 'attachmentstotal':
|
||||
$sql = 'SELECT COUNT(attach_id) AS attachments_total
|
||||
FROM ' . ATTACHMENTS_TABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
switch ( $mode )
|
||||
{
|
||||
case 'announcmenttotal':
|
||||
return $row['announcment_total'];
|
||||
break;
|
||||
case 'stickytotal':
|
||||
return $row['sticky_total'];
|
||||
break;
|
||||
case 'attachmentstotal':
|
||||
return $row['attachments_total'];
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
|
||||
$total_posts = $config['num_posts'];
|
||||
$total_topics = $config['num_topics'];
|
||||
$total_users = $config['num_users'];
|
||||
|
||||
// no last user color, no more SQL codes ;)
|
||||
$newest_user = $config['newest_username'];
|
||||
$newest_uid = $config['newest_user_id'];
|
||||
|
||||
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
|
||||
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
|
||||
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
|
||||
|
||||
// avarage stat
|
||||
$board_days = ( time() - $config['board_startdate'] ) / 86400;
|
||||
|
||||
$topics_per_day = round($total_topics / $board_days, 0);
|
||||
$posts_per_day = round($total_posts / $board_days, 0);
|
||||
$users_per_day = round($total_users / $board_days, 0);
|
||||
$topics_per_user = round($total_topics / $total_users, 0);
|
||||
$posts_per_user = round($total_posts / $total_users, 0);
|
||||
$posts_per_topic = round($total_posts / $total_topics, 0);
|
||||
|
||||
if ($topics_per_day > $total_topics)
|
||||
{
|
||||
$topics_per_day = $total_topics;
|
||||
}
|
||||
|
||||
if ($posts_per_day > $total_posts)
|
||||
{
|
||||
$posts_per_day = $total_posts;
|
||||
}
|
||||
|
||||
if ($users_per_day > $total_users)
|
||||
{
|
||||
$users_per_day = $total_users;
|
||||
}
|
||||
|
||||
if ($topics_per_user > $total_topics)
|
||||
{
|
||||
$topics_per_user = $total_topics;
|
||||
}
|
||||
|
||||
if ($posts_per_user > $total_posts)
|
||||
{
|
||||
$posts_per_user = $total_posts;
|
||||
}
|
||||
|
||||
if ($posts_per_topic > $total_posts)
|
||||
{
|
||||
$posts_per_topic = $total_posts;
|
||||
}
|
||||
|
||||
$l_topics_per_day_s = ($total_topics == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
|
||||
$l_posts_per_day_s = ($total_posts == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
|
||||
$l_users_per_day_s = ($total_users == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
|
||||
$l_topics_per_user_s = ($total_topics == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
|
||||
$l_posts_per_user_s = ($total_posts == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
|
||||
$l_posts_per_topic_s = ($total_posts == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ADVANCED_STAT' => true,
|
||||
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
||||
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
||||
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
||||
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $newest_uid) . '" style="color: #' . $config['newest_user_colour'] . ';">' . $newest_user . '</a>'),
|
||||
'S_ANN' => get_db_stat('announcmenttotal'),
|
||||
'S_SCT' => get_db_stat('stickytotal'),
|
||||
'S_TOT_ATTACH' => get_db_stat('attachmentstotal'),
|
||||
|
||||
// avarage stat
|
||||
'TOPICS_PER_DAY' => sprintf($user->lang[$l_topics_per_day_s], $topics_per_day),
|
||||
'POSTS_PER_DAY' => sprintf($user->lang[$l_posts_per_day_s], $posts_per_day),
|
||||
'USERS_PER_DAY' => sprintf($user->lang[$l_users_per_day_s], $users_per_day),
|
||||
'TOPICS_PER_USER' => sprintf($user->lang[$l_topics_per_user_s], $topics_per_user),
|
||||
'POSTS_PER_USER' => sprintf($user->lang[$l_posts_per_user_s], $posts_per_user),
|
||||
'POSTS_PER_TOPIC' => sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic),
|
||||
));
|
||||
|
||||
?>
|
||||
48
root/portal/block/top_posters.php
Normal file
48
root/portal/block/top_posters.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
$sql = 'SELECT user_id, username, user_posts, user_colour
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_posts <> 0
|
||||
ORDER BY user_posts DESC';
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_max_most_poster']);
|
||||
|
||||
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
|
||||
{
|
||||
$template->assign_block_vars('top_poster', array(
|
||||
'S_SEARCH_ACTION'=> append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
|
||||
'USERNAME' => censor_text($row['username']),
|
||||
'USERNAME_COLOR'=> ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : '',
|
||||
'U_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
|
||||
'POSTER_POSTS' => $row['user_posts'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_TOP_POSTERS' => true
|
||||
));
|
||||
|
||||
?>
|
||||
86
root/portal/block/user_menu.php
Normal file
86
root/portal/block/user_menu.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// + new posts since last visit & you post number
|
||||
//
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
// new posts since last visit
|
||||
$sql = "SELECT COUNT(distinct post_id) as total
|
||||
FROM " . POSTS_TABLE . "
|
||||
WHERE post_time >= " . $user->data['session_last_visit'];
|
||||
$result = $db->sql_query($sql);
|
||||
$new_posts_count = (int) $db->sql_fetchfield('total');
|
||||
|
||||
// your post number
|
||||
$sql = "SELECT user_posts
|
||||
FROM " . USERS_TABLE . "
|
||||
WHERE user_id = " . $user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$you_posts_count = (int) $db->sql_fetchfield('user_posts');
|
||||
}
|
||||
//
|
||||
// - new posts since last visit & you post number
|
||||
//
|
||||
|
||||
|
||||
// Get user...
|
||||
$user_id = $user->data['user_id'];
|
||||
$username = $user->data['username'];
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
|
||||
$result = $db->sql_query($sql);
|
||||
$member = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$avatar_img = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
|
||||
$rank_title = $rank_img = '';
|
||||
get_user_rank($member['user_rank'], $member['user_posts'], $rank_title, $rank_img, $rank_img_src);
|
||||
$username = $member['username'];
|
||||
$user_id = (int) $member['user_id'];
|
||||
$colour = $member['user_colour'];
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'L_NEW_POSTS' => $user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')',
|
||||
'L_SELF_POSTS' => $user->lang['SEARCH_SELF'] . ' (' . $you_posts_count . ')',
|
||||
|
||||
'AVATAR_IMG' => $avatar_img,
|
||||
|
||||
'RANK_TITLE' => $rank_title,
|
||||
'RANK_IMG' => $rank_img,
|
||||
'RANK_IMG_SRC' => $rank_img_src,
|
||||
|
||||
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
|
||||
'USERNAME' => get_username_string('username', $user_id, $username, $colour),
|
||||
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
|
||||
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
|
||||
|
||||
'U_NEW_POSTS' => append_sid($phpbb_root_path . 'search.' . $phpEx . '?search_id=newposts'),
|
||||
'U_SELF_POSTS' => append_sid($phpbb_root_path . 'search.' . $phpEx . '?search_id=egosearch'),
|
||||
'U_UM_BOOKMARKS' => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?i=main&mode=bookmarks'),
|
||||
'U_UM_MAIN_SUBSCRIBED' => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?i=main&mode=subscribed'),
|
||||
'U_PRIVATE_MESSAGES' => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?i=pm&folder=inbox'),
|
||||
));
|
||||
|
||||
?>
|
||||
251
root/portal/block/whois_online.php
Normal file
251
root/portal/block/whois_online.php
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// who is online borrowed from index.php (phpBB-3.0.B3)
|
||||
// if this gets changed (in index.php) and I don't notice it, please tell me)
|
||||
//
|
||||
|
||||
// Grab group details for legend display
|
||||
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_legend = 1
|
||||
AND group_type <> ' . GROUP_HIDDEN . '
|
||||
ORDER BY group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$legend = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
|
||||
|
||||
if ($row['group_name'] == 'BOTS')
|
||||
{
|
||||
$legend .= (($legend) ? ', ' : '') . '<span' . $colour_text . '>' . $user->lang['G_BOTS'] . '</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend .= (($legend) ? ', ' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// users online list borrowed from includes/functions.php (phpBB-3.0.B3)
|
||||
// if this gets changed (in functions.php) and I don't notice it, please tell me)
|
||||
//
|
||||
$display_online_list = true;
|
||||
|
||||
// Get users online list ... if required
|
||||
$l_online_users = $online_userlist = $l_online_record = '';
|
||||
|
||||
if ($config['load_online'] && $config['load_online_time'] && $display_online_list)
|
||||
{
|
||||
$userlist_ary = $userlist_visible = array();
|
||||
$logged_visible_online = $logged_hidden_online = $guests_online = $prev_user_id = 0;
|
||||
$prev_session_ip = $reading_sql = '';
|
||||
|
||||
if (!empty($_REQUEST['f']))
|
||||
{
|
||||
$f = request_var('f', 0);
|
||||
|
||||
// Do not change this (it is defined as _f_={forum_id}x within session.php)
|
||||
$reading_sql = " AND s.session_page LIKE '%\_f\_={$f}x%'";
|
||||
|
||||
// Specify escape character for MSSQL
|
||||
if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
|
||||
{
|
||||
$reading_sql .= " ESCAPE '\\'";
|
||||
}
|
||||
}
|
||||
|
||||
// Get number of online guests
|
||||
if (!$config['load_online_guests'])
|
||||
{
|
||||
if ($db->sql_layer === 'sqlite')
|
||||
{
|
||||
$sql = 'SELECT COUNT(session_ip) as num_guests
|
||||
FROM (
|
||||
SELECT DISTINCT s.session_ip
|
||||
FROM ' . SESSIONS_TABLE . ' s
|
||||
WHERE s.session_user_id = ' . ANONYMOUS . '
|
||||
AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
|
||||
$reading_sql .
|
||||
')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT COUNT(DISTINCT s.session_ip) as num_guests
|
||||
FROM ' . SESSIONS_TABLE . ' s
|
||||
WHERE s.session_user_id = ' . ANONYMOUS . '
|
||||
AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
|
||||
$reading_sql;
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
$guests_online = (int) $db->sql_fetchfield('num_guests');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$sql = 'SELECT u.username, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_viewonline
|
||||
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . ' s
|
||||
WHERE s.session_time >= ' . (time() - (intval($config['load_online_time']) * 60)) .
|
||||
$reading_sql .
|
||||
((!$config['load_online_guests']) ? ' AND s.session_user_id <> ' . ANONYMOUS : '') . '
|
||||
AND u.user_id = s.session_user_id
|
||||
ORDER BY u.username ASC, s.session_ip ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// User is logged in and therefore not a guest
|
||||
if ($row['user_id'] != ANONYMOUS)
|
||||
{
|
||||
// Skip multiple sessions for one user
|
||||
if ($row['user_id'] != $prev_user_id)
|
||||
{
|
||||
if ($row['user_colour'])
|
||||
{
|
||||
$user_colour = ' style="color:#' . $row['user_colour'] . '"';
|
||||
$row['username'] = '<strong>' . $row['username'] . '</strong>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_colour = '';
|
||||
}
|
||||
|
||||
if ($row['user_allow_viewonline'] && $row['session_viewonline'])
|
||||
{
|
||||
$user_online_link = $row['username'];
|
||||
$logged_visible_online++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_online_link = '<em>' . $row['username'] . '</em>';
|
||||
$logged_hidden_online++;
|
||||
}
|
||||
|
||||
if (($row['user_allow_viewonline'] && $row['session_viewonline']) || $auth->acl_get('u_viewonline'))
|
||||
{
|
||||
if ($row['user_type'] <> USER_IGNORE)
|
||||
{
|
||||
$user_online_link = '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '"' . $user_colour . '>' . $user_online_link . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_online_link = ($user_colour) ? '<span' . $user_colour . '>' . $user_online_link . '</span>' : $user_online_link;
|
||||
}
|
||||
|
||||
$online_userlist .= ($online_userlist) ? ', ' . $user_online_link : $user_online_link;
|
||||
}
|
||||
}
|
||||
|
||||
$prev_user_id = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip multiple sessions for one user
|
||||
if ($row['session_ip'] != $prev_session_ip)
|
||||
{
|
||||
$guests_online++;
|
||||
}
|
||||
}
|
||||
|
||||
$prev_session_ip = $row['session_ip'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$online_userlist)
|
||||
{
|
||||
$online_userlist = $user->lang['NO_ONLINE_USERS'];
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['f']))
|
||||
{
|
||||
$online_userlist = $user->lang['REGISTERED_USERS'] . ' ' . $online_userlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
$l_online = ($guests_online == 1) ? $user->lang['BROWSING_FORUM_GUEST'] : $user->lang['BROWSING_FORUM_GUESTS'];
|
||||
$online_userlist = sprintf($l_online, $online_userlist, $guests_online);
|
||||
}
|
||||
|
||||
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
|
||||
|
||||
if ($total_online_users > $config['record_online_users'])
|
||||
{
|
||||
set_config('record_online_users', $total_online_users, true);
|
||||
set_config('record_online_date', time(), true);
|
||||
}
|
||||
|
||||
// Build online listing
|
||||
$vars_online = array(
|
||||
'ONLINE' => array('total_online_users', 'l_t_user_s'),
|
||||
'REG' => array('logged_visible_online', 'l_r_user_s'),
|
||||
'HIDDEN' => array('logged_hidden_online', 'l_h_user_s'),
|
||||
'GUEST' => array('guests_online', 'l_g_user_s')
|
||||
);
|
||||
|
||||
foreach ($vars_online as $l_prefix => $var_ary)
|
||||
{
|
||||
switch (${$var_ary[0]})
|
||||
{
|
||||
case 0:
|
||||
${$var_ary[1]} = $user->lang[$l_prefix . '_USERS_ZERO_TOTAL'];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
${$var_ary[1]} = $user->lang[$l_prefix . '_USER_TOTAL'];
|
||||
break;
|
||||
|
||||
default:
|
||||
${$var_ary[1]} = $user->lang[$l_prefix . '_USERS_TOTAL'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($vars_online);
|
||||
|
||||
$l_online_users = sprintf($l_t_user_s, $total_online_users);
|
||||
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
|
||||
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
|
||||
$l_online_users .= sprintf($l_g_user_s, $guests_online);
|
||||
|
||||
$l_online_record = sprintf($user->lang['RECORD_ONLINE_USERS'], $config['record_online_users'], $user->format_date($config['record_online_date']));
|
||||
|
||||
$l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES';
|
||||
$l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$l_online_time = '';
|
||||
}
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ONLINE_PORTAL_LIST' => true,
|
||||
'TOTAL_ONLINE_USERS' => $total_online_users,
|
||||
'VISIBLE_ONLINE' => $logged_visible_online,
|
||||
'HIDDEN_ONLINE' => $logged_hidden_online,
|
||||
'GUEST_ONLINE' => $guests_online,
|
||||
'RECORD_USERS' => $l_online_record,
|
||||
'LEGEND'=> $legend,
|
||||
));
|
||||
|
||||
?>
|
||||
76
root/portal/block/wordgraph.php
Normal file
76
root/portal/block/wordgraph.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package - Board3portal
|
||||
* @version $Id$
|
||||
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$words_array = array();
|
||||
|
||||
// Get words and number of those words
|
||||
$sql = 'SELECT l.word_text, COUNT(*) AS word_count
|
||||
FROM ' . SEARCH_WORDLIST_TABLE . ' AS l, ' . SEARCH_WORDMATCH_TABLE . ' AS m
|
||||
WHERE m.word_id = l.word_id
|
||||
GROUP BY m.word_id
|
||||
ORDER BY word_count DESC';
|
||||
$result = $db->sql_query_limit($sql, $portal_config['portal_wordgraph_max_words']);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$word = strtolower($row['word_text']);
|
||||
$words_array[$word] = $row['word_count'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$minimum = 1000000;
|
||||
$maximum = -1000000;
|
||||
|
||||
foreach ( array_keys($words_array) as $word )
|
||||
{
|
||||
if ( $words_array[$word] > $maximum )
|
||||
{
|
||||
$maximum = $words_array[$word];
|
||||
}
|
||||
|
||||
if ( $words_array[$word] < $minimum )
|
||||
{
|
||||
$minimum = $words_array[$word];
|
||||
}
|
||||
}
|
||||
|
||||
// ratio
|
||||
$ratio = $portal_config['portal_wordgraph_ratio'] / ( $maximum - $minimum +1);
|
||||
|
||||
$words = array_keys($words_array);
|
||||
sort($words);
|
||||
|
||||
foreach ( $words as $word )
|
||||
{
|
||||
$template->assign_block_vars('wordgraph', array(
|
||||
'WORD' => ($portal_config['portal_wordgraph_word_counts']) ? $word . '(' . $words_array[$word] . ')' : $word,
|
||||
'WORD_FONT_SIZE' => (int) ( 9 + ( $words_array[$word] * $ratio ) ),
|
||||
'WORD_SEARCH_URL' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode($word)),
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_WORDGRAPH' => true,
|
||||
'L_WORDGRAPH' => $user->lang['WORDGRAPH'],
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user