diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 20 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 5 | ||||
-rw-r--r-- | phpBB/includes/db/mssql_odbc.php | 3 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_module.php | 27 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 12 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_notes.php | 7 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_reports.php | 9 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 1 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_warn.php | 499 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_main.php | 34 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_prefs.php | 2 |
12 files changed, 338 insertions, 285 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index c8a7d4885a..3f27d3b907 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1421,7 +1421,9 @@ parse_css_file = {PARSE_CSS_FILE} global $db, $user, $phpbb_root_path, $cache, $template; $this->page_title = 'EDIT_IMAGESET'; + $update = (isset($_POST['update'])) ? true : false; + $imgname = request_var('imgname', ''); $imgpath = request_var('imgpath', ''); $imgsize = request_var('imgsize', false); @@ -1446,7 +1448,7 @@ parse_css_file = {PARSE_CSS_FILE} if (strpos($imgname, '-') !== false) { list($imgname, $imgnamelang) = explode('-', $imgname); - $sql_extra = " AND image_lang IN('" . $db->sql_escape($imgnamelang) . "', '')"; + $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')"; } $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id @@ -1455,12 +1457,13 @@ parse_css_file = {PARSE_CSS_FILE} AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra"; $result = $db->sql_query($sql); $imageset_data_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $image_filename = $imageset_data_row['image_filename']; $image_width = $imageset_data_row['image_width']; $image_height = $imageset_data_row['image_height']; $image_lang = $imageset_data_row['image_lang']; $image_id = $imageset_data_row['image_id']; - $db->sql_freeresult($result); if (!$imageset_row) { @@ -1484,17 +1487,16 @@ parse_css_file = {PARSE_CSS_FILE} if ($valid_name) { // If imgwidth and imgheight are non-zero grab the actual size - // from the image itself ... we ignore width settings for the poll center - // image + // from the image itself ... we ignore width settings for the poll center image $imgwidth = $imgheight = 0; $imglang = ''; - if ($imageset_path && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) + if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) { trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($imgsize && $imageset_path) + if ($imgsize && $imgpath) { list($imgwidth, $imgheight) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"); $imgwidth = ($imgname != 'poll_center') ? (int) $imgwidth : 0; @@ -1538,6 +1540,11 @@ parse_css_file = {PARSE_CSS_FILE} add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name); $template->assign_var('SUCCESS', true); + + $image_filename = $imgfilename; + $image_width = $imgwidth; + $image_height = $imgheight; + $image_lang = $imglang; } } } @@ -1647,7 +1654,6 @@ parse_css_file = {PARSE_CSS_FILE} } $imgsize_bool = (!empty($imgname) && $image_width && $image_height) ? true : false; - $image_request = '../styles/' . $imageset_path . '/imageset/' . ($image_lang ? $imgnamelang . '/' : '') . $image_filename; $template->assign_vars(array( diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fa9709194b..5df9c418dc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -282,6 +282,7 @@ class acp_users $key_len = 54 - (strlen($server_url)); $key_len = ($key_len > 6) ? $key_len : 6; $user_actkey = substr($user_actkey, 0, $key_len); + $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; if ($user_row['user_type'] == USER_NORMAL) { @@ -295,7 +296,7 @@ class acp_users $messenger = new messenger(false); - $messenger->template('user_resend_inactive', $user_row['user_lang']); + $messenger->template($email_template, $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); @@ -1168,7 +1169,7 @@ class acp_users if ($submit) { $error = validate_data($data, array( - 'dateformat' => array('string', false, 3, 30), + 'dateformat' => array('string', false, 1, 30), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), 'tz' => array('num', false, -14, 14), diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 5fa14a66b6..52942ac3bd 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -43,6 +43,9 @@ class dbal_mssql_odbc extends dbal $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; + // + // @ini_set('odbc.defaultlrl', '32M'); + $this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 01f694afd1..251a7b9f0d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -567,9 +567,11 @@ function topic_generate_pagination($replies, $url) for ($j = 0; $j < $replies + 1; $j += $per_page) { $pagination .= '<a href="' . $url . '&start=' . $j . '">' . $times . '</a>'; - if ($times == 1 && $total_pages > 4) + if ($times == 1 && $total_pages > 5) { $pagination .= ' ... '; + + // Display the last three pages $times = $total_pages - 3; $j += ($total_pages - 4) * $per_page; } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index f2494820ae..86cc93435d 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -465,6 +465,33 @@ class p_master } /** + * Appending url parameter to the currently active module. + * + * This function is called for adding specific url parameters while executing the current module. + * It is doing the same as the _module_{name}_url() function, apart from being able to be called after + * having dynamically parsed specific parameters. This allows more freedom in choosing additional parameters. + * One example can be seen in /includes/mcp/mcp_notes.php - $this->p_master->adjust_url() call. + * + * @param string $url_extra Extra url parameters, e.g.: &u=$user_id + * + */ + function adjust_url($url_extra) + { + if (empty($this->module_ary[$this->active_module_row_id])) + { + return; + } + + $row = &$this->module_ary[$this->active_module_row_id]; + + // We check for the same url_extra in $row['url_extra'] to overcome doubled additions... + if (strpos($row['url_extra'], $url_extra) === false) + { + $row['url_extra'] .= $url_extra; + } + } + + /** * Check if a module is active */ function is_active($id, $mode = false) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index d335c32cd5..bbd2d070cb 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1184,6 +1184,12 @@ function validate_username($username, $allowed_username = false) return false; } + // ... fast checks first. + if (strpos($username, '"') !== false || strpos($username, '"') !== false) + { + return 'INVALID_CHARS'; + } + $mbstring = $pcre = false; // generic UTF-8 character types supported? @@ -1247,6 +1253,7 @@ function validate_username($username, $allowed_username = false) break; case 'USERNAME_ASCII': + default: $pcre = true; $regex = '[\x01-\x7F]+'; break; @@ -1269,11 +1276,6 @@ function validate_username($username, $allowed_username = false) } } - if (strpos($username, '"') !== false || strpos($username, '"') !== false) - { - return 'INVALID_CHARS'; - } - $sql = 'SELECT username FROM ' . USERS_TABLE . " WHERE username_clean = '" . $db->sql_escape($clean_username) . "'"; diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 9d4b522fe4..62ff6e0a92 100755 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -18,7 +18,7 @@ class mcp_notes var $p_master; var $u_action; - function mcp_main(&$p_master) + function mcp_notes(&$p_master) { $this->p_master = &$p_master; } @@ -91,6 +91,11 @@ class mcp_notes $user_id = $userrow['user_id']; + // Populate user id to the currently active module (this module) + // The following method is another way of adjusting module urls. It is the easy variant if we want + // to directly adjust the current module url based on data retrieved within the same module. + $this->p_master->adjust_url('&u=' . $user_id); + $deletemark = ($action == 'del_marked') ? true : false; $deleteall = ($action == 'del_all') ? true : false; $marked = request_var('marknote', array(0)); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 33c71b47b1..c3c39d22fe 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -66,7 +66,7 @@ class mcp_reports $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u - WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id AND r.report_closed = 0") . ' + WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id AND r.user_id = u.user_id'; $result = $db->sql_query($sql); @@ -75,7 +75,12 @@ class mcp_reports if (!$report) { - trigger_error('NO_REPORT_REPORT'); + trigger_error('NO_REPORT'); + } + + if ($report_id && $report['report_closed']) + { + trigger_error('REPORT_CLOSED'); } $post_id = $report['post_id']; diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 427c7e63d2..b9f66082fe 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -233,6 +233,7 @@ function mcp_topic_view($id, $mode, $action) 'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false, 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, 'S_MERGE_VIEW' => ($action == 'merge') ? true : false, + 'S_SPLIT_VIEW' => ($action == 'split') ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_TOPIC_ICON' => $icon_id, diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 6d3961de2f..f041732b8a 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -18,7 +18,7 @@ class mcp_warn var $p_master; var $u_action; - function mcp_main(&$p_master) + function mcp_warn(&$p_master) { $this->p_master = &$p_master; } @@ -40,332 +40,329 @@ class mcp_warn switch ($mode) { case 'front': - mcp_warn_front_view($id, $mode); + $this->mcp_warn_front_view(); $this->tpl_name = 'mcp_warn_front'; break; case 'list': - mcp_warn_list_view($id, $mode, $action); + $this->mcp_warn_list_view($action); $this->tpl_name = 'mcp_warn_list'; break; case 'warn_post': - mcp_warn_post_view($id, $mode, $action); + $this->mcp_warn_post_view($action); $this->tpl_name = 'mcp_warn_post'; break; case 'warn_user': - mcp_warn_user_view($id, $mode, $action); + $this->mcp_warn_user_view($action); $this->tpl_name = 'mcp_warn_user'; break; } } -} -/** -* Generates the summary on the main page of the warning module -*/ -function mcp_warn_front_view($id, $mode) -{ - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + /** + * Generates the summary on the main page of the warning module + */ + function mcp_warn_front_view() + { + global $phpEx, $phpbb_root_path, $config; + global $template, $db, $user, $auth; - $template->assign_vars(array( - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), - 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true', false), - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user'), - ) - ); + $template->assign_vars(array( + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true', false), + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user'), + )); - // Obtain a list of the 5 naughtiest users.... - // These are the 5 users with the highest warning count + // Obtain a list of the 5 naughtiest users.... + // These are the 5 users with the highest warning count + $highest = array(); + $count = 0; - $highest = array(); - $count = 0; + view_warned_users($highest, $count, 5); - view_warned_users($highest, $count, 5); + foreach ($highest as $row) + { + $template->assign_block_vars('highest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), - foreach ($highest as $row) - { - $template->assign_block_vars('highest', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', + 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), - 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } - 'WARNING_TIME' => $user->format_date($row['user_last_warning']), - 'WARNINGS' => $row['user_warnings'], - ) - ); - } + // And now the 5 most recent users to get in trouble + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time + FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w + WHERE u.user_id = w.user_id + ORDER BY w.warning_time DESC'; + $result = $db->sql_query_limit($sql, 5); - // And now the 5 most recent users to get in trouble + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('latest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', + 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), - $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time - FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w - WHERE u.user_id = w.user_id - ORDER BY w.warning_time DESC'; - $result = $db->sql_query_limit($sql, 5); + 'WARNING_TIME' => $user->format_date($row['warning_time']), + 'WARNINGS' => $row['user_warnings'], + )); + } + $db->sql_freeresult($result); + } - while ($row = $db->sql_fetchrow($result)) + /** + * Lists all users with warnings + */ + function mcp_warn_list_view($action) { - $template->assign_block_vars('latest', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + global $phpEx, $phpbb_root_path, $config; + global $template, $db, $user, $auth; - 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + $user->add_lang('memberlist'); - 'WARNING_TIME' => $user->format_date($row['warning_time']), - 'WARNINGS' => $row['user_warnings'], - ) - ); - } - $db->sql_freeresult($result); -} + $start = request_var('start', 0); + $st = request_var('st', 0); + $sk = request_var('sk', 'b'); + $sd = request_var('sd', 'd'); -/** -* Lists all users with warnings -*/ -function mcp_warn_list_view($id, $mode, $action) -{ - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); + $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings'); - $user->add_lang('memberlist'); + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); - $start = request_var('start', 0); - $st = request_var('st', 0); - $sk = request_var('sk', 'b'); - $sd = request_var('sd', 'd'); + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); - $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings'); + $users = array(); + $user_count = 0; - $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; - gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); - // Define where and sort sql for use in displaying logs - $sql_where = ($st) ? (time() - ($st * 86400)) : 0; - $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + foreach ($users as $row) + { + $template->assign_block_vars('user', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), - $users = array(); - $user_count = 0; + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', + 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } - view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + + 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), + 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count), + )); + } - foreach ($users as $row) + /** + * Handles warning the user when the warning is for a specific post + */ + function mcp_warn_post_view($action) { - $template->assign_block_vars('user', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + global $phpEx, $phpbb_root_path, $config; + global $template, $db, $user, $auth; + + $post_id = request_var('p', 0); + $forum_id = request_var('f', 0); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = request_var('warning', '', true); + + $sql = 'SELECT u.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE post_id = $post_id + AND u.user_id = p.poster_id"; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error($user->lang['NO_POST']); + } - 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), - - 'WARNING_TIME' => $user->format_date($row['user_last_warning']), - 'WARNINGS' => $row['user_warnings'], - ) - ); - } + // There is no point issuing a warning to ignored users (ie anonymous and bots) + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']); + } - $template->assign_vars(array( - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode"), - 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS' => $s_limit_days, - - 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), - 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count), - ) - ); + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_WARN_SELF']); + } -} + // Check if there is already a warning for this post to prevent multiple + // warnings for the same offence + $sql = 'SELECT post_id + FROM ' . WARNINGS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); -/** -* Handles warning the user when the warning is for a specific post -*/ -function mcp_warn_post_view($id, $mode, $action) -{ - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + if ($row) + { + trigger_error($user->lang['ALREADY_WARNED']); + } - $post_id = request_var('p', 0); - $forum_id = request_var('f', 0); - $notify = (isset($_REQUEST['notify_user'])) ? true : false; - $warning = request_var('warning', '', true); + $user_id = $user_row['user_id']; - $sql = 'SELECT u.*, p.* - FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u - WHERE post_id = $post_id - AND u.user_id = p.poster_id"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $this->p_master->adjust_url('&f=' . $forum_id . '&p=' . $post_id); - if (!$user_row) - { - trigger_error($user->lang['NO_POST']); - } + if ($warning && $action == 'add_warning') + { + add_warning($user_row, $warning, $notify, $post_id); - // There is no point issuing a warning to ignored users (ie anonymous and bots) - if ($user_row['user_type'] == USER_IGNORE) - { - trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']); - } + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + } - // Prevent someone from warning themselves - if ($user_row['user_id'] == $user->data['user_id']) - { - trigger_error($user->lang['CANNOT_WARN_SELF']); - } + // OK, they didn't submit a warning so lets build the page for them to do so + + // We want to make the message available here as a reminder + // Parse the message and subject + $message = $user_row['post_text']; + $message = str_replace("\n", '<br />', censor_text($message)); - // Check if there is already a warning for this post to prevent multiple - // warnings for the same offence - $sql = 'SELECT post_id - FROM ' . WARNINGS_TABLE . " - WHERE post_id = $post_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + // Second parse bbcode here + if ($user_row['bbcode_bitfield']) + { + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - if ($row) - { - trigger_error($user->lang['ALREADY_WARNED']); - } + $bbcode = new bbcode($user_row['bbcode_bitfield']); + $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); + } - $user_id = $user_row['user_id']; + // Always process smilies after parsing bbcodes + $message = smiley_text($message); - if ($warning && $action == 'add_warning') - { - add_warning($user_row, $warning, $notify, $post_id); + // Generate the appropriate user information for the user we are looking at + if (!function_exists('get_user_avatar')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); - meta_refresh(2, $redirect); - trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); - } + $rank_title = $rank_img = ''; + $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']); - // OK, they didn't submit a warning so lets build the page for them to do so - - // We want to make the message available here as a reminder - // Parse the message and subject - $message = $user_row['post_text']; - $message = str_replace("\n", '<br />', censor_text($message)); + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action . "p=$post_id", - // Second parse bbcode here - if ($user_row['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + 'POST' => $message, + 'USERNAME' => $user_row['username'], + 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', + 'RANK_TITLE' => $rank_title, + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, - $bbcode = new bbcode($user_row['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); - } + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $rank_img, - // Always process smilies after parsing bbcodes - $message = smiley_text($message); + 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id"), + )); + } - // Generate the appropriate user information for the user we are looking at - if (!function_exists('get_user_avatar')) + /** + * Handles warning the user + */ + function mcp_warn_user_view($action) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - } + global $phpEx, $phpbb_root_path, $config, $module; + global $template, $db, $user, $auth; - $rank_title = $rank_img = ''; - $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']); + $user_id = request_var('u', 0); + $username = request_var('username', '', true); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = request_var('warning', '', true); - $template->assign_vars(array( - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id"), + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; - 'POST' => $message, - 'USERNAME' => $user_row['username'], - 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', - 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($user_row['user_regdate']), - 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE ' . $sql_where; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, + if (!$user_row) + { + trigger_error('NO_USER'); + } - 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id"), - ) - ); -} + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_WARN_SELF']); + } -/** -* Handles warning the user -*/ -function mcp_warn_user_view($id, $mode, $action) -{ - global $phpEx, $phpbb_root_path, $config, $module; - global $template, $db, $user, $auth; + $user_id = $user_row['user_id']; - $user_id = request_var('u', 0); - $username = request_var('username', '', true); - $notify = (isset($_REQUEST['notify_user'])) ? true : false; - $warning = request_var('warning', '', true); + $this->p_master->adjust_url('&u=' . $user_id); - $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + if ($warning && $action == 'add_warning') + { + add_warning($user_row, $warning, $notify); - $sql = 'SELECT * - FROM ' . USERS_TABLE . ' - WHERE ' . $sql_where; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + } - if (!$user_row) - { - trigger_error('NO_USER'); - } + // Generate the appropriate user information for the user we are looking at + if (!function_exists('get_user_avatar')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } - // Prevent someone from warning themselves - if ($user_row['user_id'] == $user->data['user_id']) - { - trigger_error($user->lang['CANNOT_WARN_SELF']); - } + $rank_title = $rank_img = ''; + $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']); - $user_id = $user_row['user_id']; + // OK, they didn't submit a warning so lets build the page for them to do so + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action . "u=$user_id", - if ($warning && $action == 'add_warning') - { - add_warning($user_row, $warning, $notify); + 'USERNAME' => $user_row['username'], + 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', + 'RANK_TITLE' => $rank_title, + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); - meta_refresh(2, $redirect); - trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); - } + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $rank_img, + )); - // Generate the appropriate user information for the user we are looking at - if (!function_exists('get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + return $user_id; } - - $rank_title = $rank_img = ''; - $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']); - - // OK, they didn't submit a warning so lets build the page for them to do so - $template->assign_vars(array( - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&u=$user_id"), - - 'USERNAME' => $user_row['username'], - 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', - 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($user_row['user_regdate']), - 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, - 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, - - 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, - ) - ); } /** diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index ea0cea30ce..60573aa7fd 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -127,16 +127,19 @@ class ucp_main $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', @@ -144,6 +147,7 @@ class ucp_main 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD' => $unread_topic, + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&view=unread") . '#unread', @@ -179,8 +183,9 @@ class ucp_main // 'S_GROUP_OPTIONS' => $group_options, - 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user->data['user_id'] . '&sr=posts') : '') - ); + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user->data['user_id'] . '&sr=posts') : '', + )); + break; case 'subscribed': @@ -305,7 +310,6 @@ class ucp_main 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', 'FORUM_NAME' => $row['forum_name'], - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'LAST_POST_SUBJECT' => $row['forum_last_post_subject'], 'LAST_POST_TIME' => $last_post_time, @@ -449,8 +453,6 @@ class ucp_main 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', @@ -464,8 +466,8 @@ class ucp_main 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], - 'U_VIEW_TOPIC' => $view_topic_url) - ); + 'U_VIEW_TOPIC' => $view_topic_url, + )); } break; @@ -613,7 +615,6 @@ class ucp_main 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), @@ -621,8 +622,8 @@ class ucp_main 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_MOVE_UP' => ($row['order_id'] != 1) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks&move_up=' . $row['order_id']) : '', - 'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks&move_down=' . $row['order_id']) : '') - ); + 'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks&move_down=' . $row['order_id']) : '', + )); } break; @@ -806,8 +807,11 @@ class ucp_main 'S_DISPLAY_MARK_ALL' => ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false, 'S_HIDDEN_FIELDS' => (isset($s_hidden_fields)) ? $s_hidden_fields : '', - 'S_UCP_ACTION' => $this->u_action) - ); + 'S_UCP_ACTION' => $this->u_action, + + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + )); // Set desired template $this->tpl_name = 'ucp_main_' . $mode; diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index e57cc3ec26..e0c6ee3e84 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -50,7 +50,7 @@ class ucp_prefs $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style']; $error = validate_data($data, array( - 'dateformat' => array('string', false, 3, 30), + 'dateformat' => array('string', false, 1, 30), 'lang' => array('match', false, '#^[a-z0-9_\-]{2,}$#i'), 'tz' => array('num', false, -14, 14), )); |