message_user($object_owner, $comment->owner, stripslashes($object_title), $message);
             }
         }
     }
 } else {
     $messages[] = __gettext("Your comment could not be posted. The system thought it was spam.");
 }
 // If river plugin installed then note comment
 if (function_exists('river_save_event')) {
     $commenturl = $CFG->wwwroot . "mod/generic_comments/comment_page.php?object_id={$comment->object_id}&object_type={$comment->object_type}&comment_sort=ASC";
     $username = "******"" . river_get_userurl($comment->owner) . "\">" . user_info("username", $comment->owner) . "</a>";
     if (!isset($comment->owner)) {
         $comment->owner = -1;
         $username = __gettext("Anonymous user");
     }
     river_save_event($comment->owner, $comment->object_id, $comment->owner, $comment->object_type, $username . " <a href=\"{$commenturl}\">" . __gettext("commented on") . "</a> " . river_get_friendly_id($comment->object_type, $comment->object_id));
 }
 $xml = optional_param('returnformat', '');
 if (!empty($xml)) {
     // If we are returning xml for the ajax response then output message and die.
     if ($ok != true) {
         $ok = "<error>1</error>\n";
     } else {
         $messages[] = __gettext(" Click <a href=\"\">here</a> to refresh");
         $ok = "<error>0</error>\n";
     }
     $msg = implode("\n", $messages);
     header("Content-type: text/xml");
     echo "<ajax>\n<message>{$msg}</message>\n{$ok}</ajax>\n";
     exit;
 } else {
                             $message = sprintf(__gettext("You have received a comment from %s on your blog post '%s'. It reads as follows:"), $comment->postedname, stripslashes($post->title));
                             $message .= "\n\n" . stripslashes($comment->body) . "\n\n";
                             $message .= sprintf(__gettext("To reply and see other comments on this blog post, click here: %s"), $CFG->wwwroot . user_info("username", $post->weblog) . "/weblog/" . $post->ident . ".html");
                             $message = wordwrap($message);
                             message_user($post->owner, $comment->owner, stripslashes($post->title), $message);
                         }
                         // If river plugin installed then note comment
                         if (function_exists('river_save_event')) {
                             $un = user_info("username", $comment->owner);
                             $commenturl = $CFG->wwwroot . "{$un}/weblog/{$comment->post_id}.html#cmt{$comment->ident}";
                             $username = "******"" . river_get_userurl($comment->owner) . "\">{$un}</a>";
                             if (!isset($comment->owner)) {
                                 $comment->owner = -1;
                                 $username = __gettext("Anonymous user");
                             }
                             river_save_event($post->owner, $comment->ident, $comment->owner, "weblog_post::post", $username . " <a href=\"{$commenturl}\">" . __gettext("commented on") . "</a> " . river_get_friendly_id("weblog_post::post", $comment->post_id));
                         }
                     }
                 }
             } else {
                 $messages[] = __gettext("Your comment could not be posted. The system thought it was spam.");
             }
             define('redirect_url', url . user_info("username", $post->owner) . "/{$extensionContext}/" . $commentbackup->post_id . ".html");
         }
     } else {
         $messages[] = __gettext("Your comment body or name is empty.");
     }
     break;
     // Delete a weblog comment
 // Delete a weblog comment
 case "weblog_comment_delete":