From cbb50049a575a64e481f94e0a51280507d3d19ba Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 28 Dec 2006 17:28:28 +0000 Subject: [PATCH] - add return links to approve details [#6252] - lets decide on input field or textarea based on the entry length in language pack management [#6280] git-svn-id: file:///svn/phpbb/trunk@6819 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_language.html | 6 +- phpBB/includes/acp/acp_language.php | 147 ++++++------------ phpBB/includes/mcp/mcp_queue.php | 9 +- phpBB/includes/utf/utf_tools.php | 8 + phpBB/language/en/mcp.php | 1 + phpBB/styles/subSilver/template/mcp_post.html | 2 +- 6 files changed, 67 insertions(+), 106 deletions(-) diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index d7a4a31901..37b1e032f2 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -72,7 +72,7 @@

{L_MISSING_LANG_VARIABLES}

{L_MISSING_VARS_EXPLAIN}

- +
@@ -104,14 +104,14 @@

{L_LANGUAGE_ENTRIES_EXPLAIN}

- +
- +
 
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index abd01b6263..94a79fa2d3 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -622,16 +622,15 @@ class acp_language if (!$is_email_file) { - $method = ($is_help_file) ? 'print_help_entries' : 'print_language_entries'; $tpl = ''; $name = (($this->language_directory) ? $this->language_directory . '/' : '') . $this->language_file; if (isset($missing_vars[$name]) && sizeof($missing_vars[$name])) { - $tpl .= $this->$method($missing_vars[$name], '* '); + $tpl .= $this->print_language_entries($missing_vars[$name], '* '); } - $tpl .= $this->$method($lang); + $tpl .= $this->print_language_entries($lang); $template->assign_var('TPL', $tpl); unset($tpl); @@ -950,7 +949,7 @@ class acp_language * {FILENAME} [{LANG_NAME}] * * @package language -* @copyright (c) 2006 phpBB Group +* @copyright (c) ' . date('Y') . ' phpBB Group * @author {CHANGED} - {AUTHOR} * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -1029,6 +1028,35 @@ $lang = array_merge($lang, array( } } + /** + * Little helper to add some hardcoded template bits + */ + function add_input_field() + { + $keys = func_get_args(); + + $non_static = array_shift($keys); + $value = array_shift($keys); + + if (!$non_static) + { + return '' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . ''; + } + + // If more then 270 characters, then we present a textarea, else an input field + $textarea = (utf8_strlen($value) > 270) ? true : false; + $tpl = ''; + + $tpl .= ($textarea) ? '' : '" />'; + + return $tpl; + } + /** * Print language entries */ @@ -1040,56 +1068,46 @@ $lang = array_merge($lang, array( { if (is_array($value)) { + // Write key $tpl .= ' - + '; foreach ($value as $_key => $_value) { if (is_array($_value)) { + // Write key $tpl .= ' - + '; foreach ($_value as $__key => $__value) { + // Write key $tpl .= ' - + '; } } else { + // Write key $tpl .= ' - + '; } @@ -1102,84 +1120,13 @@ $lang = array_merge($lang, array( } else { + // Write key $tpl .= ' - + - '; - } - } - - return $tpl; - } - - /** - * Print help entries - */ - function print_help_entries(&$lang_ary, $key_prefix = '', $text_field = true) - { - $tpl = ''; - - foreach ($lang_ary as $key => $value) - { - if (is_array($value)) - { - $tpl .= ' - - - '; - - foreach ($value as $_key => $_value) - { - $tpl .= ' - - - - '; - } - - $tpl .= ' - - - '; - } - else - { - $tpl .= ' - - - '; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 48756c640e..d175cfa3fe 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -110,6 +110,9 @@ class mcp_queue } $message = smiley_text($message); + $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); + $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']); + $template->assign_vars(array( 'S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), @@ -124,10 +127,12 @@ class mcp_queue 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', - 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), + 'U_VIEW_POST' => $post_url, + 'U_VIEW_TOPIC' => $topic_url, 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), + 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), + 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '', ''), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 5453a3f985..ed803df7e6 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1004,4 +1004,12 @@ function utf8_clean_string($text) return $text; } +/** +* A wrapper for htmlspecialchars($value, ENT_COMPAT, 'UTF-8') +*/ +function utf8_htmlspecialchars(&$value) +{ + return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); +} + ?> \ No newline at end of file diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 8c3e3e049f..47cd8ed20a 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -261,6 +261,7 @@ $lang = array_merge($lang, array( 'RETURN_POST' => '%sReturn to the post%s', 'RETURN_QUEUE' => '%sReturn to the queue%s', 'RETURN_REPORTS' => '%sReturn to the reports%s', + 'RETURN_TOPIC_SIMPLE' => '%sReturn to the topic%s', 'SEARCH_POSTS_BY_USER' => 'Search posts by', 'SELECT_ACTION' => 'Select desired action', diff --git a/phpBB/styles/subSilver/template/mcp_post.html b/phpBB/styles/subSilver/template/mcp_post.html index 0f695881ac..b355f6388d 100644 --- a/phpBB/styles/subSilver/template/mcp_post.html +++ b/phpBB/styles/subSilver/template/mcp_post.html @@ -45,7 +45,7 @@ - +
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '   ' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '   ' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . ' '; - if ($input_field) - { - $tpl .= ''; - } - else - { - $tpl .= '' . htmlspecialchars($__value, ENT_COMPAT, 'UTF-8') . ''; - } - + $tpl .= $this->add_input_field($input_field, $__value, $key, $_key, $__key); + $tpl .= '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ' '; - if ($input_field) - { - $tpl .= ''; - } - else - { - $tpl .= '' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . ''; - } - + $tpl .= $this->add_input_field($input_field, $_value, $key, $_key); + $tpl .= '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ' '; - if ($input_field) - { - $tpl .= ''; - } - else - { - $tpl .= '' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . ''; - } - - $tpl .= '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ''; - - if ($text_field) - { - $tpl .= ''; - } - else - { - $tpl .= '' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . ''; - } - - $tpl .= '
 
' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ''; - - if ($text_field) - { - $tpl .= ''; - } - else - { - $tpl .= '' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . ''; - } + $tpl .= $this->add_input_field($input_field, $value, $key); $tpl .= '
{L_POST_DETAILS}
{RETURN_QUEUE}{RETURN_REPORTS}{RETURN_TOPIC}{RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS}{RETURN_TOPIC}
{L_POST_SUBJECT}: