diff options
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/controllers/comments.php | 4 | ||||
-rw-r--r-- | modules/comment/helpers/comment_rss.php | 8 | ||||
-rw-r--r-- | modules/comment/helpers/comment_theme.php | 4 | ||||
-rw-r--r-- | modules/comment/models/comment.php | 2 | ||||
-rw-r--r-- | modules/comment/module.info | 4 | ||||
-rw-r--r-- | modules/comment/views/admin_block_recent_comments.html.php | 4 | ||||
-rw-r--r-- | modules/comment/views/admin_comments.html.php | 6 | ||||
-rw-r--r-- | modules/comment/views/comment.html.php | 4 | ||||
-rw-r--r-- | modules/comment/views/comment.mrss.php | 6 | ||||
-rw-r--r-- | modules/comment/views/comments.html.php | 4 |
10 files changed, 23 insertions, 23 deletions
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index 99ecc8e0..02c38491 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -41,7 +41,7 @@ class Comments_Controller extends REST_Controller { "id" => $comment->id, "author_name" => p::clean($comment->author_name()), "created" => $comment->created, - "text" => p::clean($comment->text)); + "text" => nl2br(p::purify($comment->text))); } print json_encode($data); break; @@ -128,7 +128,7 @@ class Comments_Controller extends REST_Controller { "id" => $comment->id, "author_name" => p::clean($comment->author_name()), "created" => $comment->created, - "text" => p::clean($comment->text)))); + "text" => nl2br(p::purify($comment->text))))); } else { $view = new Theme_View("comment.html", "fragment"); $view->comment = $comment; diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php index ef2d176e..ab3d2283 100644 --- a/modules/comment/helpers/comment_rss.php +++ b/modules/comment/helpers/comment_rss.php @@ -23,7 +23,7 @@ class comment_rss_Core { $feeds["comment/newest"] = t("All new comments"); if ($item) { $feeds["comment/item/$item->id"] = - t("Comments on %title", array("title" => p::clean($item->title))); + t("Comments on %title", array("title" => p::purify($item->title))); } return $feeds; } @@ -53,13 +53,13 @@ class comment_rss_Core { $item = $comment->item(); $feed->children[] = new ArrayObject( array("pub_date" => date("D, d M Y H:i:s T", $comment->created), - "text" => $comment->text, + "text" => nl2br(p::purify($comment->text)), "thumb_url" => $item->thumb_url(), "thumb_height" => $item->thumb_height, "thumb_width" => $item->thumb_width, "item_uri" => url::abs_site("{$item->type}s/$item->id"), - "title" => $item->title, - "author" => $comment->author_name()), + "title" => p::purify($item->title), + "author" => p::clean($comment->author_name())), ArrayObject::ARRAY_AS_PROPS); } diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php index d9f1acf4..89b2f57c 100644 --- a/modules/comment/helpers/comment_theme.php +++ b/modules/comment/helpers/comment_theme.php @@ -19,8 +19,8 @@ */ class comment_theme_Core { static function head($theme) { - $url = url::file("modules/comment/js/comment.js"); - return "<script src=\"$url\" type=\"text/javascript\"></script>\n"; + $theme->script("modules/comment/js/comment.js"); + return ""; } static function photo_bottom($theme) { diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php index ec4d4794..22c465df 100644 --- a/modules/comment/models/comment.php +++ b/modules/comment/models/comment.php @@ -59,7 +59,7 @@ class Comment_Model extends ORM { public function save() { if (!empty($this->changed)) { $this->updated = time(); - if (!$this->loaded) { + if (!$this->loaded && empty($this->created)) { $this->created = $this->updated; } } diff --git a/modules/comment/module.info b/modules/comment/module.info index 946f1d39..c371cf27 100644 --- a/modules/comment/module.info +++ b/modules/comment/module.info @@ -1,3 +1,3 @@ -name = Comments -description = Allows users and guests to leave comments on photos and albums. +name = "Comments" +description = "Allows users and guests to leave comments on photos and albums." version = 2 diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index edaa19ae..4ff24f86 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -2,7 +2,7 @@ <ul> <? foreach ($comments as $i => $comment): ?> <li class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>"> - <img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(32, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="32" @@ -10,7 +10,7 @@ <?= gallery::date_time($comment->created) ?> <?= t('<a href="#">%author_name</a> said <em>%comment_text</em>', array("author_name" => p::clean($comment->author_name()), - "comment_text" => text::limit_words(p::clean($comment->text), 50))); ?> + "comment_text" => text::limit_words(nl2br(p::purify($comment->text)), 50))); ?> </li> <? endforeach ?> </ul> diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index 86585c65..ad0ae8f3 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -106,7 +106,7 @@ <tr id="gComment-<?= $comment->id ?>" class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>"> <td> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" @@ -122,7 +122,7 @@ <a href="<?= $item->url() ?>"> <? if ($item->has_thumb()): ?> <img src="<?= $item->thumb_url() ?>" - alt="<?= p::clean($item->title) ?>" + alt="<?= p::purify($item->title) ?>" <?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?> /> <? else: ?> @@ -132,7 +132,7 @@ </div> </div> <p><?= gallery::date($comment->created) ?></p> - <?= p::clean($comment->text) ?> + <?= nl2br(p::purify($comment->text)) ?> </td> <td> <ul class="gButtonSetVertical"> diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php index ce52951b..ab72a0c8 100644 --- a/modules/comment/views/comment.html.php +++ b/modules/comment/views/comment.html.php @@ -2,7 +2,7 @@ <li id="gComment-<?= $comment->id; ?>"> <p class="gAuthor"> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" @@ -13,6 +13,6 @@ "author_name" => p::clean($comment->author_name()))) ?> </p> <div> - <?= p::clean($comment->text) ?> + <?= nl2br(p::purify($comment->text)) ?> </div> </li> diff --git a/modules/comment/views/comment.mrss.php b/modules/comment/views/comment.mrss.php index 4f520144..2b5b13c1 100644 --- a/modules/comment/views/comment.mrss.php +++ b/modules/comment/views/comment.mrss.php @@ -5,7 +5,7 @@ xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:fh="http://purl.org/syndication/history/1.0"> <channel> - <generator>gallery3</generator> + <generator>Gallery 3</generator> <title><?= p::clean($feed->title) ?></title> <link><?= $feed->uri ?></link> <description><?= p::clean($feed->description) ?></description> @@ -22,14 +22,14 @@ <lastBuildDate><?= $pub_date ?></lastBuildDate> <? foreach ($feed->children as $child): ?> <item> - <title><?= p::clean($child->title) ?></title> + <title><?= p::purify($child->title) ?></title> <link><?= p::clean($child->item_uri) ?></link> <author><?= p::clean($child->author) ?></author> <guid isPermaLink="true"><?= $child->item_uri ?></guid> <pubDate><?= $child->pub_date ?></pubDate> <content:encoded> <![CDATA[ - <p><?= p::clean($child->text) ?></p> + <p><?= nl2br(p::purify($child->text)) ?></p> <p> <img alt="" src="<?= $child->thumb_url ?>" height="<?= $child->thumb_height ?>" width="<?= $child->thumb_width ?>" /> diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index 854f9554..fa25a4e0 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -10,7 +10,7 @@ <li id="gComment-<?= $comment->id ?>"> <p class="gAuthor"> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" @@ -21,7 +21,7 @@ "name" => p::clean($comment->author_name()))); ?> </p> <div> - <?= p::clean($comment->text) ?> + <?= nl2br(p::purify($comment->text)) ?> </div> </li> <? endforeach ?> |