From 990aab5f5d1c693c4e2d352f4e21a93a0c2e0b5c Mon Sep 17 00:00:00 2001
From: Thomas Hochstein <thh@inter.net>
Date: Mon, 9 Jun 2014 18:30:44 +0200
Subject: [PATCH 1/3] Add URL correct encoding to karma plugin.

[] have to be URL encoded as %5B and %5d,
respectively. Percent signs have to be
doubled as those strings are used as
input for sprintf().

Signed-off-by: Thomas Hochstein <thh@inter.net>
---
 .../serendipity_event_karma.php                        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/serendipity_event_karma/serendipity_event_karma.php b/plugins/serendipity_event_karma/serendipity_event_karma.php
index 2de7cfed..385d6a22 100644
--- a/plugins/serendipity_event_karma/serendipity_event_karma.php
+++ b/plugins/serendipity_event_karma/serendipity_event_karma.php
@@ -1993,11 +1993,11 @@ END_IMG_CSS;
                 $enough_votes = true;
             } else {
                 // Create ordinary links
-                $link_1 = "<a class='serendipity_karmaVoting_link1' rel='nofollow' href='%5\$sserendipity[karmaVote]=-2&amp;serendipity[karmaId]=$id#karma_vote$id' title='$vile'>$vilestr</a>";
-                $link_2 = "<a class='serendipity_karmaVoting_link2' rel='nofollow' href='%5\$sserendipity[karmaVote]=-1&amp;serendipity[karmaId]=$id#karma_vote$id' title='$poor'>$poorstr</a>";
-                $link_3 = "<a class='serendipity_karmaVoting_link3' rel='nofollow' href='%5\$sserendipity[karmaVote]=0&amp;serendipity[karmaId]=$id#karma_vote$id' title='$okay'> $okaystr</a>";
-                $link_4 = "<a class='serendipity_karmaVoting_link4' rel='nofollow' href='%5\$sserendipity[karmaVote]=1&amp;serendipity[karmaId]=$id#karma_vote$id' title='$good'>$goodstr</a>";
-                $link_5 = "<a class='serendipity_karmaVoting_link5' rel='nofollow' href='%5\$sserendipity[karmaVote]=2&amp;serendipity[karmaId]=$id#karma_vote$id' title='$best'>$beststr</a>";
+                $link_1 = "<a class='serendipity_karmaVoting_link1' rel='nofollow' href='%5\$sserendipity%%5BkarmaVote%%5D=-2&amp;serendipity%%5BkarmaId%%5D=$id#karma_vote$id' title='$vile'>$vilestr</a>";
+                $link_2 = "<a class='serendipity_karmaVoting_link2' rel='nofollow' href='%5\$sserendipity%%5BkarmaVote%%5D=-1&amp;serendipity%%5BkarmaId%%5D=$id#karma_vote$id' title='$poor'>$poorstr</a>";
+                $link_3 = "<a class='serendipity_karmaVoting_link3' rel='nofollow' href='%5\$sserendipity%%5BkarmaVote%%5D=0&amp;serendipity%%5BkarmaId%%5D=$id#karma_vote$id' title='$okay'> $okaystr</a>";
+                $link_4 = "<a class='serendipity_karmaVoting_link4' rel='nofollow' href='%5\$sserendipity%%5BkarmaVote%%5D=1&amp;serendipity%%5BkarmaId%%5D=$id#karma_vote$id' title='$good'>$goodstr</a>";
+                $link_5 = "<a class='serendipity_karmaVoting_link5' rel='nofollow' href='%5\$sserendipity%%5BkarmaVote%%5D=2&amp;serendipity%%5BkarmaId%%5D=$id#karma_vote$id' title='$best'>$beststr</a>";
             }
         }
 

From 3acdd9403cf0e2582423839c0949860d87f8cd4c Mon Sep 17 00:00:00 2001
From: Thomas Hochstein <thh@inter.net>
Date: Mon, 9 Jun 2014 18:38:17 +0200
Subject: [PATCH 2/3] Add URL encoding to CSS and .js links in <HEAD>.

Enocde & as &amp; to make validator happy.

Signed-off-by: Thomas Hochstein <thh@inter.net>
---
 include/functions_smarty.inc.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php
index 6d206d19..3d07368e 100644
--- a/include/functions_smarty.inc.php
+++ b/include/functions_smarty.inc.php
@@ -997,7 +997,7 @@ function serendipity_smarty_init($vars = array()) {
 
             // When templates are switched, append a specific version string to make sure the browser does not cache the CSS
             if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
-                $serendipity['smarty_vars']['head_link_stylesheet'] .= '&v=' . $serendipity['last_template_change'];
+                $serendipity['smarty_vars']['head_link_stylesheet'] .= '&amp;v=' . $serendipity['last_template_change'];
             } else {
                 $serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
             }
@@ -1011,7 +1011,7 @@ function serendipity_smarty_init($vars = array()) {
             }
             
             if (strstr($serendipity['smarty_vars']['head_link_script'], '?')) {
-                $serendipity['smarty_vars']['head_link_script'] .= '&v=' . $serendipity['last_template_change'];
+                $serendipity['smarty_vars']['head_link_script'] .= '&amp;v=' . $serendipity['last_template_change'];
             } else {
                 $serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
             }

From 992dcbd0c9fffe8873de9a4bcd1041b3585f83c3 Mon Sep 17 00:00:00 2001
From: Thomas Hochstein <thh@inter.net>
Date: Mon, 9 Jun 2014 18:50:28 +0200
Subject: [PATCH 3/3] 'language="javascript"' is optional.

Signed-off-by: Thomas Hochstein <thh@inter.net>
---
 templates/default/admin/media_pane.tpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/default/admin/media_pane.tpl b/templates/default/admin/media_pane.tpl
index 91dcbacc..001746f3 100644
--- a/templates/default/admin/media_pane.tpl
+++ b/templates/default/admin/media_pane.tpl
@@ -83,7 +83,7 @@
                         {/foreach}
                     </table>
                 </div>
-                <script type="text/javascript" language="javascript">
+                <script type="text/javascript">
                 {if $media.keywords_selected != '' OR $show_filter}showFilters();{/if}
                 </script>
             </td>