summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/controllers/admin_comments.php8
-rw-r--r--modules/comment/helpers/comment_installer.php8
-rw-r--r--modules/comment/helpers/comment_rss.php20
-rw-r--r--modules/comment/module.info2
4 files changed, 33 insertions, 5 deletions
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php
index f0308bdb..bcd6a939 100644
--- a/modules/comment/controllers/admin_comments.php
+++ b/modules/comment/controllers/admin_comments.php
@@ -32,6 +32,8 @@ class Admin_Comments_Controller extends Admin_Controller {
$form->validate();
module::set_var("comment", "access_permissions",
$form->comment_settings->access_permissions->value);
+ module::set_var("comment", "rss_available",
+ $form->comment_settings->rss_available->value);
message::success(t("Comment settings updated"));
url::redirect("admin/comments");
}
@@ -45,6 +47,12 @@ class Admin_Comments_Controller extends Admin_Controller {
->options(array("everybody" => t("Everybody"),
"registered_users" => t("Only registered users")))
->selected(module::get_var("comment", "access_permissions"));
+ $comment_settings->dropdown("rss_visible")
+ ->label(t("Which RSS feeds can users see?"))
+ ->options(array("all" => t("All comment feeds"),
+ "newest" => t("New comments feed only"),
+ "per_item" => t("Comments on photos, movies and albums only")))
+ ->selected(module::get_var("comment", "rss_visible"));
$comment_settings->submit("save")->value(t("Save"));
return $form;
}
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index fee1fd18..a64064f6 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -48,7 +48,8 @@ class comment_installer {
module::set_var("comment", "spam_caught", 0);
module::set_var("comment", "access_permissions", "everybody");
- module::set_version("comment", 4);
+ module::set_var("comment", "rss_available", "both");
+ module::set_version("comment", 5);
}
static function upgrade($version) {
@@ -75,6 +76,11 @@ class comment_installer {
"ALTER TABLE {comments} CHANGE `server_remote_host` `server_remote_host` varchar(255)");
module::set_version("comment", $version = 4);
}
+
+ if ($version == 4) {
+ module::set_var("comment", "rss_visible", "all");
+ module::set_version("comment", $version = 5);
+ }
}
static function uninstall() {
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index 6434448f..cfee4727 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -19,9 +19,23 @@
*/
class comment_rss_Core {
+ static function feed_visible($feed_id) {
+ $visible = module::get_var("comment", "rss_visible");
+ if (!in_array($feed_id, array("newest", "per_item"))) {
+ return false;
+ }
+
+ return ($visible == "all" || $visible == $feed_id);
+ }
+
static function available_feeds($item, $tag) {
- $feeds["comment/newest"] = t("All new comments");
- if ($item) {
+ $feeds = array();
+
+ if (comment_rss::feed_visible("newest")) {
+ $feeds["comment/newest"] = t("All new comments");
+ }
+
+ if ($item && comment_rss::feed_visible("per_item")) {
$feeds["comment/item/$item->id"] =
t("Comments on %title", array("title" => html::purify($item->title)));
}
@@ -29,7 +43,7 @@ class comment_rss_Core {
}
static function feed($feed_id, $offset, $limit, $id) {
- if ($feed_id != "newest" && $feed_id != "item") {
+ if (!comment_rss::feed_visible($feed_id)) {
return;
}
diff --git a/modules/comment/module.info b/modules/comment/module.info
index 4e7df6f1..ecbf8885 100644
--- a/modules/comment/module.info
+++ b/modules/comment/module.info
@@ -1,6 +1,6 @@
name = "Comments"
description = "Allows users and guests to leave comments on photos and albums."
-version = 4
+version = 5
author_name = "Gallery Team"
author_url = "http://codex.gallery2.org/Gallery:Team"
info_url = "http://codex.gallery2.org/Gallery3:Modules:comment"