MDL-58635 blogs: check edited blog belongs to current user

This commit is contained in:
Marina Glancy 2017-04-19 12:04:47 +08:00 committed by Mr. Jenkins (CiBoT)
parent dca8394630
commit b7fcd09582
2 changed files with 6 additions and 5 deletions

View File

@ -52,11 +52,11 @@ $action = (empty($id)) ? 'add' : 'edit';
$external = new stdClass();
// Check that this id exists.
if (!empty($id) && !$DB->record_exists('blog_external', array('id' => $id))) {
print_error('wrongexternalid', 'blog');
} else if (!empty($id)) {
$external = $DB->get_record('blog_external', array('id' => $id));
// Retrieve the external blog record.
if (!empty($id)) {
if (!$external = $DB->get_record('blog_external', array('id' => $id, 'userid' => $USER->id))) {
print_error('wrongexternalid', 'blog');
}
$external->autotags = core_tag_tag::get_item_tags_array('core', 'blog_external', $id);
}

View File

@ -185,6 +185,7 @@ $string['viewmyentriesaboutcourse'] = 'View my entries about this course';
$string['viewsiteentries'] = 'View all entries';
$string['viewuserentries'] = 'View all entries by {$a}';
$string['worldblogs'] = 'The world can read entries set to be world-accessible';
$string['wrongexternalid'] = 'Wrong external blog id';
$string['wrongpostid'] = 'Wrong blog post id';
$string['page-blog-edit'] = 'Blog editing pages';
$string['page-blog-index'] = 'Blog listing pages';