Report #67: not using phpbb-function to colour user names
This commit is contained in:
@@ -12,70 +12,57 @@
|
||||
|
||||
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
|
||||
{
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
// Generate birthday list if required ... / borrowed from index.php (RC4)
|
||||
// Generate birthday list if required ... / borrowed from index.php (RC4)
|
||||
$birthday_list = '';
|
||||
$birthday_ahead_list = '';
|
||||
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||
{
|
||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
||||
$today = (mktime(0, 0, 0, $now['mon'], $now['mday'], $now['year']));
|
||||
|
||||
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_birthday <> ''
|
||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ') ORDER BY SUBSTRING(user_birthday FROM 4 FOR 2) ASC, SUBSTRING(user_birthday FROM 1 FOR 2) ASC, username_clean ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
||||
$today = (mktime(0, 0, 0, $now['mon'], $now['mday'], $now['year']));
|
||||
|
||||
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_birthday <> ''
|
||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ') ORDER BY SUBSTRING(user_birthday FROM 4 FOR 2) ASC, SUBSTRING(user_birthday FROM 1 FOR 2) ASC, username_clean ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
|
||||
$user_birthday = strtotime($birthdaydate);
|
||||
if($user_birthday == $today)
|
||||
{
|
||||
$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) . ')<br />'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if( $portal_config['portal_birthdays_ahead'] > 0 )
|
||||
{
|
||||
if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($portal_config['portal_birthdays_ahead'] * 86400) ) )
|
||||
{
|
||||
if ($row['user_colour'])
|
||||
{
|
||||
$user_colour = ' style="color:#' . $row['user_colour'] . '"';
|
||||
$row['username'] = '<strong>' . $row['username'] . '</strong>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_colour = '';
|
||||
}
|
||||
|
||||
$birthday_ahead_list .= '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '" title="' . date('d M', $user_birthday) . '">' . $row['username'] . '</a>';
|
||||
|
||||
if ( $age = (int) substr($row['user_birthday'], -4) )
|
||||
{
|
||||
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')<br />'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
|
||||
$user_birthday = strtotime($birthdaydate);
|
||||
if($user_birthday == $today)
|
||||
{
|
||||
$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) . ')<br />'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if( $portal_config['portal_birthdays_ahead'] > 0 )
|
||||
{
|
||||
if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($portal_config['portal_birthdays_ahead'] * 86400) ) )
|
||||
{
|
||||
$birthday_ahead_list .= get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
|
||||
if ( $age = (int) substr($row['user_birthday'], -4) )
|
||||
{
|
||||
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')<br />'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Assign index specific vars
|
||||
$template->assign_vars(array(
|
||||
'BIRTHDAY_LIST' => $birthday_list,
|
||||
'BIRTHDAYS_AHEAD_LIST' => ( $portal_config['portal_birthdays_ahead'] > 0 ) ? $birthday_ahead_list : '',
|
||||
'L_BIRTHDAYS_AHEAD' => sprintf($user->lang['BIRTHDAYS_AHEAD'], $portal_config['portal_birthdays_ahead']),
|
||||
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
||||
)
|
||||
);
|
||||
'BIRTHDAY_LIST' => $birthday_list,
|
||||
'BIRTHDAYS_AHEAD_LIST' => ( $portal_config['portal_birthdays_ahead'] > 0 ) ? $birthday_ahead_list : '',
|
||||
'L_BIRTHDAYS_AHEAD' => sprintf($user->lang['BIRTHDAYS_AHEAD'], $portal_config['portal_birthdays_ahead']),
|
||||
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
||||
));
|
||||
|
||||
?>
|
||||
@@ -30,9 +30,7 @@ $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']),
|
||||
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'JOINED' => $user->format_date($row['user_regdate'], $format = 'd M'),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -72,10 +72,6 @@ $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';
|
||||
@@ -133,7 +129,7 @@ $template->assign_vars(array(
|
||||
'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>'),
|
||||
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
|
||||
'S_ANN' => get_db_stat('announcmenttotal'),
|
||||
'S_SCT' => get_db_stat('stickytotal'),
|
||||
'S_TOT_ATTACH' => get_db_stat('attachmentstotal'),
|
||||
|
||||
@@ -33,9 +33,7 @@ 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']),
|
||||
'USERNAME_FULL'=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'POSTER_POSTS' => $row['user_posts'],
|
||||
)
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<span style="float:left;"><strong>{L_USERNAME}</strong></span>
|
||||
<span style="float:right;padding-right:10px;"><strong>{L_JOINED}</strong></span><br />
|
||||
<!-- BEGIN latest_members -->
|
||||
<span style="float:left;"><img src="portal/images/member.gif" height="15" width="15" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><a href="{latest_members.U_USERNAME}"><span<!-- IF latest_members.USERNAME_COLOR -->{latest_members.USERNAME_COLOR}<!-- ENDIF -->>{latest_members.USERNAME}</span></a></span>
|
||||
<span style="float:left;"><img src="portal/images/member.gif" height="15" width="15" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;">{latest_members.USERNAME_FULL}</span>
|
||||
<span style="float:right;padding-right:10px; padding-top:2px;">{latest_members.JOINED}</span><br style="clear:both" />
|
||||
<!-- END latest_members -->
|
||||
<span class="corners-bottom"><span></span></span>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<span style="float:left;"><strong>{L_USERNAME}</strong></span>
|
||||
<span style="float:right;padding-right:10px;"><strong>{L_POSTS}</strong></span><br />
|
||||
<!-- BEGIN top_poster -->
|
||||
<span style="float:left;"><img src="portal/images/member.gif" height="15" width="15" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><a href="{top_poster.U_USERNAME}"><span<!-- IF top_poster.USERNAME_COLOR -->{top_poster.USERNAME_COLOR}<!-- ENDIF -->>{top_poster.USERNAME}</span></a></span>
|
||||
<span style="float:left;"><img src="portal/images/member.gif" height="15" width="15" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;">{top_poster.USERNAME_FULL}</span>
|
||||
<span style="float:right;padding-right:10px; padding-top:2px;"><a href="{top_poster.S_SEARCH_ACTION}">{top_poster.POSTER_POSTS}</a></span><br style="clear:both" />
|
||||
<!-- END top_poster -->
|
||||
<span class="corners-bottom"><span></span></span>
|
||||
|
||||
Reference in New Issue
Block a user