diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
commit | 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch) | |
tree | 3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/includes/ucp/ucp_pm_compose.php | |
parent | 91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff) | |
download | forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2 forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip |
ok... i hope i haven't messed too much with the code and everything is still working.
Changes:
- Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed.
- A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added.
git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp/ucp_pm_compose.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index af592e3612..298fd6ef18 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -22,12 +22,11 @@ if (!defined('IN_PHPBB')) */ function compose_pm($id, $mode, $action) { - global $template, $db, $auth, $user; - global $phpbb_root_path, $phpEx, $config; + global $template, $db, $auth, $user, $config; - include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); if (!$action) { @@ -71,9 +70,9 @@ function compose_pm($id, $mode, $action) { if ($msg_id) { - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + redirect(append_sid('ucp', 'i=pm&mode=view&action=view_message&p=' . $msg_id)); } - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); + redirect(append_sid('ucp', 'i=pm')); } // Output PM_TO box if message composing @@ -113,7 +112,7 @@ function compose_pm($id, $mode, $action) 'S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '', - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), + 'U_FIND_USERNAME' => append_sid('memberlist', "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), )); } @@ -343,7 +342,7 @@ function compose_pm($id, $mode, $action) $message_parser->message = ($action == 'reply') ? '' : $message_text; unset($message_text); - $s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id); + $s_action = append_sid('ucp', "i=$id&mode=$mode&action=$action", true, $user->session_id); $s_action .= ($msg_id) ? "&p=$msg_id" : ''; // Delete triggered ? @@ -358,7 +357,7 @@ function compose_pm($id, $mode, $action) delete_pm($user->data['user_id'], $msg_id, $folder_id); // jump to next message in "history"? nope, not for the moment. But able to be included later. - $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id"); + $meta_info = append_sid('ucp', "i=pm&folder=$folder_id"); $message = $user->lang['MESSAGE_DELETED']; meta_refresh(3, $meta_info); @@ -373,11 +372,11 @@ function compose_pm($id, $mode, $action) 'action' => 'delete' ); - // "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose" + // "ucp.php?i=pm&mode=compose" confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields)); } - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + redirect(append_sid('ucp', 'i=pm&mode=view&action=view_message&p=' . $msg_id)); } // Handle User/Group adding/removing @@ -470,7 +469,7 @@ function compose_pm($id, $mode, $action) ); $db->sql_query($sql); - $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); + $redirect_url = append_sid('ucp', "i=pm&mode=$mode"); meta_refresh(3, $redirect_url); $message = $user->lang['DRAFT_SAVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); @@ -641,8 +640,8 @@ function compose_pm($id, $mode, $action) // ((!$message_subject) ? $subject : $message_subject) $msg_id = submit_pm($action, $subject, $pm_data); - $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); - $return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); + $return_message_url = append_sid('ucp', 'i=pm&mode=view&p=' . $msg_id); + $return_folder_url = append_sid('ucp', 'i=pm&folder=outbox'); meta_refresh(3, $return_message_url); $message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']); @@ -724,11 +723,11 @@ function compose_pm($id, $mode, $action) $post_id = request_var('p', 0); if ($config['allow_post_links']) { - $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; + $message_link = "[url=" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; } else { - $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; + $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id})\n\n"; } } else @@ -749,11 +748,11 @@ function compose_pm($id, $mode, $action) if ($config['allow_post_links']) { - $quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; + $quote_username_text = '[url=' . generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; } else { - $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']})"; + $quote_username_text = $quote_username . ' (' . generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$post['author_id']})"; } $forward_text = array(); @@ -881,7 +880,7 @@ function compose_pm($id, $mode, $action) else { $tpl_ary = array_merge($tpl_ary, array( - 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + 'U_VIEW' => append_sid('memberlist', 'mode=group&g=' . $id), )); } @@ -944,7 +943,7 @@ function compose_pm($id, $mode, $action) 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], @@ -977,8 +976,8 @@ function compose_pm($id, $mode, $action) 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), - 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'), - 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')), + 'U_PROGRESS_BAR' => append_sid('posting', 'f=0&mode=popup'), + 'UA_PROGRESS_BAR' => addslashes(append_sid('posting', 'f=0&mode=popup')), )); // Build custom bbcodes array |