Commit 21d5712f authored by Aaron Wells's avatar Aaron Wells
Browse files

Removing end-of-line whitespace

As vetted in the May 2014 dev meeting
http://meetbot.mahara.org/mahara-dev/2014/mahara-dev.2014-05-01-08.01.log.html

Change-Id: I353ed74d69a5346fbe4e8e521e5c349dbe8dcbac
parent e46afb22
......@@ -18,7 +18,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
}
/**
* Optional method. If exists, allows this class to decide the title for
* Optional method. If exists, allows this class to decide the title for
* all blockinstances of this type
*/
public static function get_instance_title(BlockInstance $bi) {
......@@ -118,13 +118,13 @@ class PluginBlocktypeBlog extends PluginBlocktype {
$elements = array();
// If the blog in this block is owned by the owner of the View, then
// the block can be configured. Otherwise, the blog was copied in from
// another View. We won't confuse users by asking them to choose a blog
// to put in this block, when the one that is currently in it isn't
// If the blog in this block is owned by the owner of the View, then
// the block can be configured. Otherwise, the blog was copied in from
// another View. We won't confuse users by asking them to choose a blog
// to put in this block, when the one that is currently in it isn't
// choosable.
//
// Note: the owner check will have to change when we do group/site
// Note: the owner check will have to change when we do group/site
// blogs
if (empty($configdata['artefactid']) || $blog->get('owner') == $USER->get('id')) {
$elements[] = self::artefactchooser_element((isset($configdata['artefactid'])) ? $configdata['artefactid'] : null);
......@@ -150,13 +150,13 @@ class PluginBlocktypeBlog extends PluginBlocktype {
* Returns a list of artefact IDs that are in this blockinstance.
*
* {@internal{Because links to artefacts within blogposts don't count
* as making those artefacts 'children' of the blog post, we have to add
* as making those artefacts 'children' of the blog post, we have to add
* them directly to the blog.}}
*
* @return array List of artefact IDs that are 'in' this blog - all
* blogposts in it plus all links to other artefacts that are
* part of the blogpost text. Note that proper artefact
* children, such as blog post attachments, aren't included -
* @return array List of artefact IDs that are 'in' this blog - all
* blogposts in it plus all links to other artefacts that are
* part of the blogpost text. Note that proper artefact
* children, such as blog post attachments, aren't included -
* the artefact parent cache is used for them
* @see PluginBlocktypeBlogPost::get_artefacts()
*/
......@@ -166,10 +166,10 @@ class PluginBlocktypeBlog extends PluginBlocktype {
if (isset($configdata['artefactid'])) {
$artefacts[] = $configdata['artefactid'];
// Artefacts that are linked to directly in blog post text aren't
// strictly children of blog posts, which means that
// artefact_in_view won't understand that they are "within the
// blog". We have to help it here directly by working out what
// Artefacts that are linked to directly in blog post text aren't
// strictly children of blog posts, which means that
// artefact_in_view won't understand that they are "within the
// blog". We have to help it here directly by working out what
// artefacts are linked to in all of this blog's blog posts.
$blog = $instance->get_artefact_instance($configdata['artefactid']);
if ($blogposts = $blog->get_children_instances()) {
......@@ -197,7 +197,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
//public static function artefactchooser_get_element_data($artefact) {
......@@ -223,7 +223,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
}
/**
* Blog blocktype is only allowed in personal views, because currently
* Blog blocktype is only allowed in personal views, because currently
* there's no such thing as group/site blogs
*/
public static function allowed_in_view(View $view) {
......
......@@ -18,7 +18,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
}
/**
* Optional method. If exists, allows this class to decide the title for
* Optional method. If exists, allows this class to decide the title for
* all blockinstances of this type
*/
public static function get_instance_title(BlockInstance $bi) {
......@@ -58,17 +58,17 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
/**
* Returns a list of artefact IDs that are in this blockinstance.
*
* Normally this would just include the blogpost ID itself (children such
* as attachments don't need to be included here, they're handled by the
* artefact parent cache). But people might just link to artefacts without
* using the attachment facility. There's nothing wrong with them doing
* that, so if they do we should scrape the post looking for such links and
* Normally this would just include the blogpost ID itself (children such
* as attachments don't need to be included here, they're handled by the
* artefact parent cache). But people might just link to artefacts without
* using the attachment facility. There's nothing wrong with them doing
* that, so if they do we should scrape the post looking for such links and
* include those artefacts as being part of this blockinstance.
*
* @return array List of artefact IDs that are 'in' this blogpost - all
* the blogpost ID plus links to other artefacts that are
* part of the blogpost text. Note that proper artefact
* children, such as blog post attachments, aren't included -
* @return array List of artefact IDs that are 'in' this blogpost - all
* the blogpost ID plus links to other artefacts that are
* part of the blogpost text. Note that proper artefact
* children, such as blog post attachments, aren't included -
* the artefact parent cache is used for them
* @see PluginBlocktypeBlog::get_artefacts()
*/
......@@ -100,13 +100,13 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
$elements = array();
// If the blog post in this block is owned by the owner of the View,
// then the block can be configured. Otherwise, the blog post was
// copied in from another View. We won't confuse users by asking them to
// choose a blog post to put in this block, when the one that is
// If the blog post in this block is owned by the owner of the View,
// then the block can be configured. Otherwise, the blog post was
// copied in from another View. We won't confuse users by asking them to
// choose a blog post to put in this block, when the one that is
// currently in it isn't choosable.
//
// Note: the owner check will have to change when we do group/site
// Note: the owner check will have to change when we do group/site
// blogs
if (empty($configdata['artefactid']) || $blog->get('owner') == $USER->get('id')) {
$elements[] = self::artefactchooser_element((isset($configdata['artefactid'])) ? $configdata['artefactid'] : null);
......@@ -138,7 +138,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
public static function artefactchooser_get_element_data($artefact) {
......@@ -168,7 +168,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
}
/**
* Blogpost blocktype is only allowed in personal views, because currently
* Blogpost blocktype is only allowed in personal views, because currently
* there's no such thing as group/site blogs
*/
public static function allowed_in_view(View $view) {
......
......@@ -128,7 +128,7 @@ class PluginBlocktypeRecentposts extends PluginBlocktype {
}
/**
* Recentposts blocktype is only allowed in personal views, because
* Recentposts blocktype is only allowed in personal views, because
* currently there's no such thing as group/site blogs
*/
public static function allowed_in_view(View $view) {
......
......@@ -12,7 +12,7 @@
defined('INTERNAL') || die();
function xmldb_artefact_blog_upgrade($oldversion=0) {
// There was no database prior to this version.
if ($oldversion < 2006120501) {
install_from_xmldb_file(
......@@ -26,7 +26,7 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
$table->addFieldInfo('file', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('when', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
$table->addKeyInfo('blogpost_file_pending_pk', XMLDB_KEY_PRIMARY, array('file'));
$table->addKeyInfo('filefk', XMLDB_KEY_FOREIGN, array('file'), 'artefact', array('id'));
......@@ -36,11 +36,11 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
}
if ($oldversion < 2008012200) {
// From 0.9, some files were not having their temporary download paths
// translated to proper artefact/file/download.php paths. This upgrade
// attempts to fix them. It should work in the vast majority of cases,
// the largest assumption made is that artefacts were inserted in
// ascending ID order when the post was created, which is a pretty safe
// From 0.9, some files were not having their temporary download paths
// translated to proper artefact/file/download.php paths. This upgrade
// attempts to fix them. It should work in the vast majority of cases,
// the largest assumption made is that artefacts were inserted in
// ascending ID order when the post was created, which is a pretty safe
// bet.
if ($blogfiles = get_records_array('artefact_blog_blogpost_file', '', '', 'blogpost ASC, file ASC')) {
$blogpostids = join(', ', array_map(create_function('$a', 'return $a->blogpost;'), $blogfiles));
......@@ -85,13 +85,13 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
execute_sql('DROP INDEX {arteblogblog_blo2_ix} ON {artefact_blog_blogpost}');
execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} (blogpost)');
execute_sql('ALTER TABLE {artefact_blog_blogpost} DROP FOREIGN KEY {arteblogblog_blo2_fk}');
// I can't quite get mysql to name this key correctly, so there
// will be a difference in the database if you upgrade from 0.9
// I can't quite get mysql to name this key correctly, so there
// will be a difference in the database if you upgrade from 0.9
// compared with installing from 1.0
execute_sql('ALTER TABLE {artefact_blog_blogpost} ADD FOREIGN KEY (blogpost) REFERENCES {artefact} (id)');
}
else {
// Rename indexes to keep things the same regardless of whether the
// Rename indexes to keep things the same regardless of whether the
// user installed or upgraded to this release
execute_sql('DROP INDEX {arteblogblog_blo2_ix}');
execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} USING btree (blogpost)');
......
......@@ -11,7 +11,7 @@
defined('INTERNAL') || die();
/**
/**
* Users can create blogs and blog posts using this plugin.
*/
class PluginArtefactBlog extends PluginArtefact {
......@@ -22,7 +22,7 @@ class PluginArtefactBlog extends PluginArtefact {
'blogpost',
);
}
public static function get_block_types() {
return array();
}
......@@ -146,10 +146,10 @@ class ArtefactTypeBlog extends ArtefactType {
if (empty($this->dirty)) {
return;
}
// We need to keep track of newness before and after.
$new = empty($this->id);
// Commit to the artefact table.
parent::commit();
......@@ -170,9 +170,9 @@ class ArtefactTypeBlog extends ArtefactType {
}
/**
* Checks that the person viewing this blog is the owner. If not, throws an
* AccessDeniedException. Used in the blog section to ensure only the
* owners of the blogs can view or change them there. Other people see
* Checks that the person viewing this blog is the owner. If not, throws an
* AccessDeniedException. Used in the blog section to ensure only the
* owners of the blogs can view or change them there. Other people see
* blogs when they are placed in views.
*/
public function check_permission() {
......@@ -255,7 +255,7 @@ class ArtefactTypeBlog extends ArtefactType {
return array('html' => $smarty->fetch('artefact:blog:blog.tpl'), 'javascript' => '');
}
public static function get_icon($options=null) {
global $THEME;
return $THEME->get_url('images/journal.png', false);
......@@ -383,7 +383,7 @@ class ArtefactTypeBlog extends ArtefactType {
/**
* Returns the number of posts in this blog that have been published.
*
* The result of this function looked up from the database each time, so
* The result of this function looked up from the database each time, so
* cache it if you know it's safe to do so.
*
* @return int
......@@ -518,9 +518,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
* This method extends ArtefactType::commit() by adding additional data
* into the artefact_blog_blogpost table.
*
* This method also works out what blockinstances this blogpost is in, and
* This method also works out what blockinstances this blogpost is in, and
* informs them that they should re-check what artefacts they have in them.
* The post content may now link to different artefacts. See {@link
* The post content may now link to different artefacts. See {@link
* PluginBlocktypeBlogPost::get_artefacts for more information}
*/
public function commit() {
......@@ -530,7 +530,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
db_begin();
$new = empty($this->id);
parent::commit();
$this->dirty = true;
......@@ -551,8 +551,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
// 1) All blogpost blocktypes with this post in it
// 2) All blog blocktypes with this posts's blog in it
//
// With these, we tell them to rebuild what artefacts they have in them,
// since the post content could have changed and now have links to
// With these, we tell them to rebuild what artefacts they have in them,
// since the post content could have changed and now have links to
// different artefacts in it
$blockinstanceids = (array)get_column_sql('SELECT block
FROM {view_artefact}
......@@ -582,7 +582,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
db_begin();
$this->detach(); // Detach all file attachments
delete_records('artefact_blog_blogpost', 'blogpost', $this->id);
parent::delete();
db_commit();
}
......@@ -602,9 +602,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
/**
* Checks that the person viewing this blog is the owner. If not, throws an
* AccessDeniedException. Used in the blog section to ensure only the
* owners of the blogs can view or change them there. Other people see
* Checks that the person viewing this blog is the owner. If not, throws an
* AccessDeniedException. Used in the blog section to ensure only the
* owners of the blogs can view or change them there. Other people see
* blogs when they are placed in views.
*/
public function check_permission() {
......@@ -613,7 +613,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
throw new AccessDeniedException(get_string('youarenottheownerofthisblogpost', 'artefact.blog'));
}
}
public function describe_size() {
return $this->count_attachments() . ' ' . get_string('attachments', 'artefact.blog');
}
......@@ -872,7 +872,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
}
/**
/**
/**
* This function creates a new blog post.
*
......@@ -890,7 +890,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
return true;
}
/**
/**
* This function updates an existing blog post.
*
* @param User
......@@ -1076,7 +1076,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
/**
* Looks through the blog post text for links to download artefacts, and
* Looks through the blog post text for links to download artefacts, and
* returns the IDs of those artefacts.
*/
public function get_referenced_artefacts_from_postbody() {
......
......@@ -24,7 +24,7 @@ safe_require('artefact', 'file');
if (!PluginArtefactBlog::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog','artefact.blog')));
}
/*
/*
* For a new post, the 'blog' parameter will be set to the blog's
* artefact id. For an existing post, the 'blogpost' parameter will
* be set to the blogpost's artefact id.
......@@ -37,8 +37,8 @@ if (!$blogpost) {
$tagselect = param_variable('tagselect', '');
$blog = param_integer('blog');
if (!get_record('artefact', 'id', $blog, 'owner', $USER->get('id'))) {
// Blog security is also checked closer to when blogs are added, this
// check ensures that malicious users do not even see the screen for
// Blog security is also checked closer to when blogs are added, this
// check ensures that malicious users do not even see the screen for
// adding a post to a blog that is not theirs
throw new AccessDeniedException(get_string('youarenottheownerofthisblog', 'artefact.blog'));
}
......@@ -201,7 +201,7 @@ $smarty->display('artefact:blog:editpost.tpl');
/**
/**
* This function get called to cancel the form submission. It returns to the
* blog list.
*/
......
......@@ -101,7 +101,7 @@ exit;
*/
function editblog_submit(Pieform $form, $values) {
global $USER;
ArtefactTypeBlog::edit_blog($USER, $values);
redirect('/artefact/blog/view/index.php?id=' . $values['id']);
......
......@@ -101,7 +101,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
public static function artefactchooser_get_element_data($artefact) {
......
......@@ -18,7 +18,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
}
/**
* Optional method. If exists, allows this class to decide the title for
* Optional method. If exists, allows this class to decide the title for
* all blockinstances of this type
*/
public static function get_instance_title(BlockInstance $bi) {
......@@ -44,7 +44,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
$configdata['viewid'] = $instance->get('view');
$configdata['simpledisplay'] = true;
// This can be either an image or profileicon. They both implement
// This can be either an image or profileicon. They both implement
// render_self
$result = '';
if (isset($configdata['artefactid'])) {
......@@ -148,7 +148,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
public static function artefactchooser_get_element_data($artefact) {
......
......@@ -112,7 +112,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
public static function artefactchooser_get_element_data($artefact) {
......
......@@ -53,7 +53,7 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
foreach ($folderids as $folderid) {
if (!isset($this->artefactdata[$folderid])) {
$artefact = artefact_instance_from_id($folderid);
// We grabbed all parents of the artefacts in the export,
// We grabbed all parents of the artefacts in the export,
// but not all parents are folders
if ($artefact->get('artefacttype') == 'folder') {
$this->artefactdata[$folderid] = $artefact;
......@@ -126,11 +126,11 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
}
/**
* Given a filesystem directory and the id of an artefact, fill the
* filesystem directory with the files and folders that Mahara considers
* Given a filesystem directory and the id of an artefact, fill the
* filesystem directory with the files and folders that Mahara considers
* are inside the artefact.
*
* This method is recursive, creating the file/directory structure for all
* This method is recursive, creating the file/directory structure for all
* directories under the one passed.
*
* This method also creates index.htmls in each directory created.
......@@ -160,13 +160,13 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
}
/**
* Given a filesystem directory and the artefact data corresponding to that
* Given a filesystem directory and the artefact data corresponding to that
* directory, creates an index.html for it.
*
* @param string $filesystemdirectory The file system directory to make the
* @param string $filesystemdirectory The file system directory to make the
* index.html inside
* @param int $level How deep this directory index is
* @param object $artefactdata Artefact data relating to the folder
* @param object $artefactdata Artefact data relating to the folder
* represented by this directory
*/
private function create_index_for_directory($filesystemdirectory, $level, ArtefactTypeFolder $artefact=null) {
......@@ -194,9 +194,9 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
/**
* Helper to convert artefacts into smarty-friendly data
*
* @param int $parent The ID of the parent folder for the artefact to
* @param int $parent The ID of the parent folder for the artefact to
* convert
* @param bool $folders True to get folders, false to get everything but
* @param bool $folders True to get folders, false to get everything but
* folders
*/
private function prepare_artefacts_for_smarty($parent, $folders) {
......
......@@ -24,7 +24,7 @@ class PluginArtefactFile extends PluginArtefact {
'audio',
);
}
public static function get_block_types() {
return array('image');
}
......@@ -169,7 +169,7 @@ class PluginArtefactFile extends PluginArtefact {
update_record('usr', array('quota' => get_config_plugin('artefact', 'file', 'defaultquota')), array('id' => $user['id']));
}
}
public static function sort_child_data($a, $b) {
if ($a->container && !$b->container) {
......@@ -278,7 +278,7 @@ class PluginArtefactFile extends PluginArtefact {
$count['removed']++;
}
}
db_commit();
$changes = array();
foreach (array_filter($count) as $k => $v) {
......@@ -885,7 +885,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
}
/**
* Works out a full path to a folder, given an ID. Implemented this way so
* Works out a full path to a folder, given an ID. Implemented this way so
* only one query is made.
*/
public static function get_full_path($id, &$folderdata) {
......@@ -943,7 +943,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
* Try to add digits before the filename extension: If the desired
* title contains a ".", add "." plus digits before the final ".",
* otherwise append "." and digits.
*
*
* @param string $desired
* @param integer $parent
* @param integer $owner
......@@ -1042,7 +1042,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
public function __construct($id = 0, $data = null) {
parent::__construct($id, $data);
if ($this->id && ($filedata = get_record('artefact_file_files', 'artefact', $this->id))) {
foreach($filedata as $name => $value) {
if (property_exists($this, $name)) {
......@@ -1147,8 +1147,8 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
* Takes the name of a file outside the myfiles area.
* Returns a boolean indicating success or failure.
*
* Note: this method is crappy because it returns false instead of throwing
* exceptions. It's not used in many places, and should probably die in a
* Note: this method is crappy because it returns false instead of throwing
* exceptions. It's not used in many places, and should probably die in a
* future version. So think twice before using it :)
*/
public static function save_file($pathname, $data, User &$user=null, $outsidedataroot=false) {
......@@ -1363,7 +1363,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
public function delete() {
if (empty($this->id)) {
return;
return;
}
$file = $this->get_path();
if (is_file($file)) {
......@@ -1484,7 +1484,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
'value' => '<tr><td colspan="2">' . get_string('defaultquotadescription', 'artefact.file') . '</td></tr>'
),
'defaultquota' => array(
'title' => get_string('defaultquota', 'artefact.file'),
'title' => get_string('defaultquota', 'artefact.file'),
'type' => 'bytes',
'defaultvalue' => $defaultquota,
),
......@@ -1577,23 +1577,23 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
'value' => '<tr><td colspan="2">' . get_string('uploadagreementdescription', 'artefact.file') . '</td></tr>'
),
'uploadagreement' => array(
'title' => get_string('requireagreement', 'artefact.file'),
'title' => get_string('requireagreement', 'artefact.file'),
'type' => 'checkbox',
'defaultvalue' => $uploadagreement,
),
'defaultagreement' => array(
'type' => 'html',
'title' => get_string('defaultagreement', 'artefact.file'),
'title' => get_string('defaultagreement', 'artefact.file'),
'value' => get_string('uploadcopyrightdefaultcontent', 'install'),
),
'usecustomagreement' => array(
'title' => get_string('usecustomagreement', 'artefact.file'),
'title' => get_string('usecustomagreement', 'artefact.file'),
'type' => 'checkbox',
'defaultvalue' => $usecustomagreement,
),
'customagreement' => array(
'name' => 'customagreement',
'title' => get_string('customagreement', 'artefact.file'),
'title' => get_string('customagreement', 'artefact.file'),
'type' => 'wysiwyg',
'rows' => 10,
'cols' => 80,
......@@ -1983,7 +1983,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
public static function collapse_config() {
return 'file';
}
public static function admin_public_folder_id() {
// There is one public files directory and many admins, so the
// name of the directory uses the site language rather than
......@@ -2031,8 +2031,8 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
/**
* Retrieves info from the artefact table about the folder with the given
* name, in the specified directory, owned by the specified
* Retrieves info from the artefact table about the folder with the given
* name, in the specified directory, owned by the specified
* user/group/institution.
*
* @param string $name The name of the folder to search for
......@@ -2091,11 +2091,11 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
$postcontent = preg_replace('#(<a[^>]+href="[^>]+artefact/file/download\.php\?file=\d+)#', '\1&amp;view=' . $view_id , $postcontent);
$postcontent = preg_replace('#(<img[^>]+src="[^>]+artefact/file/download\.php\?file=\d+)#', '\1&amp;view=' . $view_id, $postcontent);
// Find images inside <a> tags and temporarily draft them out of the
// content. This is so we can link up unlinked images to open to
// Find images inside <a> tags and temporarily draft them out of the