diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 36 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 11 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 8 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 11 |
5 files changed, 58 insertions, 14 deletions
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 . "&action=$active_value&field_id=$id", 'U_EDIT' => $this->u_action . "&action=edit&field_id=$id", + 'U_TRANSLATE' => $this->u_action . "&action=edit&field_id=$id&step=3", 'U_DELETE' => $this->u_action . "&action=delete&field_id=$id", 'U_MOVE_UP' => $this->u_action . "&action=move_up&order={$row['field_order']}", 'U_MOVE_DOWN' => $this->u_action . "&action=move_down&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 . '&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 . '&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']; |