aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-06-18 15:12:32 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-06-18 16:56:29 +0200
commit73c69cc6536b189ca29494ca6e550e0432f419b3 (patch)
treec6565cf328dfcae4c1ba8a0a167b8fcfb8328a5c /phpBB
parent5964ca21c2b938702413a703a66d09245371d662 (diff)
downloadforums-73c69cc6536b189ca29494ca6e550e0432f419b3.tar
forums-73c69cc6536b189ca29494ca6e550e0432f419b3.tar.gz
forums-73c69cc6536b189ca29494ca6e550e0432f419b3.tar.bz2
forums-73c69cc6536b189ca29494ca6e550e0432f419b3.tar.xz
forums-73c69cc6536b189ca29494ca6e550e0432f419b3.zip
[ticket/12612] Move functions from posting.php to functions_posting.php
PHPBB3-12612
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_posting.php134
-rw-r--r--phpBB/posting.php134
2 files changed, 134 insertions, 134 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index d4e7fecbff..23fdd809e2 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2485,3 +2485,137 @@ function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
return $url;
}
+
+/**
+* Show upload popup (progress bar)
+*/
+function upload_popup($forum_style = 0)
+{
+ global $template, $user;
+
+ ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting');
+
+ page_header($user->lang['PROGRESS_BAR']);
+
+ $template->set_filenames(array(
+ 'popup' => 'posting_progress_bar.html')
+ );
+
+ $template->assign_vars(array(
+ 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS']))
+ );
+
+ $template->display('popup');
+
+ garbage_collection();
+ exit_handler();
+}
+
+/**
+* Do the various checks required for removing posts as well as removing it
+*/
+function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '')
+{
+ global $user, $db, $auth, $config, $request;
+ global $phpbb_root_path, $phpEx;
+
+ $perm_check = ($is_soft) ? 'softdelete' : 'delete';
+
+ // If moderator removing post or user itself removing post, present a confirmation screen
+ if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $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 = array(
+ 'p' => $post_id,
+ 'f' => $forum_id,
+ 'mode' => ($is_soft) ? 'soft_delete' : 'delete',
+ );
+
+ if (confirm_box(true))
+ {
+ $data = array(
+ 'topic_first_post_id' => $post_data['topic_first_post_id'],
+ 'topic_last_post_id' => $post_data['topic_last_post_id'],
+ 'topic_posts_approved' => $post_data['topic_posts_approved'],
+ 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'],
+ 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'],
+ 'topic_visibility' => $post_data['topic_visibility'],
+ 'topic_type' => $post_data['topic_type'],
+ 'post_visibility' => $post_data['post_visibility'],
+ 'post_reported' => $post_data['post_reported'],
+ 'post_time' => $post_data['post_time'],
+ 'poster_id' => $post_data['poster_id'],
+ 'post_postcount' => $post_data['post_postcount'],
+ );
+
+ $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason);
+ $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username'];
+
+ if ($next_post_id === false)
+ {
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_delete_reason);
+
+ $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
+ $message = $user->lang['POST_DELETED'];
+ }
+ else
+ {
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_delete_reason);
+
+ $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id") . "#p$next_post_id";
+ $message = $user->lang['POST_DELETED'];
+
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>');
+ }
+ }
+
+ meta_refresh(3, $meta_info);
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');
+ }
+ trigger_error($message);
+ }
+ else
+ {
+ global $user, $template, $request;
+
+ $can_delete = $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));
+ $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id));
+
+ $template->assign_vars(array(
+ 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
+ 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '',
+ 'S_ALLOWED_DELETE' => $can_delete,
+ 'S_ALLOWED_SOFTDELETE' => $can_softdelete,
+ ));
+
+ $l_confirm = 'DELETE_POST';
+ if ($post_data['post_visibility'] == ITEM_DELETED)
+ {
+ $l_confirm .= '_PERMANENTLY';
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+ else if (!$can_softdelete)
+ {
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+
+ confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
+ }
+ }
+
+ // If we are here the user is not able to delete - present the correct error message
+ if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id))
+ {
+ trigger_error('DELETE_OWN_POSTS');
+ }
+
+ if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id'])
+ {
+ trigger_error('CANNOT_DELETE_REPLIED');
+ }
+
+ trigger_error('USER_CANNOT_DELETE');
+}
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 60bb595da6..44e5851319 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1714,137 +1714,3 @@ if ($mode == 'reply' || $mode == 'quote')
}
page_footer();
-
-/**
-* Show upload popup (progress bar)
-*/
-function upload_popup($forum_style = 0)
-{
- global $template, $user;
-
- ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting');
-
- page_header($user->lang['PROGRESS_BAR']);
-
- $template->set_filenames(array(
- 'popup' => 'posting_progress_bar.html')
- );
-
- $template->assign_vars(array(
- 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS']))
- );
-
- $template->display('popup');
-
- garbage_collection();
- exit_handler();
-}
-
-/**
-* Do the various checks required for removing posts as well as removing it
-*/
-function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '')
-{
- global $user, $db, $auth, $config, $request;
- global $phpbb_root_path, $phpEx;
-
- $perm_check = ($is_soft) ? 'softdelete' : 'delete';
-
- // If moderator removing post or user itself removing post, present a confirmation screen
- if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $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 = array(
- 'p' => $post_id,
- 'f' => $forum_id,
- 'mode' => ($is_soft) ? 'soft_delete' : 'delete',
- );
-
- if (confirm_box(true))
- {
- $data = array(
- 'topic_first_post_id' => $post_data['topic_first_post_id'],
- 'topic_last_post_id' => $post_data['topic_last_post_id'],
- 'topic_posts_approved' => $post_data['topic_posts_approved'],
- 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'],
- 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'],
- 'topic_visibility' => $post_data['topic_visibility'],
- 'topic_type' => $post_data['topic_type'],
- 'post_visibility' => $post_data['post_visibility'],
- 'post_reported' => $post_data['post_reported'],
- 'post_time' => $post_data['post_time'],
- 'poster_id' => $post_data['poster_id'],
- 'post_postcount' => $post_data['post_postcount'],
- );
-
- $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason);
- $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username'];
-
- if ($next_post_id === false)
- {
- add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_delete_reason);
-
- $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
- $message = $user->lang['POST_DELETED'];
- }
- else
- {
- add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_delete_reason);
-
- $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id") . "#p$next_post_id";
- $message = $user->lang['POST_DELETED'];
-
- if (!$request->is_ajax())
- {
- $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>');
- }
- }
-
- meta_refresh(3, $meta_info);
- if (!$request->is_ajax())
- {
- $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');
- }
- trigger_error($message);
- }
- else
- {
- global $user, $template, $request;
-
- $can_delete = $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));
- $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id));
-
- $template->assign_vars(array(
- 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
- 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '',
- 'S_ALLOWED_DELETE' => $can_delete,
- 'S_ALLOWED_SOFTDELETE' => $can_softdelete,
- ));
-
- $l_confirm = 'DELETE_POST';
- if ($post_data['post_visibility'] == ITEM_DELETED)
- {
- $l_confirm .= '_PERMANENTLY';
- $s_hidden_fields['delete_permanent'] = '1';
- }
- else if (!$can_softdelete)
- {
- $s_hidden_fields['delete_permanent'] = '1';
- }
-
- confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
- }
- }
-
- // If we are here the user is not able to delete - present the correct error message
- if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id))
- {
- trigger_error('DELETE_OWN_POSTS');
- }
-
- if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id'])
- {
- trigger_error('CANNOT_DELETE_REPLIED');
- }
-
- trigger_error('USER_CANNOT_DELETE');
-}