From 139f1d35302fc675b5e972e55c62d36cbc42af5c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 31 Aug 2009 14:57:04 +0000 Subject: [PATCH] fix r10076 for #48615 - Ability to specify amount of time user is able to delete his last post in topic. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10080 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/acp/acp_board.php | 1 + phpBB/install/database_update.php | 5 +++++ phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ phpBB/posting.php | 4 ++-- phpBB/viewtopic.php | 3 ++- 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f1f5787cab..bf34bea603 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -201,7 +201,6 @@
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • -
  • [Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • @@ -234,6 +233,7 @@
  • [Change] Require user to be registered and logged in to search for unread posts if topic read tracking is disabled for guests (Bug #49525)
  • [Change] Allow three-digit hex notation in Color BBcode. (Bug #39965 - Patch by m0rpha)
  • [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
  • +
  • [Change] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 78ba5092a0..9f0bcf210f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -177,6 +177,7 @@ class acp_board 'legend2' => 'POSTING', 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d489521a20..48dd55ac72 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1498,6 +1498,11 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); } + if (!isset($config['delete_time'])) + { + set_config('delete_time', $config['edit_time']); + } + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 30acb90618..b582b8a8bd 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -90,6 +90,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1 INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 2673b4a1ed..8797a1210a 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -152,6 +152,8 @@ $lang = array_merge($lang, array( 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.', 'CHAR_LIMIT' => 'Maximum characters per post/message', 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.', + 'DELETE_TIME' => 'Limit deleting time', + 'DELETE_TIME_EXPLAIN' => 'Limits the time available to delete a new post. Setting the value to 0 disables this behaviour.', 'DISPLAY_LAST_EDITED' => 'Display last edited time information', 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.', 'EDIT_TIME' => 'Limit editing time', diff --git a/phpBB/posting.php b/phpBB/posting.php index 77a499db4b..b241da2eab 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1433,7 +1433,7 @@ $template->assign_vars(array( 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, - 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked']) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, @@ -1545,7 +1545,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) global $phpbb_root_path, $phpEx; // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'])) + if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) { $s_hidden_fields = build_hidden_fields(array( 'p' => $post_id, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eaa17279a2..e7522841e3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1476,7 +1476,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && - // we do not want to allowe removal of the last post if a moderator locked it! + ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && + // we do not want to allow removal of the last post if a moderator locked it! !$row['post_edit_locked'] )));