mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
- ucp register/remind/activate fixes mostly regarding account activation
- general ucp fixing (profile and ucp_main) - created three new functions (return correct topic author string, generate topic related pagination and get topic type/status...). These general bits are used on several pages (subscribed topics, bookmarks, viewforum). - config basic schema fix - commented out inline fix for unread topic tracking in viewforum, instead tried another method (hopefully working as well) git-svn-id: file:///svn/phpbb/trunk@5001 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -340,6 +340,143 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
return $active_forum_ary;
|
||||
}
|
||||
|
||||
function topic_topic_author(&$topic_row)
|
||||
{
|
||||
global $phpEx, $SID, $phpbb_root_path, $user;
|
||||
|
||||
$topic_author = ($topic_row['topic_poster'] != ANONYMOUS) ? "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $topic_row['topic_poster'] . '">' : '';
|
||||
$topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? $topic_row['topic_first_poster_name'] : (($topic_row['topic_first_poster_name'] != '') ? $topic_row['topic_first_poster_name'] : $user->lang['GUEST']);
|
||||
$topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? '</a>' : '';
|
||||
|
||||
return $topic_author;
|
||||
}
|
||||
|
||||
function topic_generate_pagination($replies, $url)
|
||||
{
|
||||
global $config, $user;
|
||||
|
||||
if (($replies + 1) > $config['posts_per_page'])
|
||||
{
|
||||
$total_pages = ceil(($replies + 1) / $config['posts_per_page']);
|
||||
$pagination = '';
|
||||
|
||||
$times = 1;
|
||||
for ($j = 0; $j < $replies + 1; $j += $config['posts_per_page'])
|
||||
{
|
||||
$pagination .= "<a href=\"$url&start=$j\">$times</a>";
|
||||
if ($times == 1 && $total_pages > 4)
|
||||
{
|
||||
$pagination .= ' ... ';
|
||||
$times = $total_pages - 3;
|
||||
$j += ($total_pages - 4) * $config['posts_per_page'];
|
||||
}
|
||||
else if ($times < $total_pages)
|
||||
{
|
||||
$pagination .= $user->theme['primary']['pagination_sep'];
|
||||
}
|
||||
$times++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagination = '';
|
||||
}
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum, &$folder_img, &$folder_alt, &$topic_type)
|
||||
{
|
||||
global $user, $config;
|
||||
|
||||
$folder = $folder_new = '';
|
||||
$unread_topic = false;
|
||||
|
||||
if ($topic_row['topic_status'] == ITEM_MOVED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_MOVED'];
|
||||
$folder_img = 'folder_moved';
|
||||
$folder_alt = 'VIEW_TOPIC_MOVED';
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($topic_row['topic_type'])
|
||||
{
|
||||
case POST_GLOBAL:
|
||||
case POST_ANNOUNCE:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
|
||||
$folder = 'folder_announce';
|
||||
$folder_new = 'folder_announce_new';
|
||||
break;
|
||||
|
||||
case POST_STICKY:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
|
||||
$folder = 'folder_sticky';
|
||||
$folder_new = 'folder_sticky_new';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($replies >= $config['hot_threshold'])
|
||||
{
|
||||
$folder = 'folder_hot';
|
||||
$folder_new = 'folder_hot_new';
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = 'folder';
|
||||
$folder_new = 'folder_new';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($topic_row['topic_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
|
||||
$folder = 'folder_locked';
|
||||
$folder_new = 'folder_locked_new';
|
||||
}
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$unread_topic = $new_votes = true;
|
||||
|
||||
if ($mark_time_topic >= $topic_row['topic_last_post_time'] || $mark_time_forum >= $topic_row['topic_last_post_time']) //|| ($topic_row['topic_last_post_time'] == $topic_row['poll_last_vote'] && $replies))
|
||||
{
|
||||
$unread_topic = false;
|
||||
}
|
||||
/*
|
||||
if ($topic_row['poll_start'] && ($mark_time_topic >= $topic_row['poll_last_vote'] || $mark_time_forum >= $topic_row['poll_last_vote']))
|
||||
{
|
||||
$new_votes = false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$unread_topic = false;
|
||||
//$unread_topic = $new_votes = false;
|
||||
}
|
||||
|
||||
// $folder_new .= ($new_votes) ? '_vote' : '';
|
||||
|
||||
$folder_img = ($unread_topic) ? $folder_new : $folder;
|
||||
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
|
||||
|
||||
// Posted image?
|
||||
if (!empty($topic_row['mark_type']))
|
||||
{
|
||||
$folder_img .= '_posted';
|
||||
}
|
||||
}
|
||||
|
||||
if ($topic_row['poll_start'])
|
||||
{
|
||||
$topic_type .= $user->lang['VIEW_TOPIC_POLL'];
|
||||
}
|
||||
|
||||
return $unread_topic;
|
||||
}
|
||||
|
||||
// Display Attachments
|
||||
function display_attachments($forum_id, $blockname, &$attachment_data, &$update_count, $force_physical = false, $return = false)
|
||||
{
|
||||
|
@@ -42,23 +42,34 @@ class ucp_activate extends module
|
||||
trigger_error($user->lang['WRONG_ACTIVATION']);
|
||||
}
|
||||
|
||||
$sql_update_pass = ($row['user_newpasswd']) ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';
|
||||
$update_password = ($row['user_newpasswd']) ? true : false;
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_type = ' . USER_NORMAL . ", user_actkey = '$sql_update_pass'
|
||||
WHERE user_id = {$row['user_id']}";
|
||||
$sql_ary = array(
|
||||
'user_type' => USER_NORMAL,
|
||||
'user_actkey' => ''
|
||||
);
|
||||
|
||||
if ($update_password)
|
||||
{
|
||||
$sql_ary += array(
|
||||
'user_password' => $row['user_newpasswd'],
|
||||
'user_newpasswd' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $row['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass)
|
||||
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
|
||||
|
||||
$messenger = new messenger();
|
||||
|
||||
$messenger->template('admin_welcome_activated', $row['user_lang']);
|
||||
$messenger->subject($subject);
|
||||
|
||||
$messenger->replyto($user->data['board_contact']);
|
||||
$messenger->replyto($config['board_contact']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
|
||||
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
||||
@@ -69,7 +80,7 @@ class ucp_activate extends module
|
||||
$messenger->assign_vars(array(
|
||||
'SITENAME' => $config['sitename'],
|
||||
'USERNAME' => $row['username'],
|
||||
'PASSWORD' => $password_confirm,
|
||||
|
||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))
|
||||
);
|
||||
|
||||
@@ -80,10 +91,10 @@ class ucp_activate extends module
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = (!$sql_update_pass) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED';
|
||||
$message = (!$update_password) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED';
|
||||
}
|
||||
|
||||
if (!$sql_update_pass)
|
||||
if (!$update_password)
|
||||
{
|
||||
set_config('newest_user_id', $row['user_id']);
|
||||
set_config('newest_username', $row['username']);
|
||||
|
@@ -277,7 +277,12 @@ class ucp_main extends module
|
||||
|
||||
case 'subscribed':
|
||||
|
||||
if ($_POST['unwatch'])
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
$user->add_lang('viewforum');
|
||||
|
||||
$unwatch = (isset($_POST['unwatch'])) ? true : false;
|
||||
|
||||
if ($unwatch)
|
||||
{
|
||||
$forums = (isset($_POST['f'])) ? implode(', ', array_map('intval', array_keys($_POST['f']))) : false;
|
||||
$topics = (isset($_POST['t'])) ? implode(', ', array_map('intval', array_keys($_POST['t']))) : false;
|
||||
@@ -305,9 +310,9 @@ class ucp_main extends module
|
||||
$l_unwatch .= '_TOPICS';
|
||||
}
|
||||
|
||||
$message = $user->lang['UNWATCHED' . $l_unwatch] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=watched\">", '</a>');
|
||||
$message = $user->lang['UNWATCHED' . $l_unwatch] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=subscribed\">", '</a>');
|
||||
|
||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=watched");
|
||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=subscribed");
|
||||
trigger_error($message);
|
||||
}
|
||||
}
|
||||
@@ -396,137 +401,102 @@ class ucp_main extends module
|
||||
|
||||
|
||||
// Subscribed Topics
|
||||
$start = request_var('start', 0);
|
||||
|
||||
$sql = 'SELECT COUNT(topic_id) as topics_count
|
||||
FROM ' . TOPICS_WATCH_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$topics_count = (int) $db->sql_fetchfield('topics_count', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($topics_count)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'PAGINATION' => generate_pagination("ucp.$phpEx$SID&i=$id&mode=$mode", $topics_count, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),
|
||||
'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count))
|
||||
);
|
||||
}
|
||||
|
||||
$sql_from = ($config['load_db_lastread'] || $config['load_db_track']) ? '(' . TOPICS_TABLE . ' t LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . '))' : TOPICS_TABLE . ' t';
|
||||
// $sql_f_tracking = ($config['load_db_lastread']) ? 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')' : '';
|
||||
$sql_f_tracking = ($config['load_db_lastread']) ? 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . '), ' : '';
|
||||
|
||||
$sql_t_select = ($config['load_db_lastread'] || $config['load_db_track']) ? ', tt.mark_type, tt.mark_time' : '';
|
||||
// $sql_f_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : '';
|
||||
|
||||
$sql_f_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : '';
|
||||
|
||||
$sql = "SELECT t.* $sql_f_select $sql_t_select
|
||||
FROM $sql_from, " . TOPICS_WATCH_TABLE . ' tw
|
||||
FROM $sql_from $sql_f_tracking " . TOPICS_WATCH_TABLE . ' tw
|
||||
WHERE tw.user_id = ' . $user->data['user_id'] . '
|
||||
AND t.topic_id = tw.topic_id
|
||||
ORDER BY t.topic_last_post_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$forum_id = $row['forum_id'];
|
||||
$topic_id = $row['topic_id'];
|
||||
|
||||
// Goto message generation
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
$forum_id = $row['forum_id'];
|
||||
|
||||
$topic_type = '';
|
||||
switch ($row['topic_type'])
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
case POST_ANNOUNCE:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
|
||||
$folder = 'folder_announce';
|
||||
$folder_new = 'folder_announce_new';
|
||||
break;
|
||||
|
||||
case POST_STICKY:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
|
||||
$folder = 'folder_sticky';
|
||||
$folder_new = 'folder_sticky_new';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($replies >= intval($config['hot_threshold']))
|
||||
{
|
||||
$folder = 'folder_hot';
|
||||
$folder_new = 'folder_hot_new';
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = 'folder';
|
||||
$folder_new = 'folder_new';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['topic_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
|
||||
$folder = 'folder_locked';
|
||||
$folder_new = 'folder_locked_new';
|
||||
}
|
||||
|
||||
$unread_topic = ($user->data['user_id'] != ANONYMOUS) ? true : false;
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$topic_check = (!$config['load_db_lastread']) ? ((isset($tracking_topics[$forum_id][base_convert($topic_id, 10, 36)])) ? base_convert($tracking_topics[$forum_id36][$topic_id36], 36, 10) + $config['board_startdate'] : 0) : $row['mark_time'];
|
||||
$forum_check = (!$config['load_db_lastread']) ? ((isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0) : $row['forum_mark_time'];
|
||||
|
||||
if ($topic_check > $row['topic_last_post_time'] || $forum_check > $row['topic_last_post_time'])
|
||||
{
|
||||
$unread_topic = false;
|
||||
}
|
||||
}
|
||||
|
||||
$newest_post_img = ($unread_topic) ? "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread\">" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
|
||||
$folder_img = ($unread_topic) ? $folder_new : $folder;
|
||||
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
|
||||
|
||||
// Posted image?
|
||||
if (!empty($row['mark_type']))
|
||||
{
|
||||
$folder_img .= '_posted';
|
||||
}
|
||||
|
||||
if (($replies + 1) > $config['posts_per_page'])
|
||||
{
|
||||
$total_pages = ceil(($replies + 1) / $config['posts_per_page']);
|
||||
$goto_page = ' [ ' . $user->img('icon_post', 'GOTO_PAGE') . $user->lang['GOTO_PAGE'] . ': ';
|
||||
|
||||
$times = 1;
|
||||
for($j = 0; $j < $replies + 1; $j += $config['posts_per_page'])
|
||||
{
|
||||
$goto_page .= "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$j\">$times</a>";
|
||||
if ($times == 1 && $total_pages > 4)
|
||||
{
|
||||
$goto_page .= ' ... ';
|
||||
$times = $total_pages - 3;
|
||||
$j += ($total_pages - 4) * $config['posts_per_page'];
|
||||
}
|
||||
else if ($times < $total_pages)
|
||||
{
|
||||
$goto_page .= ', ';
|
||||
}
|
||||
$times++;
|
||||
}
|
||||
$goto_page .= ' ] ';
|
||||
$mark_time_topic = ($user->data['user_id'] != ANONYMOUS) ? $row['mark_time'] : 0;
|
||||
$mark_time_forum = $row['forum_mark_time'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$goto_page = '';
|
||||
$topic_id36 = base_convert($topic_id, 10, 36);
|
||||
$forum_id36 = ($row['topic_type'] == POST_GLOBAL) ? 0 : $forum_id;
|
||||
$mark_time_topic = (isset($tracking_topics[$forum_id36][$topic_id36])) ? base_convert($tracking_topics[$forum_id36][$topic_id36], 36, 10) + $config['board_startdate'] : 0;
|
||||
|
||||
$mark_time_forum = (isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0;
|
||||
}
|
||||
|
||||
// Replies
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
|
||||
if ($row['topic_status'] == ITEM_MOVED)
|
||||
{
|
||||
$topic_id = $row['topic_moved_id'];
|
||||
}
|
||||
|
||||
// Get folder img, topic status/type related informations
|
||||
$folder_img = $folder_alt = $topic_type = '';
|
||||
$unread_topic = topic_status($row, $replies, $mark_time_topic, $mark_time_forum, $folder_img, $folder_alt, $topic_type);
|
||||
|
||||
$newest_post_img = ($unread_topic) ? "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread#unread\">" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
|
||||
|
||||
$view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id";
|
||||
|
||||
$last_post_img = "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
||||
|
||||
$last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>';
|
||||
|
||||
|
||||
// Send vars to template
|
||||
$template->assign_block_vars('topicrow', array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
'TOPIC_ID' => $topic_id,
|
||||
'TOPIC_AUTHOR' => topic_topic_author($row),
|
||||
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
||||
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
||||
'LAST_POST_AUTHOR' => $last_post_author,
|
||||
'GOTO_PAGE' => $goto_page,
|
||||
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
|
||||
'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'],
|
||||
'PAGINATION' => topic_generate_pagination($replies, "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"),
|
||||
'REPLIES' => $replies,
|
||||
'VIEWS' => $row['topic_views'],
|
||||
'TOPIC_TITLE' => censor_text($row['topic_title']),
|
||||
'TOPIC_TYPE' => $topic_type,
|
||||
|
||||
'LAST_POST_IMG' => $last_post_img,
|
||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
||||
'NEWEST_POST_IMG' => $newest_post_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
|
||||
|
||||
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
|
||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
||||
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
|
||||
'S_UNREAD_TOPIC' => $unread_topic,
|
||||
|
||||
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
|
||||
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '',
|
||||
'U_VIEW_TOPIC' => $view_topic_url)
|
||||
);
|
||||
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -542,6 +512,9 @@ class ucp_main extends module
|
||||
break;
|
||||
}
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
$user->add_lang('viewforum');
|
||||
|
||||
$move_up = request_var('move_up', 0);
|
||||
$move_down = request_var('move_down', 0);
|
||||
|
||||
@@ -634,40 +607,12 @@ class ucp_main extends module
|
||||
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
|
||||
$topic_type = '';
|
||||
switch ($row['topic_type'])
|
||||
{
|
||||
case POST_ANNOUNCE:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
|
||||
$folder = 'folder_announce';
|
||||
break;
|
||||
// Get folder img, topic status/type related informations
|
||||
$folder_img = $folder_alt = $topic_type = '';
|
||||
$unread_topic = topic_status($row, $replies, time(), time(), $folder_img, $folder_alt, $topic_type);
|
||||
|
||||
case POST_STICKY:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
|
||||
$folder = 'folder_sticky';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($replies >= intval($config['hot_threshold']))
|
||||
{
|
||||
$folder = 'folder_hot';
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = 'folder';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['topic_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
|
||||
$folder = 'folder_locked';
|
||||
}
|
||||
|
||||
$folder_alt = ($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'TOPIC';
|
||||
$view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id";
|
||||
$last_post_img = "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
||||
// $last_post_img = "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
||||
|
||||
$template->assign_block_vars('topicrow', array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
@@ -676,13 +621,24 @@ class ucp_main extends module
|
||||
'TOPIC_TITLE' => censor_text($row['topic_title']),
|
||||
'TOPIC_TYPE' => $topic_type,
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
|
||||
'TOPIC_AUTHOR' => topic_topic_author($row),
|
||||
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
||||
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
||||
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
|
||||
'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'],
|
||||
'PAGINATION' => topic_generate_pagination($replies, "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"),
|
||||
|
||||
'POSTED_AT' => $user->format_date($row['topic_time']),
|
||||
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
|
||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
||||
|
||||
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
|
||||
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '',
|
||||
'U_VIEW_TOPIC' => $view_topic_url,
|
||||
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f={$row['forum_id']}",
|
||||
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=$forum_id}",
|
||||
'U_MOVE_UP' => ($row['order_id'] != 1) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_up={$row['order_id']}" : '',
|
||||
'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_down={$row['order_id']}" : '')
|
||||
);
|
||||
|
@@ -21,7 +21,7 @@ class ucp_prefs extends module
|
||||
$error = $data = array();
|
||||
$s_hidden_fields = '';
|
||||
|
||||
switch($mode)
|
||||
switch ($mode)
|
||||
{
|
||||
case 'personal':
|
||||
|
||||
@@ -40,10 +40,9 @@ class ucp_prefs extends module
|
||||
'notifypm' => true,
|
||||
'popuppm' => false,
|
||||
'allowpm' => true,
|
||||
'report_pm_notify' => false
|
||||
);
|
||||
|
||||
$var_ary['report_pm_notify'] = false;
|
||||
|
||||
foreach ($var_ary as $var => $default)
|
||||
{
|
||||
$data[$var] = request_var($var, $default);
|
||||
@@ -89,6 +88,9 @@ class ucp_prefs extends module
|
||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
$viewemail = (isset($viewemail)) ? $viewemail : $user->data['user_allow_viewemail'];
|
||||
@@ -214,6 +216,9 @@ class ucp_prefs extends module
|
||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
$sk = (isset($sk)) ? $sk : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
|
||||
@@ -310,6 +315,9 @@ class ucp_prefs extends module
|
||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
$bbcode = (isset($bbcode)) ? $bbcode : $user->optionget('bbcode');
|
||||
|
@@ -23,6 +23,7 @@ class ucp_profile extends module
|
||||
$submit = (!empty($_POST['submit'])) ? true : false;
|
||||
$delete = (!empty($_POST['delete'])) ? true : false;
|
||||
$error = $data = array();
|
||||
$s_hidden_fields = '';
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
@@ -47,13 +48,13 @@ class ucp_profile extends module
|
||||
$var_ary = array(
|
||||
'username' => array(
|
||||
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
||||
array('username', $username)),
|
||||
array('username', $data['username'])),
|
||||
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||
'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||
'cur_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||
'email' => array(
|
||||
array('string', false, 6, 60),
|
||||
array('email', $email)),
|
||||
array('email', $data['email'])),
|
||||
'email_confirm' => array('string', true, 6, 60),
|
||||
);
|
||||
|
||||
@@ -99,10 +100,10 @@ class ucp_profile extends module
|
||||
|
||||
$messenger = new messenger();
|
||||
|
||||
$messenger->template($email_template, $lang);
|
||||
$messenger->subject($subject);
|
||||
$template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate';
|
||||
$messenger->template($template_file, $user->data['user_lang']);
|
||||
|
||||
$messenger->replyto($user->data['board_contact']);
|
||||
$messenger->replyto($config['board_contact']);
|
||||
$messenger->to($email, $username);
|
||||
|
||||
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
||||
@@ -112,12 +113,10 @@ class ucp_profile extends module
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'SITENAME' => $config['sitename'],
|
||||
'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']),
|
||||
'USERNAME' => $username,
|
||||
'PASSWORD' => $password_confirm,
|
||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
||||
|
||||
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&k=$user_actkey")
|
||||
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
||||
);
|
||||
|
||||
$messenger->send(NOTIFY_EMAIL);
|
||||
@@ -127,23 +126,23 @@ class ucp_profile extends module
|
||||
// Grab an array of user_id's with a_user permissions
|
||||
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
||||
|
||||
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type
|
||||
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) .')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$messenger->use_template('admin_activate', $row['user_lang']);
|
||||
$messenger->template('admin_activate', $row['user_lang']);
|
||||
$messenger->replyto($config['board_contact']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => $row['username'],
|
||||
'USERNAME' => $username,
|
||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
||||
|
||||
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&k=$user_actkey")
|
||||
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
||||
);
|
||||
|
||||
$messenger->send($row['user_notify_type']);
|
||||
@@ -174,6 +173,9 @@ class ucp_profile extends module
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
|
||||
@@ -304,6 +306,9 @@ class ucp_profile extends module
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
if (!isset($bday_day))
|
||||
@@ -364,8 +369,6 @@ class ucp_profile extends module
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
|
||||
|
||||
$s_hidden_fields = '';
|
||||
|
||||
$var_ary = array(
|
||||
'enable_html' => (bool) $config['allow_html'],
|
||||
'enable_bbcode' => (bool) $config['allow_bbcode'],
|
||||
@@ -394,7 +397,7 @@ class ucp_profile extends module
|
||||
|
||||
if (strlen($signature) > $config['max_sig_chars'])
|
||||
{
|
||||
$error[] = $user->lang['SIGNATURE_TOO_LONG'];
|
||||
$error[] = 'SIGNATURE_TOO_LONG';
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
@@ -426,6 +429,9 @@ class ucp_profile extends module
|
||||
trigger_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
$signature_preview = '';
|
||||
@@ -468,7 +474,6 @@ class ucp_profile extends module
|
||||
$category = request_var('category', '');
|
||||
$delete = (isset($_POST['delete'])) ? true : false;
|
||||
$avatarselect = request_var('avatarselect', '');
|
||||
$s_hidden_fields = '';
|
||||
|
||||
// Can we upload?
|
||||
$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
@@ -553,7 +558,7 @@ class ucp_profile extends module
|
||||
unset($data);
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$lang['\\1'])) ? \$lang['\\1'] : '\\1'", $error);
|
||||
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
||||
}
|
||||
|
||||
// Generate users avatar
|
||||
|
@@ -154,6 +154,19 @@ class ucp_register extends module
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($new_password != $password_confirm)
|
||||
{
|
||||
$error[] = 'NEW_PASSWORD_ERROR';
|
||||
}
|
||||
|
||||
if ($email != $email_confirm)
|
||||
{
|
||||
$error[] = 'NEW_EMAIL_ERROR';
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$server_url = generate_board_url();
|
||||
@@ -262,7 +275,6 @@ class ucp_register extends module
|
||||
$messenger = new messenger();
|
||||
|
||||
$messenger->template($email_template, $lang);
|
||||
$messenger->subject($subject);
|
||||
|
||||
$messenger->replyto($config['board_contact']);
|
||||
$messenger->to($email, $username);
|
||||
@@ -300,7 +312,7 @@ class ucp_register extends module
|
||||
// can activate a user
|
||||
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
||||
|
||||
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type
|
||||
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) .')';
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -313,7 +325,7 @@ class ucp_register extends module
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => $row['username'],
|
||||
'USERNAME' => $username,
|
||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
||||
|
||||
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
|
||||
|
@@ -28,20 +28,17 @@ class ucp_remind extends module
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_email = '" . $db->sql_escape($email) . "'
|
||||
AND username = '" . $db->sql_escape($username) . "'";
|
||||
if (!($result = $db->sql_query($sql)))
|
||||
{
|
||||
trigger_error($user->lang['NO_USER']);
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
trigger_error($lang['NO_EMAIL']);
|
||||
trigger_error('NO_EMAIL_USER');
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['user_type'] == USER_INACTIVE)
|
||||
{
|
||||
trigger_error($lang['ACCOUNT_INACTIVE']);
|
||||
trigger_error('ACCOUNT_NOT_ACTIVATED');
|
||||
}
|
||||
|
||||
$server_url = generate_board_url();
|
||||
@@ -49,7 +46,7 @@ class ucp_remind extends module
|
||||
$user_id = $row['user_id'];
|
||||
|
||||
$key_len = 54 - strlen($server_url);
|
||||
$key_len = ($str_len > 6) ? $key_len : 6;
|
||||
$key_len = ($key_len > 6) ? $key_len : 6;
|
||||
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
|
||||
$user_password = gen_rand_string(8);
|
||||
|
||||
@@ -63,7 +60,6 @@ class ucp_remind extends module
|
||||
$messenger = new messenger();
|
||||
|
||||
$messenger->template('user_activate_passwd', $row['user_lang']);
|
||||
$messenger->subject($subject);
|
||||
|
||||
$messenger->replyto($user->data['user_email']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
|
@@ -18,6 +18,7 @@ class ucp_zebra extends module
|
||||
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||
|
||||
$submit = (!empty($_POST['submit']) || !empty($_GET['add'])) ? true : false;
|
||||
$s_hidden_fields = '';
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
@@ -174,7 +175,7 @@ class ucp_zebra extends module
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
|
||||
'L_TITLE' => $user->lang['UCP_ZEBRA_' . strtoupper($mode)],
|
||||
|
||||
'U_SEARCH_USER' => "memberlist.$phpEx$SID&mode=searchuser&form=ucp&field=add",
|
||||
|
||||
|
Reference in New Issue
Block a user