aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-12-29 13:46:42 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-12-29 13:46:42 +0100
commit382317b1352db90605d6555eaf2fbc4238c2d547 (patch)
treebfdf6980f9a19ad54842f5c50d210da5061ebab7 /phpBB/includes/functions_posting.php
parentac131a51592f5e45e5a555ae0ac04543d02f9c31 (diff)
parentdb94f80c5ba117ca410bb2aafa3ae5c02dcf11c8 (diff)
downloadforums-382317b1352db90605d6555eaf2fbc4238c2d547.tar
forums-382317b1352db90605d6555eaf2fbc4238c2d547.tar.gz
forums-382317b1352db90605d6555eaf2fbc4238c2d547.tar.bz2
forums-382317b1352db90605d6555eaf2fbc4238c2d547.tar.xz
forums-382317b1352db90605d6555eaf2fbc4238c2d547.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb into feature/passwords
Conflicts: phpBB/config/services.yml
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php38
1 files changed, 35 insertions, 3 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index ce1238d8e0..172f4403ac 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -385,8 +385,18 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
/**
* Upload Attachment - filedata is generated here
* Uses upload class
+*
+* @param string $form_name The form name of the file upload input
+* @param int $forum_id The id of the forum
+* @param bool $local Whether the file is local or not
+* @param string $local_storage The path to the local file
+* @param bool $is_message Whether it is a PM or not
+* @param \filespec $local_filedata A filespec object created for the local file
+* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used
+*
+* @return object filespec
*/
-function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
+function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
global $phpbb_root_path, $phpEx;
@@ -414,7 +424,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
- $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
+ $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name, $plupload);
if ($file->init_error)
{
@@ -469,6 +479,11 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
{
$file->remove();
+ if ($plupload && $plupload->is_active())
+ {
+ $plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE');
+ }
+
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
// Since the image category is displaying content inline we need to catch this.
trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
@@ -1458,7 +1473,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;
+ global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher;
// We do not handle erasing posts here
if ($mode == 'delete')
@@ -2290,6 +2305,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
$url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
+ /**
+ * This event is used for performing actions directly after a post or topic
+ * has been submitted. When a new topic is posted, the topic ID is
+ * available in the $data array.
+ *
+ * The only action that can be done by altering data made available to this
+ * event is to modify the return URL ($url).
+ *
+ * @event core.submit_post_end
+ * @var string url The "Return to topic" URL
+ * @var array data Array of post data about the
+ * submitted post
+ * @since 3.1-A3
+ */
+ $vars = array('url', 'data');
+ extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars)));
+
return $url;
}