diff options
Diffstat (limited to 'phpBB/modules/acp/acp_profile.php')
| -rw-r--r-- | phpBB/modules/acp/acp_profile.php | 96 |
1 files changed, 43 insertions, 53 deletions
diff --git a/phpBB/modules/acp/acp_profile.php b/phpBB/modules/acp/acp_profile.php index 529f84de94..fc1c8e1004 100644 --- a/phpBB/modules/acp/acp_profile.php +++ b/phpBB/modules/acp/acp_profile.php @@ -28,13 +28,11 @@ class acp_profile function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); - $user->add_lang(array('ucp', 'acp/profile')); + phpbb::$user->add_lang(array('ucp', 'acp/profile')); $this->tpl_name = 'acp_profile'; $this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS'; @@ -101,7 +99,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -193,7 +191,7 @@ class acp_profile $db->sql_transaction('commit'); add_log('admin', 'LOG_PROFILE_FIELD_REMOVED', $field_ident); - trigger_error($user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else { @@ -212,7 +210,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT lang_id @@ -224,7 +222,7 @@ class acp_profile if (!in_array($default_lang_id, $this->lang_defs['entry'][$field_id])) { - trigger_error($user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -240,7 +238,7 @@ class acp_profile $db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); - trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); break; @@ -249,7 +247,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -265,7 +263,7 @@ class acp_profile $db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); - trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); break; @@ -298,7 +296,7 @@ class acp_profile { if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT l.*, f.* @@ -324,7 +322,7 @@ class acp_profile if (!$field_row) { - trigger_error($user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->edit_lang_id = $field_row['lang_id']; @@ -357,7 +355,7 @@ class acp_profile if (!$field_type) { - trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } $field_row = array_merge($default_values[$field_type], array( @@ -588,32 +586,32 @@ class acp_profile // Check values for step 1 if ($cp->vars['field_ident'] == '') { - $error[] = $user->lang['EMPTY_FIELD_IDENT']; + $error[] = phpbb::$user->lang['EMPTY_FIELD_IDENT']; } if (!preg_match('/^[a-z_]+$/', $cp->vars['field_ident'])) { - $error[] = $user->lang['INVALID_CHARS_FIELD_IDENT']; + $error[] = phpbb::$user->lang['INVALID_CHARS_FIELD_IDENT']; } if (strlen($cp->vars['field_ident']) > 17) { - $error[] = $user->lang['INVALID_FIELD_IDENT_LEN']; + $error[] = phpbb::$user->lang['INVALID_FIELD_IDENT_LEN']; } if ($cp->vars['lang_name'] == '') { - $error[] = $user->lang['EMPTY_USER_FIELD_NAME']; + $error[] = phpbb::$user->lang['EMPTY_USER_FIELD_NAME']; } if ($field_type == FIELD_DROPDOWN && !sizeof($cp->vars['lang_options'])) { - $error[] = $user->lang['NO_FIELD_ENTRIES']; + $error[] = phpbb::$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']; + $error[] = phpbb::$user->lang['NO_FIELD_ENTRIES']; } // Check for already existing field ident @@ -628,7 +626,7 @@ class acp_profile if ($row) { - $error[] = $user->lang['FIELD_IDENT_ALREADY_EXIST']; + $error[] = phpbb::$user->lang['FIELD_IDENT_ALREADY_EXIST']; } } } @@ -720,8 +718,8 @@ class acp_profile 'S_EDIT_MODE' => ($action == 'edit') ? true : false, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', - 'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], - 'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], + 'L_TITLE' => phpbb::$user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], + 'L_EXPLAIN' => phpbb::$user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], 'U_ACTION' => $this->u_action . "&action=$action&step=$step", 'U_BACK' => $this->u_action) @@ -741,8 +739,8 @@ class acp_profile 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false, - 'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], phpbb::$config['default_lang']), - 'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])], + 'L_LANG_SPECIFIC' => sprintf(phpbb::$user->lang['LANG_SPECIFIC_OPTIONS'], phpbb::$config['default_lang']), + 'FIELD_TYPE' => phpbb::$user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])], 'FIELD_IDENT' => $cp->vars['field_ident'], 'LANG_NAME' => $cp->vars['lang_name'], 'LANG_EXPLAIN' => $cp->vars['lang_explain']) @@ -755,7 +753,7 @@ class acp_profile 'S_TEXT' => ($field_type == FIELD_TEXT) ? true : false, 'S_STRING' => ($field_type == FIELD_STRING) ? true : false, - 'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'], + 'L_DEFAULT_VALUE_EXPLAIN' => phpbb::$user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'], 'LANG_DEFAULT_VALUE' => $cp->vars['lang_default_value']) ); } @@ -782,7 +780,7 @@ class acp_profile 'S_BOOL' => ($field_type == FIELD_BOOL) ? true : false, 'S_DROPDOWN' => ($field_type == FIELD_DROPDOWN) ? true : false, - 'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'], + 'L_LANG_OPTIONS_EXPLAIN' => phpbb::$user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'], 'LANG_OPTIONS' => ($field_type == FIELD_DROPDOWN) ? implode("\n", $cp->vars['lang_options']) : '', 'FIRST_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][0] : '', 'SECOND_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][1] : '') @@ -795,7 +793,7 @@ class acp_profile $template->assign_vars(array( 'S_STEP_TWO' => true, - 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) + 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? phpbb::$user->lang['SAVE'] : phpbb::$user->lang['PROFILE_LANG_OPTIONS']) ); // Build options based on profile type @@ -818,7 +816,7 @@ class acp_profile foreach ($options as $lang_id => $lang_ary) { $template->assign_block_vars('options', array( - 'LANGUAGE' => sprintf($user->lang[(($lang_id == $this->edit_lang_id) ? 'DEFAULT_' : '') . 'ISO_LANGUAGE'], $lang_ary['lang_iso'])) + 'LANGUAGE' => sprintf(phpbb::$user->lang[(($lang_id == $this->edit_lang_id) ? 'DEFAULT_' : '') . 'ISO_LANGUAGE'], $lang_ary['lang_iso'])) ); foreach ($lang_ary['fields'] as $field_ident => $field_ary) @@ -864,9 +862,9 @@ class acp_profile $template->assign_block_vars('fields', array( 'FIELD_IDENT' => $row['field_ident'], - 'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])], + 'FIELD_TYPE' => phpbb::$user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])], - 'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang], + 'L_ACTIVATE_DEACTIVATE' => phpbb::$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", @@ -888,7 +886,7 @@ class acp_profile $s_select_type = ''; foreach (custom_profile::$profile_types as $key => $value) { - $s_select_type .= '<option value="' . $key . '">' . $user->lang['FIELD_' . strtoupper($value)] . '</option>'; + $s_select_type .= '<option value="' . $key . '">' . phpbb::$user->lang['FIELD_' . strtoupper($value)] . '</option>'; } $template->assign_vars(array( @@ -902,8 +900,6 @@ class acp_profile */ function build_language_options(&$cp, $field_type, $action = 'create') { - global $user, $db; - $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][phpbb::$config['default_lang']]; $sql = 'SELECT lang_id, lang_iso @@ -951,13 +947,13 @@ class acp_profile { $lang_options[1]['lang_iso'] = $this->lang_defs['id'][$default_lang_id]; $lang_options[1]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd>' . ((is_array($cp->vars[$field])) ? implode('<br />', $cp->vars[$field]) : bbcode_nl2br($cp->vars[$field])) . '</dd>' ); - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[1]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[1]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } @@ -976,25 +972,25 @@ class acp_profile case 'two_options': $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => ' - <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" /> ' . $user->lang['FIRST_OPTION'] . '</dd> - <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" /> ' . $user->lang['SECOND_OPTION'] . '</dd>' + <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" /> ' . phpbb::$user->lang['FIRST_OPTION'] . '</dd> + <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" /> ' . phpbb::$user->lang['SECOND_OPTION'] . '</dd>' ); break; case 'optionfield': $value = ((isset($value[$lang_id])) ? ((is_array($value[$lang_id])) ? implode("\n", $value[$lang_id]) : $value[$lang_id]) : implode("\n", $var)); $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="7" cols="80">' . $value . '</textarea></dd>' ); break; } - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } else @@ -1002,13 +998,13 @@ class acp_profile $var = ($action == 'create' || !is_array($cp->vars[$field])) ? $cp->vars[$field] : $cp->vars[$field][$lang_id]; $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => ($field_type == 'string') ? '<dd><input class="medium" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" /></dd>' : '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea></dd>' ); - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } } @@ -1022,8 +1018,6 @@ class acp_profile */ function save_profile_field(&$cp, $field_type, $action = 'create') { - global $db, $user; - $field_id = request_var('field_id', 0); // Collect all information, if something is going wrong, abort the operation @@ -1297,12 +1291,12 @@ class acp_profile if ($action == 'edit') { add_log('admin', 'LOG_PROFILE_FIELD_EDIT', $cp->vars['field_ident'] . ':' . $cp->vars['lang_name']); - trigger_error($user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else { add_log('admin', 'LOG_PROFILE_FIELD_CREATE', substr($field_ident, 3) . ':' . $cp->vars['lang_name']); - trigger_error($user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } } @@ -1311,8 +1305,6 @@ class acp_profile */ function update_insert($table, $sql_ary, $where_fields) { - global $db; - $where_sql = array(); $check_key = ''; @@ -1359,8 +1351,6 @@ class acp_profile */ function add_field_ident($field_ident, $field_type) { - global $db; - switch ($db->dbms_type) { case 'mysql': |
