|
From: Paul S. O. <ps...@us...> - 2002-02-11 02:16:30
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv7762
Modified Files:
viewforum.php viewtopic.php
Log Message:
Add a login redirect for users not logged in who attempt to visit restricted forums ... also shows a forum/post doesn't exist for hidden forums/topics/posts if user is logged in but not authed to view them
Index: viewforum.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewforum.php,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -r1.126 -r1.127
*** viewforum.php 8 Feb 2002 01:30:59 -0000 1.126
--- viewforum.php 11 Feb 2002 02:16:27 -0000 1.127
***************
*** 78,86 ****
// the user.
//
! if( !$total_rows = $db->sql_numrows($result) )
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
- $forum_row = $db->sql_fetchrow($result);
//
--- 78,85 ----
// the user.
//
! if( !($forum_row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
//
***************
*** 101,108 ****
if( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
{
//
// The user is not authed to read this forum ...
//
! $message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
--- 100,112 ----
if( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
{
+ if ( !$userdata['session_logged_in'] )
+ {
+ $redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : "" );
+ header("Location: " . append_sid("posting.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
+ }
//
// The user is not authed to read this forum ...
//
! $message = ( !$is_auth['auth_view'] ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
Index: viewtopic.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewtopic.php,v
retrieving revision 1.173
retrieving revision 1.174
diff -C2 -r1.173 -r1.174
*** viewtopic.php 8 Feb 2002 21:02:54 -0000 1.173
--- viewtopic.php 11 Feb 2002 02:16:28 -0000 1.174
***************
*** 161,174 ****
AND f.forum_id = t.forum_id
$order_sql";
! if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}
! if( !$total_rows = $db->sql_numrows($result) )
{
! message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', "", __LINE__, __FILE__, $sql);
}
- $forum_row = $db->sql_fetchrow($result);
$forum_id = $forum_row['forum_id'];
--- 161,173 ----
AND f.forum_id = t.forum_id
$order_sql";
! if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}
! if( !($forum_row = $db->sql_fetchrow($result)) )
{
! message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_id = $forum_row['forum_id'];
***************
*** 183,196 ****
//
- $forum_name = $forum_row['forum_name'];
- $topic_title = $forum_row['topic_title'];
- $topic_id = $forum_row['topic_id'];
- $topic_time = $forum_row['topic_time'];
-
- if(!empty($post_id))
- {
- $start = floor(($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
- }
-
//
// Start auth check
--- 182,185 ----
***************
*** 201,208 ****
if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
! //
! // The user is not authed to read this forum ...
! //
! $message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
--- 190,201 ----
if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
! if ( !$userdata['session_logged_in'] )
! {
! $redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
! $redirect .= ( isset($start) ) ? "&start=$start" : "";
! header("Location: " . append_sid("posting.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
! }
!
! $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
***************
*** 211,214 ****
--- 204,217 ----
// End auth check
//
+
+ $forum_name = $forum_row['forum_name'];
+ $topic_title = $forum_row['topic_title'];
+ $topic_id = $forum_row['topic_id'];
+ $topic_time = $forum_row['topic_time'];
+
+ if ( !empty($post_id) )
+ {
+ $start = floor(($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
+ }
//
|