Савинцев Егор 🚶 (savintsev_egor) wrote in changelog,
Савинцев Егор 🚶
savintsev_egor
changelog

[ljcom] r10118: LJSUP-7758: AntiSpam S2

Committer: esavintcev
LJSUP-7758: AntiSpam S2
U   trunk/bin/upgrading/s2layers/sup/layout.s2
Modified: trunk/bin/upgrading/s2layers/sup/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sup/layout.s2	2011-02-24 10:58:42 UTC (rev 10117)
+++ trunk/bin/upgrading/s2layers/sup/layout.s2	2011-02-24 11:12:38 UTC (rev 10118)
@@ -106,6 +106,9 @@
 
     property use text_we_like_this;
     property use text_i_like_this;
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 
 propgroup sidebars = "Sidebars";
@@ -750,13 +753,6 @@
                     </dl>
 """;
     }
-    if (viewer_sees_ad_box("s2.box.yandex")) {
-"""
-                    <dl class="sidebar-block">
-                        <dd>"""; $p->print_ad_box("s2.box.yandex"); """</dd>
-                    </dl>
-""";
-    }
     var Entry[] _summary_entries;
     if ($*_RecentPage) {
         $_summary_entries = $*_RecentPage.entries;
@@ -811,6 +807,13 @@
 
 """;
     }
+    if (viewer_sees_ad_box("s2.box.yandex")) {
+"""
+                    <dl class="sidebar-block">
+                        <dd>"""; $p->print_ad_box("s2.box.yandex"); """</dd>
+                    </dl>
+""";
+    }
 
     var string designer = _designer();
 
@@ -892,7 +895,9 @@
 
 }
 
+
 function EntryPage::print_body {
+    var Page p = get_page();
     var Entry e = $.entry;
     var string corners1 = "";
     var string corners1_2 = "";
@@ -931,7 +936,23 @@
                         <div class="entry-text"><div class="entry-comments-text">
 """;
         "<a name='comments'></a>";
-        """<div class="comments-links">( $comments_count """;
+        var string comments_showspam = "";
+        if ($e.comments.count > 0 and not $.entry.comments.locked) {
+            if ($p.showspam) {
+                $comments_showspam = """<span class="comments-hidespam"><a href=\"$e.comments.read_spam_url\">$*text_hidespam</a></span> <span class="emdash">—</span> """;
+            } else {
+                $comments_showspam = """<span class="comments-showspam"><a href=\"$e.comments.read_spam_url\">$*text_showspam</a></span> <span class="emdash">—</span> """;
+            }
+        } elseif ($e.comments.count > 0) {
+            if ($p.showspam) {
+                $comments_showspam = """<span class="comments-hidespam"><a href=\"$e.comments.read_spam_url\">$*text_hidespam</a></span> """;
+            } else {
+                $comments_showspam = """<span class="comments-showspam"><a href=\"$e.comments.read_spam_url\">$*text_showspam</a></span> """;
+            }
+        } else {
+            $comments_showspam = "";
+        }
+        """<div class="comments-links">( $comments_count $comments_showspam""";
         if (not $.entry.comments.locked) {
         """<span class="replylink">"""; $this->print_reply_link({ "linktext" => $*text_post_comment, "target" => "topcomment" });"""</span>""";
         }
@@ -957,7 +978,7 @@
             $.comment_pages->print();
             $this->print_multiform_start();
             $this->print_comments($.comments);
-            """<div class="comments-links">( $comments_count """;
+            """<div class="comments-links">( $comments_count $comments_showspam""";
             if (not $.entry.comments.locked) { 
             """<span class="replylink">"""; $this->print_reply_link({ "linktext" => $*text_post_comment, "target" => "bottomcomment" }); """</span>""";
             }
@@ -1394,6 +1415,7 @@
 }
 
 function EntryPage::print_comments (Comment[] cs) {
+    var Page p = get_page();
     if (size $cs == 0) { return; }
     foreach var Comment c ($cs) {
         var int indent = ($c.depth - 1) * 25;
@@ -1402,12 +1424,15 @@
         if ($c.screened) { $comment_classes = $comment_classes + " screened"; }
         if ($c.edited) { $comment_classes = $comment_classes + " edited"; }
         if ($c.frozen) { $comment_classes = $comment_classes + " frozen"; }
+        if ($c.spam) { $comment_classes = $comment_classes + " spam"; }
         if (not $c.full) { $comment_classes = $comment_classes + " partial"; }
         """<div id="$c.dom_id" class="$comment_classes" style="margin-left:${indent}px;">""";
         if ($c.screened and not $c.full and not viewer_is_owner()) {
             """<strong>(Screened comment)</strong>""";
         } elseif ($c.deleted) {
             """<strong>(Deleted comment)</strong>""";
+        } elseif (($c.spam) and (not $p.showspam) and (size($c.replies) > 0)) {
+            """<strong>$*text_spam_comment</strong>""";
         } elseif ($c.full) {
             $this->print_comment($c);
         } else {

Tags: ljcom, s2, savintsev_egor
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments