From 9ce38e6977c2d295d9646b2e5c171318bf2f34bd Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 20 May 2003 23:57:08 +0000 Subject: [PATCH] Enable display of birthday listing ... controlled via ACP Load Settings git-svn-id: file:///svn/phpbb/trunk@4034 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_board.php | 11 +++++++-- phpBB/includes/ucp/ucp_profile.php | 9 ++++--- phpBB/index.php | 29 ++++++++++++++++++++++- phpBB/language/en/lang_admin.php | 4 +++- phpBB/language/en/lang_main.php | 11 +++++++-- phpBB/templates/subSilver/index_body.html | 16 ++++++++++++- 6 files changed, 70 insertions(+), 10 deletions(-) diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php index 32b7f69ba7..4e65f4188c 100644 --- a/phpBB/adm/admin_board.php +++ b/phpBB/adm/admin_board.php @@ -331,6 +331,7 @@ switch ($mode) $activation_none = ($new['require_activation'] == USER_ACTIVATION_NONE) ? 'checked="checked"' : ''; $activation_user = ($new['require_activation'] == USER_ACTIVATION_SELF) ? 'checked="checked"' : ''; $activation_admin = ($new['require_activation'] == USER_ACTIVATION_ADMIN) ? 'checked="checked"' : ''; + $activation_user_admin = ($new['require_activation'] == USER_ACTIVATION_SELF_ADMIN) ? 'checked="checked"' : ''; $activation_disable = ($new['require_activation'] == USER_ACTIVATION_DISABLE) ? 'checked="checked"' : ''; $privmsg_on = (!$new['privmsg_disable']) ? 'checked="checked"' : ''; @@ -356,11 +357,11 @@ switch ($mode) lang['ACC_ACTIVATION']; ?>:
lang['ACC_ACTIVATION_EXPLAIN']; ?> - />lang['ACC_NONE']; ?>    />lang['ACC_USER']; ?>    />lang['ACC_ADMIN']; ?>    />lang['ACC_DISABLE']; ?> + /> lang['ACC_NONE']; ?>    /> lang['ACC_USER']; ?>    /> lang['ACC_ADMIN']; ?>    /> lang['ACC_USER_ADMIN']; ?>    /> lang['ACC_DISABLE']; ?> lang['VISUAL_CONFIRM']; ?>:
lang['VISUAL_CONFIRM_EXPLAIN']; ?> - />lang['YES'] ?>    /> lang['NO']; ?> + /> lang['YES'] ?>    /> lang['NO']; ?> @@ -538,6 +539,8 @@ switch ($mode) $load_db_lastread_no = (!$new['load_db_lastread']) ? 'checked="checked"' : ''; $load_online_yes = ($new['load_online']) ? 'checked="checked"' : ''; $load_online_no = (!$new['load_online']) ? 'checked="checked"' : ''; + $load_birthdays_yes = ($new['load_birthdays']) ? 'checked="checked"' : ''; + $load_birthdays_no = (!$new['load_birthdays']) ? 'checked="checked"' : ''; $moderators_yes = ($new['load_moderators']) ? 'checked="checked"' : ''; $moderators_no = (!$new['load_moderators']) ? 'checked="checked"' : ''; $search_yes = ($new['load_search']) ? 'checked="checked"' : ''; @@ -576,6 +579,10 @@ switch ($mode) lang['VIEW_ONLINE_TIME']; ?>:
lang['VIEW_ONLINE_TIME_EXPLAIN']; ?> + + lang['YES_BIRTHDAYS']; ?>: + />lang['YES'] ?>    /> lang['NO']; ?> + lang['YES_MODERATORS']; ?>: />lang['YES'] ?>    /> lang['NO']; ?> diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index dfe3e09cf4..bb309c0418 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -47,6 +47,7 @@ class ucp_profile extends ucp 'string' => array( 'username' => '2,30', 'email' => '7,60', + 'email_confirm' => '7,60', 'password_confirm' => '6,255', 'new_password' => '6,255', 'cur_password' => '6,255', @@ -59,6 +60,7 @@ class ucp_profile extends ucp 'compare' => array( 'password_confirm' => ($data['new_password']) ? $data['new_password'] : '', 'cur_password' => ($data['new_password'] || $data['email'] != $user->data['user_email']) ? $user->data['user_password'] : '', + 'email_confirm' => ($data['email'] != $user->data['user_email']) ? $data['email'] : '', ), 'function' => array( 'username' => ($data['username'] != $user->data['username']) ? 'validate_username' : '', @@ -147,7 +149,7 @@ class ucp_profile extends ucp 'user_from' => $data['location'], 'user_occ' => $data['occupation'], 'user_interests'=> $data['interests'], - 'user_birthday' => implode('-', array($data['bday_day'], $data['bday_month'], $data['bday_year'])), + 'user_birthday' => sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']), ); $sql = 'UPDATE ' . USERS_TABLE . ' @@ -170,14 +172,14 @@ class ucp_profile extends ucp list($bday_day, $bday_month, $bday_year) = explode('-', $user->data['user_birthday']); } - $s_birthday_day_options = ''; + $s_birthday_day_options = ''; for ($i = 1; $i < 32; $i++) { $selected = ($i == $bday_day) ? ' selected="selected"' : ''; $s_birthday_day_options .= ""; } - $s_birthday_month_options = ''; + $s_birthday_month_options = ''; for ($i = 1; $i < 13; $i++) { $selected = ($i == $bday_month) ? ' selected="selected"' : ''; @@ -186,6 +188,7 @@ class ucp_profile extends ucp $s_birthday_year_options = ''; $now = getdate(); + $s_birthday_year_options = ''; for ($i = $now['year'] - 100; $i < $now['year']; $i++) { $selected = ($i == $bday_year) ? ' selected="selected"' : ''; diff --git a/phpBB/index.php b/phpBB/index.php index 0dcc409fa3..c164a2c175 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -110,6 +110,31 @@ while ($row = $db->sql_fetchrow($result)) { $legend .= (($legend != '') ? ', ' : '') . '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ''; } +$db->sql_freeresult($result); + + +// Generate birthday list if required ... +$birthday_list = ''; +if ($config['load_birthdays']) +{ + $now = getdate(); + $sql = 'SELECT user_id, username, user_colour, user_birthday + FROM ' . USERS_TABLE . " + WHERE user_birthday LIKE '" . sprintf('%2d-%2d-', $now['mday'], $now['mon']) . "%'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : ''; + $birthday_list .= (($birthday_list != '') ? ', ' : '') . '' . $row['username'] . ''; + + 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( @@ -117,12 +142,14 @@ $template->assign_vars(array( 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], "", $newest_user, ''), 'LEGEND' => $legend, + 'BIRTHDAY_LIST' => ($birthday_list) ? $birthday_list : $user->lang['NO_BIRTHDAYS'], 'FORUM_IMG' => $user->img('forum', 'NO_NEW_POSTS'), 'FORUM_NEW_IMG' => $user->img('forum_new', 'NEW_POSTS'), 'FORUM_LOCKED_IMG' => $user->img('forum_locked', 'NO_NEW_POSTS_LOCKED'), - 'S_LOGIN_ACTION' => "ucp.php?$SID&mode=login", + 'S_LOGIN_ACTION' => "ucp.php?$SID&mode=login", + 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, 'U_MARK_READ' => "index.$phpEx$SID&mark=forums") ); diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php index e17ed7bfcd..1099dad145 100644 --- a/phpBB/language/en/lang_admin.php +++ b/phpBB/language/en/lang_admin.php @@ -492,6 +492,7 @@ $lang = array_merge($lang, array( 'VIEW_ONLINE_TIME_EXPLAIN' => 'How long before users drop out of the viewonline listings, lower equals less processing.', 'YES_ONLINE' => 'Enable online user listings', 'YES_ONLINE_EXPLAIN' => 'Display online user information on index, forum and topic pages.', + 'YES_BIRTHDAYS' => 'Enable birthday listing', 'YES_MODERATORS' => 'Enable display of Moderators', 'YES_SEARCH' => 'Enable search facilities', 'YES_SEARCH_EXPLAIN' => 'User and backend search functions including fulltext updates when posting.', @@ -528,11 +529,12 @@ $lang = array_merge($lang, array( 'SITE_DESC' => 'Site description', 'BOARD_DISABLE' => 'Disable board', 'BOARD_DISABLE_EXPLAIN' => 'This will make the board unavailable to users. You can also enter a short (255 character) message to display if you wish.', - 'ACC_ACTIVATION' => 'Enable account activation', + 'ACC_ACTIVATION' => 'Account activation', 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations.', 'ACC_NONE' => 'None', 'ACC_USER' => 'User', 'ACC_ADMIN' => 'Admin', + 'ACC_USER_ADMIN' => 'User + Admin', 'ACC_DISABLE' => 'Disable', 'VISUAL_CONFIRM' => 'Enable visual confirmation', 'VISUAL_CONFIRM_EXPLAIN' => 'Requires new users enter a random code matching an image to help prevent mass registrations.', diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 8da73ae502..1f63eb7424 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -297,17 +297,22 @@ $lang = array( 'LOGIN_FORUM' => 'To view or post in this forum you must enter a password.', 'WRONG_PASSWORD'=> 'You entered an incorrect password.', + 'INDEX' => 'Index page', 'REDIRECTS' => 'Total redirects', 'WHO_IS_ONLINE' => 'Who is Online', + 'BIRTHDAYS' => 'Birthdays', 'SEARCH_NEW' => 'View posts since last visit', 'SEARCH_SELF' => 'View your posts', 'SEARCH_UNANSWERED' => 'View unanswered posts', - + 'MARK_FORUMS_READ' => 'Mark all forums read', 'FORUMS_MARKED' => 'All forums have been marked read', + 'CONGRATULATIONS' => 'Congratulations to', + 'NO_BIRTHDAYS' => 'No birthdays today', + 'RECORD_ONLINE_USERS' => 'Most users ever online was %1$s on %2$s', 'ONLINE_USERS_ZERO_TOTAL' => 'In total there are 0 users online :: ', 'ONLINE_USERS_TOTAL' => 'In total there are %d users online :: ', @@ -659,7 +664,8 @@ $lang = array( 'UCP_PROFILE' => 'Profile', - 'UCP_REG_DETAILS' => 'Registration details', + 'UCP_REG_DETAILS' => 'Registration details', + 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your email address.', 'UCP_PROFILE_INFO' => 'Your Profile', 'PROFILE_INFO_NOTICE' => 'Please note that this information will be viewable to other members. Be careful when including any personal details. Any fields marked with a * must be completed.', @@ -817,6 +823,7 @@ $lang = array( 'ACCOUNT_ADDED' => 'Thank you for registering, your account has been created. You may now login with your username and password', 'ACCOUNT_INACTIVE' => 'Your account has been created. However, this forum requires account activation, an activation key has been sent to the email address you provided. Please check your email for further information', 'ACCOUNT_INACTIVE_ADMIN'=> 'Your account has been created. However, this forum requires account activation by the administrator. An email has been sent to them and you will be informed when your account has been activated', + 'ACCOUNT_INACTIVE_SELF_ADMIN'=> 'Your account has been created. However, this forum requires account activation by both yourself and the administrator. An activation key has been sent to the email address you provided. Please follow the directions in that message. Once activated an administrator will need to approve your account. You will be notified when this occcurs.', 'ACCOUNT_COPPA' => 'Your account has been created but has to be approved, please check your email for details.', 'Wrong_activation' => 'The activation key you supplied does not match any in the database', diff --git a/phpBB/templates/subSilver/index_body.html b/phpBB/templates/subSilver/index_body.html index cd5ba8b757..45ae012404 100644 --- a/phpBB/templates/subSilver/index_body.html +++ b/phpBB/templates/subSilver/index_body.html @@ -63,9 +63,9 @@ +
- @@ -82,6 +82,20 @@
{L_WHO_IS_ONLINE}
+ +
+ + + + + + + + + +
{L_BIRTHDAYS}
{L_WHO_IS_ONLINE}{L_CONGRATULATIONS}: {BIRTHDAY_LIST}
+ +