mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-06-07 12:09:11 -04:00
Big set of changes to comments, with related changes to akismet and
user modules. * Don't delete vars when we delete a module. This makes reinstalling a module a lot easier. * Add user::lookup() as the preferred way to load a user, so that other modules don't delve into the user module (that'd be a problem when we swap out user modules) * Notify site admins if Akismet is not fully configured * Bundle all server variables into the comment so that if/when we re-check the comment, we are not using the server info from the site admin's request. * Update Akismet to grab request context data from the comment * Pre-seed comment fields if we have a logged in user. Update comment::create() API to clarify it for this. * Delete comment::update(), that's a controller function. * Add url to User_Model * Add author_name() author_email() and author_url() to Comment_Model. It'll return the appropriate values depending on whether the comment was left by a logged in user or a guest. * Use resetForm() instead of clearForm() when we reload the comment form after ajax submit, this way we preserve the pre-seeded values. * In the user profile page, ignore blank passwords.
This commit is contained in:
@@ -60,11 +60,12 @@ class Comments_Controller extends REST_Controller {
|
||||
|
||||
$form = comment::get_add_form($item);
|
||||
if ($form->validate()) {
|
||||
$comment = comment::create($this->input->post("author"),
|
||||
$this->input->post("email"),
|
||||
$this->input->post("text"),
|
||||
$this->input->post("item_id"),
|
||||
$this->input->post("url"));
|
||||
$comment = comment::create(
|
||||
$item, user::active(),
|
||||
$form->add_comment->text->value,
|
||||
$form->add_comment->inputs["name"]->value,
|
||||
$form->add_comment->email->value,
|
||||
$form->add_comment->url->value);
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
@@ -111,11 +112,12 @@ class Comments_Controller extends REST_Controller {
|
||||
|
||||
$form = comment::get_edit_form($comment);
|
||||
if ($form->validate()) {
|
||||
$comment = comment::update($comment,
|
||||
$this->input->post("author"),
|
||||
$this->input->post("email"),
|
||||
$this->input->post("text"),
|
||||
$this->input->post("url"));
|
||||
$comment->guest_name = $form->edit_comment->inputs["name"]->value;
|
||||
$comment->guest_email = $form->edit_comment->email->value;
|
||||
$comment->url = $form->edit_comment->url->value;
|
||||
$comment->text = $form->edit_comment->text->value;
|
||||
$comment->save();
|
||||
module::event("comment_updated", $comment);
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
|
||||
Reference in New Issue
Block a user