From 828d3b6b68acad606fe150cff7993c216ebc4474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Sun, 21 Apr 2013 14:22:45 +0200 Subject: [PATCH 1/2] [ticket/11144] Add missing {FORUM_NAME} variable The template variable {FORUM_NAME} was missing from the login page of a password protected forum PHPBB3-11144 --- phpBB/docs/coding-guidelines.html | 2 + phpBB/download/file.php | 2 +- phpBB/includes/functions.php | 1 + phpBB/includes/ucp/ucp_pm_compose.php | 11 ++--- phpBB/posting.php | 1 + .../prosilver/template/login_forum.html | 43 +++++++++++-------- .../subsilver2/template/login_forum.html | 8 ++++ 7 files changed, 41 insertions(+), 27 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index cd113a7226..38f11534d2 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -956,6 +956,8 @@ $action_ary = request_var('action', array('' => 0));

Login checks/redirection:

To show a forum login box use login_forum_box($forum_data), else use the login_box() function.

+

$forum_data should contain at least the forum_id and forum_password fields. If the field forum_name is available, then it is displayed on the forum login page.

+

The login_box() function can have a redirect as the first parameter. As a thumb of rule, specify an empty string if you want to redirect to the users current location, else do not add the $SID to the redirect string (for example within the ucp/login we redirect to the board index because else the user would be redirected to the login screen).

Sensitive Operations:

diff --git a/phpBB/download/file.php b/phpBB/download/file.php index bf277c69fa..3ceb1ee0cc 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -170,7 +170,7 @@ else if (!$attachment['in_message']) { // - $sql = 'SELECT p.forum_id, f.forum_password, f.parent_id + $sql = 'SELECT p.forum_id, f.forum_name, f.forum_password, f.parent_id FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f WHERE p.post_id = ' . $attachment['post_msg_id'] . ' AND p.forum_id = f.forum_id'; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ccd2d3147c..98a1dab722 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3272,6 +3272,7 @@ function login_forum_box($forum_data) page_header($user->lang['LOGIN'], false); $template->assign_vars(array( + 'FORUM_NAME' => isset($forum_data['forum_name']) ? $forum_data['forum_name'] : '', 'S_LOGIN_ACTION' => build_url(array('f')), 'S_HIDDEN_FIELDS' => build_hidden_fields(array('f' => $forum_data['forum_id']))) ); diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 8e82188aff..d7509a1072 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -271,19 +271,16 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Passworded forum? if ($post['forum_id']) { - $sql = 'SELECT forum_password + $sql = 'SELECT forum_id, forum_name, forum_password FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $post['forum_id']; $result = $db->sql_query($sql); - $forum_password = (string) $db->sql_fetchfield('forum_password'); + $forum_data = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if ($forum_password) + if (!empty($forum_data['forum_password'])) { - login_forum_box(array( - 'forum_id' => $post['forum_id'], - 'forum_password' => $forum_password, - )); + login_forum_box($forum_data); } } } diff --git a/phpBB/posting.php b/phpBB/posting.php index e57f5420f5..b351f67218 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -196,6 +196,7 @@ if ($post_data['forum_password']) { login_forum_box(array( 'forum_id' => $forum_id, + 'forum_name' => $post_data['forum_name'], 'forum_password' => $post_data['forum_password']) ); } diff --git a/phpBB/styles/prosilver/template/login_forum.html b/phpBB/styles/prosilver/template/login_forum.html index a342a9aa24..81a83b6340 100644 --- a/phpBB/styles/prosilver/template/login_forum.html +++ b/phpBB/styles/prosilver/template/login_forum.html @@ -1,31 +1,36 @@ -

{L_LOGIN} {FORUM_NAME}

+

{FORUM_NAME}

{S_FORM_TOKEN}
-

{L_LOGIN_FORUM}

+
+

{L_LOGIN}

-
- -
-
 
-
{LOGIN_ERROR}
-
- -
-
-
-
-
-
 
-
{S_HIDDEN_FIELDS}
-
- {S_LOGIN_REDIRECT} -
+

{L_LOGIN_FORUM}

+ +
+ +
+
 
+
{LOGIN_ERROR}
+
+ + +
+
+
+
+ {S_LOGIN_REDIRECT} +
+
 
+
{S_HIDDEN_FIELDS}
+
+
+
diff --git a/phpBB/styles/subsilver2/template/login_forum.html b/phpBB/styles/subsilver2/template/login_forum.html index 96b025a2f9..e91a406611 100644 --- a/phpBB/styles/subsilver2/template/login_forum.html +++ b/phpBB/styles/subsilver2/template/login_forum.html @@ -1,5 +1,13 @@ + + + +

+ +
From eefcdfa54a80e4f62c88b6758b2e1d22740d1ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Mon, 6 May 2013 21:50:45 +0200 Subject: [PATCH 2/2] [ticket/11144] Add missing {FORUM_NAME} variable Replace spaces with tabs PHPBB3-11144 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index b351f67218..42c4f7bc55 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -196,7 +196,7 @@ if ($post_data['forum_password']) { login_forum_box(array( 'forum_id' => $forum_id, - 'forum_name' => $post_data['forum_name'], + 'forum_name' => $post_data['forum_name'], 'forum_password' => $post_data['forum_password']) ); }