if (isset($act) && $act == 'del' && confirm_sesskey())
{
- if (optional_param($confirm,0,PARAM_INT)) {
- require_variable($postid);
+ $postid = required_param('postid', PARAM_INT);
+ if (optional_param('confirm',0,PARAM_INT)) {
do_delete($PAGE->bloginfo, $postid);
} else {
/// prints blog entry and what confirmation form
-
-
+ echo '<div align="center"><form method="GET" action="edit.php">';
+ echo '<input type="hidden" name="act" value="del" />';
+ echo '<input type="hidden" name="confirm" value="1" />';
+ echo '<input type="hidden" name="postid" value="'.$postid.'" />';
+ echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
+ print_string('blogdeleteconfirm', 'blog');
+
+ $post = get_record('post', 'id', $postid);
+ $entry = new BlogEntry($post);
+ blog_print_entry($entry);
+ echo '<br />';
+ echo '<input type="submit" value="'.get_string('delete').'" /> ';
+ echo ' <input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
+ echo '</form></div>';
+ print_footer($course);
+ die;
}
}
if ($usehtmleditor = can_use_richtext_editor()) {
$post->categoryid = array(1);
$post->publishstate = 'draft';
$post->courseid = $courseid;
-
}
* in its complete form (eg. archive page). If anything other than 'full'
* display the entry in its abbreviated format (eg. index page)
*/
-function blog_print_entry(&$blogEntry, $viewtype='full', $filtertype, $filterselect) {
+function blog_print_entry(&$blogEntry, $viewtype='full', $filtertype='', $filterselect='') {
global $CFG, $THEME, $USER;
static $bloginfoarray;
if (isset($USER->id)) {
if (($template['userid'] == $USER->id) or isteacher($course->id)) {
- echo '<a href="'.$CFG->wwwroot.'/blog/edit.php?editid='.$entryid.'&lsesskey='.sesskey().'">'.$stredit.'</a>';
+ echo '<a href="'.$CFG->wwwroot.'/blog/edit.php?editid='.$entryid.'&sesskey='.sesskey().'">'.$stredit.'</a>';
}
if (($template['userid'] == $USER->id) or isteacher($course->id)) {
- echo '| <a href="'.$CFG->wwwroot.'/blog/edit.php?act=del&postid='.$entryid.'&lsesskey='.sesskey().'">'.$strdelete.'</a>';
+ echo '| <a href="'.$CFG->wwwroot.'/blog/edit.php?act=del&postid='.$entryid.'&sesskey='.sesskey().'">'.$strdelete.'</a>';
}
}