Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
11109d1c
Commit
11109d1c
authored
Jan 09, 2007
by
Richard Mansfield
Browse files
Create blogfiles folder in blogpost class
parent
f17a9e6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/lib.php
View file @
11109d1c
...
...
@@ -581,6 +581,13 @@ class ArtefactTypeBlogPost extends ArtefactType {
* Save a temporary uploaded file to the myfiles area.
*/
public
function
save_attachment
(
$directory
,
$filename
,
$title
,
$description
)
{
// Create the blogfiles folder if it doesn't exist yet.
$blogfilesid
=
self
::
blogfiles_folder_id
();
if
(
!
$blogfilesid
)
{
return
false
;
}
global
$USER
;
safe_require
(
'artefact'
,
'file'
);
...
...
@@ -590,7 +597,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
$data
->
description
=
$description
;
$data
->
owner
=
$USER
->
get
(
'id'
);
$data
->
adminfiles
=
0
;
// No admin blogs yet...
$data
->
parent
=
self
::
blogfiles
_folder_id
()
;
$data
->
parent
=
$
blogfiles
id
;
$path
=
self
::
$blogattachmentroot
.
$directory
.
'/'
.
$filename
;
...
...
htdocs/artefact/blog/saveblogpost.json.php
View file @
11109d1c
...
...
@@ -92,14 +92,6 @@ foreach ($artefacts as $a) {
// Add the newly uploaded files to myfiles and then to the blog post.
if
(
!
empty
(
$uploads
))
{
// Create the blogfiles folder if it doesn't exist yet.
$blogfilesid
=
ArtefactTypeBlogPost
::
blogfiles_folder_id
();
if
(
!
$blogfilesid
)
{
json_reply
(
'local'
,
get_string
(
'erroraccessingblogfilesfolder'
,
'artefact.blog'
));
}
// Turn all the uploaded files into artefacts.
foreach
(
$uploads
as
$upload
)
{
if
(
!
$postobj
->
save_attachment
(
session_id
()
.
$createid
,
$upload
->
id
,
$upload
->
title
,
$upload
->
description
))
{
...
...
@@ -108,8 +100,6 @@ if (!empty($uploads)) {
}
}
json_reply
(
false
,
get_string
(
'blogpostsaved'
,
'artefact.blog'
));
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment