Commit fa85e769 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Check republish permission when viewing any block containing artefacts

parent fd1c01ff
......@@ -61,7 +61,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
$result = '';
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$blog = artefact_instance_from_id($configdata['artefactid']);
$blog = $instance->get_artefact_instance($configdata['artefactid']);
$configdata['hidetitle'] = true;
$configdata['viewid'] = $instance->get('view');
$result = $blog->render_self($configdata);
......
......@@ -61,7 +61,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
$result = '';
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$blogpost = artefact_instance_from_id($configdata['artefactid']);
$blogpost = $instance->get_artefact_instance($configdata['artefactid']);
$configdata['hidetitle'] = true;
$configdata['viewid'] = $instance->get('view');
$result = $blogpost->render_self($configdata);
......
......@@ -47,7 +47,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
$result = '';
if (isset($configdata['artefactids']) && is_array($configdata['artefactids'])) {
foreach ($configdata['artefactids'] as $artefactid) {
$artefact = artefact_instance_from_id($artefactid);
$artefact = $instance->get_artefact_instance($artefactid);
$icondata = array(
'id' => $artefactid,
......
......@@ -65,7 +65,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
// render_self
$result = '';
if (isset($configdata['artefactid'])) {
$folder = artefact_instance_from_id($configdata['artefactid']);
$folder = $instance->get_artefact_instance($configdata['artefactid']);
$result = $folder->render_self($configdata);
$result = $result['html'];
}
......
......@@ -41,7 +41,6 @@ class PluginBlocktypeImage extends PluginBlocktype {
}
public static function render_instance(BlockInstance $instance) {
//require_once(get_config('docroot') . 'artefact/lib.php');
$configdata = $instance->get('configdata'); // this will make sure to unserialize it for us
$configdata['viewid'] = $instance->get('view');
......@@ -49,7 +48,6 @@ class PluginBlocktypeImage extends PluginBlocktype {
// render_self
$result = '';
if (isset($configdata['artefactid'])) {
//$image = artefact_instance_from_id($configdata['artefactid']);
$image = $instance->get_artefact_instance($configdata['artefactid']);
if ($image instanceof ArtefactTypeProfileIcon) {
......
......@@ -63,7 +63,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
}
$result = self::get_js_source();
require_once(get_config('docroot') . 'artefact/lib.php');
$artefact = artefact_instance_from_id($configdata['artefactid']);
$artefact = $instance->get_artefact_instance($configdata['artefactid']);
$width = (!empty($configdata['width'])) ? hsc($configdata['width']) : '300';
$height = (!empty($configdata['height'])) ? hsc($configdata['height']) : '300';
$extn = strtolower($artefact->get('oldextension'));
......
......@@ -55,7 +55,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
WHERE va.view = ?
AND va.block = ?', array($instance->get('view'), $instance->get('id')))) {
foreach ($artefacts as $artefact) {
$resumefield = artefact_instance_from_id($artefact->artefact);
$resumefield = $instance->get_artefact_instance($artefact->artefact);
$rendered = $resumefield->render_self(array('viewid' => $instance->get('view')));
$result = $rendered['html'];
if (!empty($rendered['javascript'])) {
......
......@@ -63,7 +63,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
// Get data about the resume field in this blockinstance
if (!empty($configdata['artefactid'])) {
$resumefield = artefact_instance_from_id($configdata['artefactid']);
$resumefield = $instance->get_artefact_instance($configdata['artefactid']);
$rendered = $resumefield->render_self($configdata);
$result = $rendered['html'];
if (!empty($rendered['javascript'])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment