aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php72
1 files changed, 53 insertions, 19 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index a06d6f4c35..4233395574 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -24,12 +24,13 @@ if (!defined('IN_PHPBB'))
*/
function generate_smilies($mode, $forum_id)
{
- global $db, $user, $config, $template, $phpbb_dispatcher;
+ global $db, $user, $config, $template, $phpbb_dispatcher, $request;
global $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_path_helper;
- $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id);
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
- $start = request_var('start', 0);
+ $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id);
+ $start = $request->variable('start', 0);
if ($mode == 'window')
{
@@ -406,14 +407,14 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
- global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
+ global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_filesystem;
$filedata = array(
'error' => array()
);
include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx);
- $upload = new fileupload();
+ $upload = new fileupload($phpbb_filesystem);
if ($config['check_attachment_content'] && isset($config['mime_triggers']))
{
@@ -667,7 +668,7 @@ function get_supported_image_types($type = false)
*/
function create_thumbnail($source, $destination, $mimetype)
{
- global $config;
+ global $config, $phpbb_filesystem;
$min_filesize = (int) $config['img_min_thumb_filesize'];
$img_filesize = (file_exists($source)) ? @filesize($source) : false;
@@ -819,7 +820,14 @@ function create_thumbnail($source, $destination, $mimetype)
return false;
}
- phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE);
+ try
+ {
+ $this->filesystem->phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE);
+ }
+ catch (\phpbb\filesystem\exception\filesystem_exception $e)
+ {
+ // Do nothing
+ }
return true;
}
@@ -1039,6 +1047,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
global $user, $auth, $db, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC';
@@ -1295,6 +1304,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
$db->sql_freeresult($result);
}
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
// (Soft) delete the post
@@ -1508,7 +1518,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
*/
function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true)
{
- global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher;
+ global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
/**
* Modify the data for post submitting
@@ -1681,7 +1691,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($user->data['user_id'] != $poster_id)
{
$log_subject = ($subject) ? $subject : $data['topic_title'];
- add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST'], $data['post_edit_reason']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_EDITED', false, array(
+ 'forum_id' => $data['forum_id'],
+ 'topic_id' => $data['topic_id'],
+ $log_subject,
+ (!empty($username)) ? $username : $user->lang['GUEST'],
+ $data['post_edit_reason']
+ ));
}
if (!isset($sql_data[POSTS_TABLE]['sql']))
@@ -1919,9 +1935,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
if ($post_mode == 'post')
{
- set_config_count('num_topics', 1, true);
+ $config->increment('num_topics', 1, false);
}
- set_config_count('num_posts', 1, true);
+ $config->increment('num_posts', 1, false);
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
@@ -2094,8 +2110,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($space_taken && $files_added)
{
- set_config_count('upload_dir_size', $space_taken, true);
- set_config_count('num_files', $files_added, true);
+ $config->increment('upload_dir_size', $space_taken, false);
+ $config->increment('num_files', $files_added, false);
}
}
@@ -2113,6 +2129,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
$is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
}
@@ -2188,7 +2205,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$db->sql_transaction('commit');
// Delete draft if post was loaded...
- $draft_id = request_var('draft_loaded', 0);
+ $draft_id = $request->variable('draft_loaded', 0);
if ($draft_id)
{
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "
@@ -2291,6 +2308,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'post_subject' => $subject,
));
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
if ($post_visibility == ITEM_APPROVED)
@@ -2469,7 +2487,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
*/
function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
{
- global $config, $db, $user, $phpEx, $phpbb_root_path;
+ global $config, $db, $user, $phpEx, $phpbb_root_path, $phpbb_log;
if ($bump_time === false)
{
@@ -2548,7 +2566,11 @@ function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false);
}
- add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_BUMP_TOPIC', false, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ $post_data['topic_title']
+ ));
$url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";
@@ -2586,7 +2608,7 @@ function phpbb_upload_popup($forum_style = 0)
function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '')
{
global $user, $auth, $config, $request;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx, $phpbb_log;
$perm_check = ($is_soft) ? 'softdelete' : 'delete';
@@ -2621,14 +2643,26 @@ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $
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, $delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), false, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ $post_data['topic_title'],
+ $post_username,
+ $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, $delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), false, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ $post_data['post_subject'],
+ $post_username,
+ $delete_reason
+ ));
$meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id";
$message = $user->lang['POST_DELETED'];