mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Merge pull request #1583 from waskosky/master
New method to post forum attachment related data directly
This commit is contained in:
@@ -796,6 +796,13 @@ class forum_post_handler
|
|||||||
|
|
||||||
$postInfo['post_attachments'] = e107::serialize($newValues);
|
$postInfo['post_attachments'] = e107::serialize($newValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Allows directly overriding the method of adding files (or other data) as attachments
|
||||||
|
if($attachmentsPosted = $this->processAttachmentsPosted())
|
||||||
|
{
|
||||||
|
$postInfo['post_attachments'] = $attachmentsPosted;
|
||||||
|
}
|
||||||
|
|
||||||
// var_dump($uploadResult);
|
// var_dump($uploadResult);
|
||||||
|
|
||||||
switch($this->action)
|
switch($this->action)
|
||||||
@@ -1005,7 +1012,13 @@ class forum_post_handler
|
|||||||
$postVals['post_attachments'] = e107::serialize($newValues);
|
$postVals['post_attachments'] = e107::serialize($newValues);
|
||||||
// $postVals['post_attachments'] = implode(',', $attachments);
|
// $postVals['post_attachments'] = implode(',', $attachments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Allows directly overriding the method of adding files (or other data) as attachments
|
||||||
|
if($attachmentsPosted = $this->processAttachmentsPosted($this->data['post_attachments']))
|
||||||
|
{
|
||||||
|
$postVals['post_attachments'] = $attachmentsPosted;
|
||||||
|
}
|
||||||
|
|
||||||
$postVals['post_edit_datestamp'] = time();
|
$postVals['post_edit_datestamp'] = time();
|
||||||
$postVals['post_edit_user'] = USERID;
|
$postVals['post_edit_user'] = USERID;
|
||||||
$postVals['post_entry'] = $_POST['post'];
|
$postVals['post_entry'] = $_POST['post'];
|
||||||
@@ -1071,7 +1084,12 @@ class forum_post_handler
|
|||||||
|
|
||||||
$postVals['post_attachments'] = e107::serialize($newValues);
|
$postVals['post_attachments'] = e107::serialize($newValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Allows directly overriding the method of adding files (or other data) as attachments
|
||||||
|
if($attachmentsPosted = $this->processAttachmentsPosted($this->data['post_attachments']))
|
||||||
|
{
|
||||||
|
$postVals['post_attachments'] = $attachmentsPosted;
|
||||||
|
}
|
||||||
|
|
||||||
$this->forumObj->postUpdate($this->data['post_id'], $postVals);
|
$this->forumObj->postUpdate($this->data['post_id'], $postVals);
|
||||||
|
|
||||||
@@ -1223,6 +1241,31 @@ class forum_post_handler
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Allows directly overriding the method of adding files (or other data) as attachments
|
||||||
|
function processAttachmentsPosted($existingValues = '')
|
||||||
|
{
|
||||||
|
if(isset($_POST['post_attachments_json']) && trim($_POST['post_attachments_json']))
|
||||||
|
{
|
||||||
|
$postedAttachments = json_decode($_POST['post_attachments_json'], true);
|
||||||
|
$attachmentsJsonErrors = json_last_error();
|
||||||
|
if($attachmentsJsonErrors === JSON_ERROR_NONE)
|
||||||
|
{
|
||||||
|
if($existingValues)
|
||||||
|
{
|
||||||
|
$existingValues = e107::unserialize($existingValues);
|
||||||
|
return e107::serialize(array_merge_recursive($existingValues,$postedAttachments));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return e107::serialize($postedAttachments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user