Still seems to be pagination problem, I dont have it so what havent I committed ...

git-svn-id: file:///svn/phpbb/trunk@728 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-07-22 20:32:05 +00:00
parent 287feac024
commit d145bca394
2 changed files with 36 additions and 26 deletions

View file

@ -471,9 +471,12 @@ function validate_username($username)
// a UNION clause which would be very nice here :( // a UNION clause which would be very nice here :(
// So we have to use two queries // So we have to use two queries
case 'mysql': case 'mysql':
$sql_users = "SELECT username $sql_users = "SELECT u.username, g.group_name
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE LOWER(username) = '" . strtolower($username) . "'"; WHERE ug.user_id = u.user_id
AND g.group_id = ug.group_id
AND ( LOWER(u.username) = '" . strtolower($username) . "'
OR LOWER(g.group_name) = '" . strtolower($username) . "' )";
$sql_disallow = "SELECT disallow_username $sql_disallow = "SELECT disallow_username
FROM " . DISALLOW_TABLE . " FROM " . DISALLOW_TABLE . "
WHERE disallow_username = '$username'"; WHERE disallow_username = '$username'";
@ -494,13 +497,16 @@ function validate_username($username)
break; break;
default: default:
$sql = "SELECT disallow_username $sql = "SELECT u.username, g.group_name
FROM " . DISALLOW_TABLE . " FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE disallow_username = '$username' WHERE ug.user_id = u.user_id
UNION AND g.group_id = ug.group_id
SELECT username AND ( LOWER(u.username) = '" . strtolower($username) . "'
FROM " . USERS_TABLE . " OR LOWER(g.group_name) = '" . strtolower($username) . "' )
WHERE LOWER(username) = '" . strtolower($username) . "'"; UNION
SELECT disallow_username, NULL
FROM " . DISALLOW_TABLE . "
WHERE disallow_username = '$username'";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {
if($db->sql_numrows($result) > 0) if($db->sql_numrows($result) > 0)

View file

@ -25,9 +25,6 @@ include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$page_title = $lang['View_topic'] ." - $topic_title";
$pagetype = "viewtopic";
// //
// Start initial var setup // Start initial var setup
// //
@ -122,18 +119,19 @@ if(!$total_rows = $db->sql_numrows($result))
{ {
message_die(GENERAL_MESSAGE, $lang['Topic_post_not_exist'], "", __LINE__, __FILE__, $sql); message_die(GENERAL_MESSAGE, $lang['Topic_post_not_exist'], "", __LINE__, __FILE__, $sql);
} }
$forum_row = $db->sql_fetchrowset($result); $forum_row = $db->sql_fetchrow($result);
$forum_name = stripslashes($forum_row[0]['forum_name']); $forum_name = stripslashes($forum_row['forum_name']);
$forum_id = $forum_row[0]['forum_id']; $forum_id = $forum_row['forum_id'];
$topic_id = $forum_row[0]['topic_id'];
$total_replies = $forum_row[0]['topic_replies'] + 1; $topic_title = stripslashes($forum_row['topic_title']);
$topic_title = stripslashes($forum_row[0]['topic_title']); $topic_id = $forum_row['topic_id'];
$topic_time = $forum_row[0]['topic_time']; $topic_time = $forum_row['topic_time'];
$total_replies = $forum_row['topic_replies'] + 1;
if(!empty($post_id)) if(!empty($post_id))
{ {
$start = floor(($forum_row[0]['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page']; $start = floor(($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
} }
// //
@ -148,7 +146,7 @@ init_userprefs($userdata);
// //
// Start auth check // Start auth check
// //
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row[0]); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
if(!$is_auth['auth_view'] || !$is_auth['auth_read']) if(!$is_auth['auth_view'] || !$is_auth['auth_read'])
{ {
@ -194,8 +192,14 @@ $postrow = $db->sql_fetchrowset($result);
$ranksrow = $db->sql_fetchrowset($ranksresult); $ranksrow = $db->sql_fetchrowset($ranksresult);
// //
// Dump out the page header and oad viewtopic body template // Dump out the page header and load viewtopic body template
// //
// This is wrong ... more like index is needed
//if($topic_time > $userdata['session_last_visit'])
//{
// setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), 0, $cookiepath, $cookiedomain, $cookiesecure);
//}
$page_title = $lang['View_topic'] ." - $topic_title";
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
@ -244,7 +248,7 @@ $template->assign_vars(array(
"L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'], "L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'],
"IMG_POST" => $images['topic_new'], "IMG_POST" => $images['topic_new'],
"IMG_REPLY" => ( ($forum_row[0]['topic_status'] == TOPIC_LOCKED) ? $images['topic_locked'] : $images['topic_reply'] ), "IMG_REPLY" => ( ($forum_row['topic_status'] == TOPIC_LOCKED) ? $images['topic_locked'] : $images['topic_reply'] ),
"U_VIEW_FORUM" => $view_forum_url, "U_VIEW_FORUM" => $view_forum_url,
"U_VIEW_OLDER_TOPIC" => $view_prev_topic_url, "U_VIEW_OLDER_TOPIC" => $view_prev_topic_url,
@ -339,7 +343,7 @@ for($i = 0; $i < $total_posts; $i++)
$email_img = ($postrow[$i]['user_viewemail'] == 1) ? "<a href=\"mailto:" . $postrow[$i]['user_email'] . "\"><img src=\"" . $images['icon_email'] . "\" alt=\"" . $lang['Send_email'] . " $poster\" border=\"0\"></a>" : ""; $email_img = ($postrow[$i]['user_viewemail'] == 1) ? "<a href=\"mailto:" . $postrow[$i]['user_email'] . "\"><img src=\"" . $images['icon_email'] . "\" alt=\"" . $lang['Send_email'] . " $poster\" border=\"0\"></a>" : "";
$www_img = ($postrow[$i]['user_website']) ? "<a href=\"" . $postrow[$i]['user_website'] . "\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\"></a>" : ""; $www_img = ($postrow[$i]['user_website']) ? "<a href=\"" . $postrow[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\"></a>" : "";
if($postrow[$i]['user_icq']) if($postrow[$i]['user_icq'])
{ {
@ -486,7 +490,7 @@ if( $is_auth['auth_mod'] )
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move&quick_op=1"). "\"><img src=\"images/topic_move.gif\" alt = \"" . $lang['Move_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;"; $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move&quick_op=1"). "\"><img src=\"images/topic_move.gif\" alt = \"" . $lang['Move_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;";
if($forum_row[0]['topic_status'] == TOPIC_UNLOCKED) if($forum_row['topic_status'] == TOPIC_UNLOCKED)
{ {
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock&quick_op=1") . "\"><img src=\"images/topic_lock.gif\" alt = \"" . $lang['Lock_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;"; $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock&quick_op=1") . "\"><img src=\"images/topic_lock.gif\" alt = \"" . $lang['Lock_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;";
} }