aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_profile.html17
-rw-r--r--phpBB/download.php6
-rw-r--r--phpBB/includes/acp/acp_profile.php36
-rw-r--r--phpBB/includes/acp/acp_users.php11
-rw-r--r--phpBB/includes/functions.php6
-rw-r--r--phpBB/includes/functions_user.php8
-rw-r--r--phpBB/includes/mcp/mcp_post.php11
-rw-r--r--phpBB/language/en/acp/profile.php4
-rw-r--r--phpBB/language/en/acp/users.php4
9 files changed, 79 insertions, 24 deletions
diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html
index c018981ccb..020da77327 100644
--- a/phpBB/adm/style/acp_profile.html
+++ b/phpBB/adm/style/acp_profile.html
@@ -161,7 +161,14 @@
<!-- ELSE -->
<h1>{L_ACP_CUSTOM_PROFILE_FIELDS}</h1>
-
+
+ <!-- IF S_NEED_EDIT -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{L_CUSTOM_FIELDS_NOT_TRANSLATED}</p>
+ </div>
+ <!-- ENDIF -->
+
<table cellspacing="1">
<thead>
<tr>
@@ -176,17 +183,17 @@
<td>{fields.FIELD_IDENT}</td>
<td>{fields.FIELD_TYPE}</td>
- <td style="text-align: center;"><a href="{fields.U_ACTIVATE_DEACTIVATE}">{fields.L_ACTIVATE_DEACTIVATE}</a><!-- IF fields.S_NEED_EDIT --> | <a href="{fields.U_EDIT}" style="color: red;">{L_EDIT}</a><!-- ENDIF --></td>
+ <td style="text-align: center;"><a href="{fields.U_ACTIVATE_DEACTIVATE}">{fields.L_ACTIVATE_DEACTIVATE}</a><!-- IF fields.S_NEED_EDIT --> | <a href="{fields.U_TRANSLATE}" style="color: red;">{L_TRANSLATE}</a><!-- ENDIF --></td>
<td style="width: 80px; text-align: right; white-space: nowrap;">
<!-- IF fields.S_FIRST_ROW && not fields.S_LAST_ROW -->
{ICON_MOVE_UP_DISABLED}
- <a href="{fields.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ <a href="{fields.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
<!-- ELSEIF not fields.S_FIRST_ROW && not fields.S_LAST_ROW-->
<a href="{fields.U_MOVE_UP}">{ICON_MOVE_UP}</a>
<a href="{fields.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
- <!-- ELSEIF fields.S_LAST_ROW && not fields.S_FIRST_ROW -->
- <a href="{fields.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ <!-- ELSEIF fields.S_LAST_ROW && not fields.S_FIRST_ROW -->
+ <a href="{fields.U_MOVE_UP}">{ICON_MOVE_UP}</a>
{ICON_MOVE_DOWN_DISABLED}
<!-- ENDIF -->
<!-- IF not fields.S_NEED_EDIT -->
diff --git a/phpBB/download.php b/phpBB/download.php
index dd81f1df4c..f60b4e08bd 100644
--- a/phpBB/download.php
+++ b/phpBB/download.php
@@ -231,9 +231,9 @@ function send_file_to_browser($attachment, $upload_dir, $category)
* Not really ideal, but should work fine...
* <code>
* if (strpos($upload_dir, '/') !== 0 && strpos($upload_dir, '../') === false)
- {
- header('X-Sendfile: ' . $filename);
- }
+ * {
+ * header('X-Sendfile: ' . $filename);
+ * }
* </code>
*/
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 45ded74f5d..9ce7f3ed92 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -530,7 +530,8 @@ class acp_profile
}
}
- if ($submit && $step == 1)
+ // Check for general issues in every step
+ if ($submit) // && $step == 1
{
// Check values for step 1
if ($cp->vars['field_ident'] == '')
@@ -553,12 +554,14 @@ class acp_profile
$error[] = $user->lang['EMPTY_USER_FIELD_NAME'];
}
- if ($field_type == FIELD_BOOL || $field_type == FIELD_DROPDOWN)
+ if ($field_type == FIELD_DROPDOWN && !sizeof($cp->vars['lang_options']))
{
- if (!sizeof($cp->vars['lang_options']))
- {
- $error[] = $user->lang['NO_FIELD_ENTRIES'];
- }
+ $error[] = $user->lang['NO_FIELD_ENTRIES'];
+ }
+
+ if ($field_type == FIELD_BOOL && (empty($cp->vars['lang_options'][0]) || empty($cp->vars['lang_options'][1])))
+ {
+ $error[] = $user->lang['NO_FIELD_ENTRIES'];
}
// Check for already existing field ident
@@ -756,12 +759,20 @@ class acp_profile
ORDER BY field_order';
$result = $db->sql_query($sql);
+ $s_one_need_edit = false;
while ($row = $db->sql_fetchrow($result))
{
$active_lang = (!$row['field_active']) ? 'ACTIVATE' : 'DEACTIVATE';
$active_value = (!$row['field_active']) ? 'activate' : 'deactivate';
$id = $row['field_id'];
+ $s_need_edit = (sizeof($lang_defs['diff'][$row['field_id']])) ? true : false;
+
+ if ($s_need_edit)
+ {
+ $s_one_need_edit = true;
+ }
+
$template->assign_block_vars('fields', array(
'FIELD_IDENT' => $row['field_ident'],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper($cp->profile_types[$row['field_type']])],
@@ -769,15 +780,22 @@ class acp_profile
'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang],
'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&amp;action=$active_value&amp;field_id=$id",
'U_EDIT' => $this->u_action . "&amp;action=edit&amp;field_id=$id",
+ 'U_TRANSLATE' => $this->u_action . "&amp;action=edit&amp;field_id=$id&amp;step=3",
'U_DELETE' => $this->u_action . "&amp;action=delete&amp;field_id=$id",
'U_MOVE_UP' => $this->u_action . "&amp;action=move_up&amp;order={$row['field_order']}",
'U_MOVE_DOWN' => $this->u_action . "&amp;action=move_down&amp;order={$row['field_order']}",
- 'S_NEED_EDIT' => (sizeof($lang_defs['diff'][$row['field_id']])) ? true : false)
+ 'S_NEED_EDIT' => $s_need_edit)
);
}
$db->sql_freeresult($result);
+ // At least one option field needs editing?
+ if ($s_one_need_edit)
+ {
+ $template->assign_var('S_NEED_EDIT', true);
+ }
+
$s_select_type = '';
foreach ($cp->profile_types as $key => $value)
{
@@ -858,10 +876,10 @@ class acp_profile
foreach ($options as $field => $field_type)
{
$value = ($action == 'create') ? request_var('l_' . $field, array(0 => ''), true) : $cp->vars['l_' . $field];
-
+
if ($field == 'lang_options')
{
- $var = ($action == 'create' || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['l_lang_options'] : $cp->vars['l_lang_options'][$lang_id];
+ $var = ($action == 'create' || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['lang_options'][$lang_id];
switch ($field_type)
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 7728df6275..6b817235b2 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -708,6 +708,17 @@ class acp_users
// Setting a normal member to be a founder
if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER)
{
+ // Make sure the user is not setting an Inactive or ignored user to be a founder
+ if ($user_row['user_type'] == USER_IGNORE)
+ {
+ trigger_error($user->lang['CANNOT_SET_FOUNDER_BOT'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
+ }
+
+ if ($user_row['user_type'] == USER_INACTIVE)
+ {
+ trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
+ }
+
$sql_ary['user_type'] = USER_FOUNDER;
}
else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 21abbad392..27b935d759 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1464,7 +1464,7 @@ function generate_board_url($without_script_path = false)
*/
function redirect($url, $return = false)
{
- global $db, $cache, $config, $user;
+ global $db, $cache, $config, $user, $phpbb_root_path;
if (empty($user->lang))
{
@@ -1521,8 +1521,8 @@ function redirect($url, $return = false)
}
else
{
- // Get the realpath of dirname
- $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./')));
+ // Used ./ before, but $phpbb_root_path is working better with urls within another root path
+ $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path)));
$page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname'])));
$intersection = array_intersect_assoc($root_dirs, $page_dirs);
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 03a7ff19a5..96b7fb4cec 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -12,7 +12,7 @@
* Obtain user_ids from usernames or vice versa. Returns false on
* success else the error string
*/
-function user_get_id_name(&$user_id_ary, &$username_ary)
+function user_get_id_name(&$user_id_ary, &$username_ary, $only_active = false)
{
global $db;
@@ -44,6 +44,12 @@ function user_get_id_name(&$user_id_ary, &$username_ary)
$sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set($sql_where, $sql_in);
+
+ if ($only_active)
+ {
+ $sql .= ' AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
+ }
+
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 189ee5c326..201137a9a4 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -372,7 +372,16 @@ function change_poster(&$post_info, $userdata)
}
}
- // Do not change the poster_id within the attachments table, since they were still posted by the original user
+ // change the poster_id within the attachments table, else the data becomes out of sync and errors displayed because of wrong ownership
+ if ($post_info['post_attachment'])
+ {
+ $sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
+ SET poster_id = ' . $userdata['user_id'] . '
+ WHERE poster_id = ' . $post_info['user_id'] . '
+ AND post_msg_id = ' . $post_info['post_id'] . '
+ AND topic_id = ' . $post_info['topic_id'];
+ $db->sql_query($sql);
+ }
$from_username = $post_info['username'];
$to_username = $userdata['username'];
diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php
index dd26ea5370..6e86da03a7 100644
--- a/phpBB/language/en/acp/profile.php
+++ b/phpBB/language/en/acp/profile.php
@@ -43,13 +43,14 @@ $lang = array_merge($lang, array(
'CHANGED_PROFILE_FIELD' => 'Successfully changed profile field.',
'CHARS_ANY' => 'Any character',
'CHECKBOX' => 'Checkbox',
+ 'COLUMNS' => 'Columns',
'CP_LANG_DEFAULT_VALUE' => 'Default value',
'CP_LANG_EXPLAIN' => 'Field Description',
'CP_LANG_EXPLAIN_EXPLAIN' => 'The explanation for this field presented to the user',
'CP_LANG_NAME' => 'Field name/title presented to the user',
'CP_LANG_OPTIONS' => 'Options',
'CREATE_NEW_FIELD' => 'Create new field',
- 'COLUMNS' => 'Columns',
+ 'CUSTOM_FIELDS_NOT_TRANSLATED' => 'At least one custom profile field has not yet been translated. Please enter the required information by clicking on the &quot;Translate&quot; link.',
'DEFAULT_ISO_LANGUAGE' => 'Default language [%s]',
'DEFAULT_LANGUAGE_NOT_FILLED' => 'The language entries for the default language are not filled for this profile field.',
@@ -139,6 +140,7 @@ $lang = array_merge($lang, array(
'STRING_DEFAULT_VALUE_EXPLAIN' => 'Enter a default phrase to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
'TEXT_DEFAULT_VALUE_EXPLAIN' => 'Enter a default text to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
+ 'TRANSLATE' => 'Translate',
'UPDATE_PREVIEW' => 'Update preview',
'USER_FIELD_NAME' => 'Field name/title presented to the user',
diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php
index f9d5301b88..eb9298cebf 100644
--- a/phpBB/language/en/acp/users.php
+++ b/phpBB/language/en/acp/users.php
@@ -46,8 +46,10 @@ $lang = array_merge($lang, array(
'CANNOT_FORCE_REACT_YOURSELF' => 'You are not allowed to force reactivation of your own account.',
'CANNOT_REMOVE_ANONYMOUS' => 'You are not able to remove the guest user account.',
'CANNOT_REMOVE_YOURSELF' => 'You are not allowed to remove your own user account.',
+ 'CANNOT_SET_FOUNDER_BOT' => 'You are not able to promote ignored users to be founders.',
+ 'CANNOT_SET_FOUNDER_INACTIVE' => 'You need to activate users before you promote them to founders, only activated users are able to be promoted.',
'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing the users email address.',
-
+
'DELETE_POSTS' => 'Delete posts',
'DELETE_USER' => 'Delete user',
'DELETE_USER_EXPLAIN' => 'Please note that deleting a user is final, they cannot be recovered',