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
febfcabb
Commit
febfcabb
authored
Oct 20, 2016
by
Robert Lyon
Committed by
Gerrit Code Review
Oct 20, 2016
Browse files
Merge "Bug 1631795: Made image in a wallpost public"
parents
7f80c859
d598dc1b
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/download.php
View file @
febfcabb
...
...
@@ -170,7 +170,7 @@ serve_file($path, $title, $file->get('filetype'), $options);
/**
* Check if the image is embedded in an artefact of type:
* comment, annotation, annotationfeedback, blog, textbox, editnote, text.
* comment, annotation, annotationfeedback, blog, textbox, editnote, text
, wallpost
.
* Please check first that the fileid is of type ArtefactTypeImage and that the download
* is called with the embedded flag set.
*
...
...
@@ -183,7 +183,7 @@ function check_is_embedded_image_visible($fileid, $includeresourcetypes = null,
$isvisible
=
false
;
// Check for resource types a file may be embeded in.
$resourcetypes
=
array
(
'comment'
,
'annotation'
,
'annotationfeedback'
,
'blog'
,
'textbox'
,
'editnote'
,
'text'
,
'introtext'
'comment'
,
'annotation'
,
'annotationfeedback'
,
'blog'
,
'textbox'
,
'editnote'
,
'text'
,
'introtext'
,
'wallpost'
);
if
(
!
empty
(
$includeresourcetypes
))
{
if
(
!
is_array
(
$includeresourcetypes
))
{
...
...
htdocs/blocktype/wall/db/upgrade.php
View file @
febfcabb
...
...
@@ -16,5 +16,21 @@ function xmldb_blocktype_wall_upgrade($oldversion=0) {
if
(
$oldversion
<
2009021801
)
{
set_config_plugin
(
'blocktype'
,
'wall'
,
'defaultpostsizelimit'
,
1500
);
// 1500 characters
}
if
(
$oldversion
<
2016101700
)
{
$posts
=
get_records_select_array
(
'blocktype_wall_post'
,
"text LIKE '%artefact/file/download.php%'"
);
require_once
(
'embeddedimage.php'
);
foreach
(
$posts
as
$post
)
{
$newtext
=
EmbeddedImage
::
prepare_embedded_images
(
$post
->
text
,
'wallpost'
,
$post
->
id
,
null
,
$post
->
from
);
if
(
$post
->
text
!=
$newtext
)
{
$updatedwallpost
=
new
stdClass
();
$updatedwallpost
->
id
=
$post
->
id
;
$updatedwallpost
->
text
=
$newtext
;
update_record
(
'blocktype_wall_post'
,
$updatedwallpost
,
'id'
);
}
}
}
return
true
;
}
htdocs/blocktype/wall/deletepost.php
View file @
febfcabb
...
...
@@ -53,6 +53,10 @@ $form = pieform(array(
function
deletepost_submit
(
Pieform
$form
,
$values
)
{
global
$SESSION
,
$postid
,
$goto
;
delete_records
(
'blocktype_wall_post'
,
'id'
,
$postid
);
require_once
(
'embeddedimage.php'
);
EmbeddedImage
::
remove_embedded_images
(
'wallpost'
,
$postid
);
$SESSION
->
add_ok_msg
(
get_string
(
'deletepostsuccess'
,
'blocktype.wall'
));
redirect
(
$goto
);
}
...
...
htdocs/blocktype/wall/lib.php
View file @
febfcabb
...
...
@@ -234,7 +234,18 @@ EOF;
'text'
=>
$values
[
'text'
],
);
insert_record
(
'blocktype_wall_post'
,
$record
);
$newid
=
insert_record
(
'blocktype_wall_post'
,
$record
,
'id'
,
true
);
require_once
(
'embeddedimage.php'
);
$newtext
=
EmbeddedImage
::
prepare_embedded_images
(
$values
[
'text'
],
'wallpost'
,
$newid
);
// If there is an embedded image, update the src so users can have visibility
if
(
$values
[
'text'
]
!=
$newtext
)
{
$updatedwallpost
=
new
stdClass
();
$updatedwallpost
->
id
=
$newid
;
$updatedwallpost
->
text
=
$newtext
;
update_record
(
'blocktype_wall_post'
,
$updatedwallpost
,
'id'
);
}
activity_occurred
(
'wallpost'
,
$record
,
'blocktype'
,
'wall'
);
$instance
=
new
BlockInstance
(
$values
[
'instance'
]);
...
...
htdocs/blocktype/wall/version.php
View file @
febfcabb
...
...
@@ -12,5 +12,5 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
201601
14
00
;
$config
->
release
=
'1.
1
.0'
;
$config
->
version
=
2016
1
01
7
00
;
$config
->
release
=
'1.
2
.0'
;
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