public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
* application/xhtml+xml compatibility
* Changed the post XML sanitization method to be much simpler and not use 
name2codepoint. It has been changed back because the previous method would 
destroy their HTML entities, causing them to be replaced entirely with the 
actual character (e.g. → would display the arrow in-line).
* The post editing form has been moved to the theme entirely; there is no 
longer a fallback in ajax.php.
* fix() takes a third parameter for whether or not to double-encode
* Fixed invalid &'s in pagination URLs with clean URLs disabled
* Escape the page title
* Code cleanups
* The textarea auto-growing can be disabled with 
$("textarea").autogrow("disable")
vito (author)
Fri Jul 25 09:39:27 -0700 2008
commit  ff0b3a65ebde248fd46194a5c1eb88476a67420e
tree    ae75696e238c5c7e21f5f11ef96ba2aa03dd5c76
parent  c73448b764e0e03046b2e5d06d21cf978740c41c
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
   <head>
0
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0
+ <meta http-equiv="Content-Type" content="$theme.type; charset=utf-8"/>
0
     <title>Chyrp: <?php echo $title; ?></title>
0
     <style type="text/css">
0
       html, body, ul, ol, li,
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 <?php
0
   define('ADMIN', true);
0
+ define('AJAX', isset($_POST['ajax']) and $_POST['ajax'] == "true");
0
 
0
   require_once "../includes/common.php";
0
 
...
1
2
3
 
4
5
 
6
7
8
...
1
2
 
3
4
 
5
6
7
8
0
@@ -1,8 +1,8 @@
0
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
0
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0
-<html xmlns="http://www.w3.org/1999/xhtml">
0
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${ site.locale | split("_") | first }" lang="${ site.locale | split("_") | first }">
0
   <head>
0
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
0
+ <meta http-equiv="Content-type" content="$theme.type; charset=utf-8" />
0
     <title>$site.name: {% block title %}$title{% endblock %}</title>
0
     <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8" />
0
     <script src="$site.chyrp_url/includes/lib/gz.php?file=jquery.js" type="text/javascript" charset="utf-8"></script>
...
3
4
5
6
 
7
8
 
9
10
11
...
128
129
130
 
131
132
133
134
 
135
136
137
...
164
165
166
 
167
168
169
...
227
228
229
230
 
231
232
 
233
234
235
...
241
242
243
244
 
 
245
 
246
247
248
...
260
261
262
263
 
 
264
265
266
...
3
4
5
 
6
7
8
9
10
11
12
...
129
130
131
132
133
134
135
136
137
138
139
140
...
167
168
169
170
171
172
173
...
231
232
233
 
234
235
236
237
238
239
240
...
246
247
248
 
249
250
251
252
253
254
255
...
267
268
269
 
270
271
272
273
274
0
@@ -3,9 +3,10 @@
0
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0
 <html xmlns="http://www.w3.org/1999/xhtml">
0
   <head>
0
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
0
+ <meta http-equiv="Content-Type" content="$theme.type; charset=utf-8" />
0
     <title>${ "Chyrp!" | translate }</title>
0
     <style type="text/css">
0
+ <!--/*--><![CDATA[/*><!--*/
0
       /* Reset */
0
       body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td { margin: 0; padding: 0; }
0
       table { border-collapse: collapse; border-spacing: 0; }
0
@@ -128,10 +129,12 @@
0
       button:active {
0
         background: #e0e0e0;
0
       }
0
+ /*]]>*/-->
0
     </style>
0
     <script src="$site.chyrp_url/includes/lib/gz.php?file=jquery.js" type="text/javascript" charset="utf-8"></script>
0
     <script src="$site.chyrp_url/includes/lib/gz.php?file=plugins.js" type="text/javascript" charset="utf-8"></script>
0
     <script type="text/javascript">
0
+ <!--//--><![CDATA[//><!--
0
       function activate_nav_tab(id) {
0
         $$("[class^='nav_']").removeClass("selected")
0
         $$("[id$$='_form']").hide()
0
@@ -164,6 +167,7 @@
0
           }
0
         })
0
       })
0
+ //--><!]]>
0
     </script>
0
   </head>
0
   <body>
0
@@ -227,9 +231,10 @@
0
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
   <head>
0
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0
+ <meta http-equiv="Content-Type" content="$theme.type; charset=utf-8"/>
0
     <title>${ "Chyrp!" | translate }</title>
0
     <style type="text/css">
0
+ <!--/*--><![CDATA[/*><!--*/
0
       body {
0
         background-color: #e1e1e1;
0
         margin:       0px;
0
@@ -241,8 +246,10 @@
0
         margin:       137px 30px 0px 30px;
0
         padding:     15px;
0
       }
0
- </style>
0
+ /*]]>*/-->
0
+ </style>
0
     <script type="text/javascript">
0
+ <!--//--><![CDATA[//><!--
0
       function countdown_func() {
0
         countdown--
0
 
0
@@ -260,7 +267,8 @@
0
       }
0
 
0
       var countdown = 3;
0
- </script>
0
+ //--><!]]>
0
+ </script>
0
   </head>
0
   <body>
0
     <div id="content">
...
11
12
13
14
 
15
16
 
17
18
19
...
11
12
13
 
14
15
 
16
17
18
19
0
@@ -11,9 +11,9 @@
0
               {% endif %}
0
             </label>
0
             {% if field.type == "text" or field.type == "file" %}
0
- <input class="$field.type{% if field.classes %} ${ field.classes | join(" ") }{% endif %}" type="$field.type" name="$field.attr" value="{% if not field.no_value %}${ field.value | fallback(post[field.attr] | escape) }{% endif %}" id="$field.attr" />
0
+ <input class="$field.type{% if field.classes %} ${ field.classes | join(" ") }{% endif %}" type="$field.type" name="$field.attr" value="{% if not field.no_value %}${ field.value | fallback(post[field.attr] | escape(true, false)) }{% endif %}" id="$field.attr" />
0
             {% elseif field.type == "text_block" %}
0
- <textarea class="wide{% if field.classes %} ${ field.classes | join(" ") }{% endif %}" rows="${ field.rows | fallback(12) }" name="$field.attr" id="$field.attr" cols="50">{% if not field.no_value %}${ field.value | fallback(post[field.attr] | escape) }{% endif %}</textarea>
0
+ <textarea class="wide{% if field.classes %} ${ field.classes | join(" ") }{% endif %}" rows="${ field.rows | fallback(12) }" name="$field.attr" id="$field.attr" cols="50">{% if not field.no_value %}${ field.value | fallback(post[field.attr] | escape(false, false)) }{% endif %}</textarea>
0
             {% elseif field.type == "select" %}
0
             <select name="$field.attr" id="$field.attr"{% if field.classes %} class="${ field.classes | join(" ") }"{% endif %}>
0
               {% for value, name in field.options | items %}
...
55
56
57
58
59
60
61
62
 
 
 
 
 
 
 
63
64
65
...
129
130
131
132
 
 
 
 
 
133
134
135
...
166
167
168
169
 
170
171
172
...
176
177
178
179
 
180
181
 
182
183
184
185
186
 
187
188
189
...
193
194
195
196
 
197
198
199
 
200
201
202
...
273
274
275
276
 
277
278
279
...
302
303
304
305
 
306
307
308
...
365
366
367
368
 
369
370
371
...
374
375
376
377
 
378
379
380
 
381
382
383
...
55
56
57
 
 
 
 
 
58
59
60
61
62
63
64
65
66
67
...
131
132
133
 
134
135
136
137
138
139
140
141
...
172
173
174
 
175
176
177
178
...
182
183
184
 
185
186
 
187
188
189
190
191
 
192
193
194
195
...
199
200
201
 
202
203
204
 
205
206
207
208
...
279
280
281
 
282
283
284
285
...
308
309
310
 
311
312
313
314
...
371
372
373
 
374
375
376
377
...
380
381
382
 
383
384
385
 
386
387
388
389
0
@@ -55,11 +55,13 @@ $(function(){
0
 function togglers() {
0
   var all_checked = true
0
 
0
- $("#toggler").html('<label for="toggle"><?php echo __("Toggle All"); ?></label><input class="checkbox" type="checkbox" name="toggle" id="toggle" />')
0
-
0
- $(".toggler").html('<input class="checkbox" type="checkbox" name="toggle" id="toggle" />')
0
-
0
- $("#toggle").click(function(){
0
+ $(document.createElement("label")).attr("for", "toggle").text("<?php echo __("Toggle All"); ?>").appendTo("#toggler")
0
+ $(document.createElement("input")).attr({
0
+ "class": "checkbox",
0
+ type: "checkbox",
0
+ name: "toggle",
0
+ id: "toggle"
0
+ }).appendTo("#toggler, .toggler").click(function(){
0
     $("form#new_group, form#group_edit, table").find(":checkbox").not("#toggle").each(function(){
0
       this.checked = document.getElementById("toggle").checked
0
     })
0
@@ -129,7 +131,11 @@ var Write = {
0
     this.more_options()
0
   },
0
   bookmarklet_link: function(){
0
- $(document.createElement("li")).addClass("bookmarklet right").html("<?php echo _f("Bookmarklet: %s", array('<a class=\"no_drag\" href=\"javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=\''.$config->chyrp_url.'/admin/?action=bookmarklet\',l=d.location,e=encodeURIComponent,p=\'&url=\'+e(l.href)+\'&title=\'+e(d.title)+\'&selection=\'+e(s),u=f+p;a=function(){if(!w.open(u,\'t\',\'toolbar=0,resizable=0,status=1,width=450,height=430\'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();void(0)\">Chyrp!</a>')); ?>").prependTo(".write_post_nav")
0
+ // Add the list item
0
+ $(document.createElement("li")).addClass("bookmarklet right").text("Bookmarklet: ").prependTo(".write_post_nav")
0
+
0
+ // Add the link
0
+ $(document.createElement("a")).text("<?php echo __("Chyrp!"); ?>").addClass("no_drag").attr("href", "<?php echo 'javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=\''.$config->chyrp_url.'/admin/?action=bookmarklet\',l=d.location,e=encodeURIComponent,p=\'&url=\'+e(l.href)+\'&title=\'+e(d.title)+\'&selection=\'+e(s),u=f+p;a=function(){if(!w.open(u,\'t\',\'toolbar=0,resizable=0,status=1,width=450,height=430\'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();void(0)'; ?>").appendTo(".bookmarklet")
0
   },
0
   auto_expand_fields: function(){
0
     $("input.text").each(function(){
0
@@ -166,7 +172,7 @@ var Write = {
0
 
0
     var feather = ($("#feather").size()) ? $("#feather").val() : ""
0
     $(document.createElement("div")).css("display", "none").attr("id", "preview").insertBefore("#write_form, #edit_form")
0
- $(document.createElement("button")).html("<?php echo __("Preview &rarr;"); ?>").attr({ "type": "submit", "accesskey": "p" }).click(function(){
0
+ $(document.createElement("button")).append("<?php echo __("Preview &#8594;"); ?>").attr({ "type": "submit", "accesskey": "p" }).click(function(){
0
       $("#preview").load("<?php echo $config->chyrp_url; ?>/includes/ajax.php", { action: "preview", content: $(".preview_me").val(), feather: feather }, function(){
0
         $(this).fadeIn("fast")
0
       })
0
@@ -176,14 +182,14 @@ var Write = {
0
   more_options: function(){
0
     if ($("#more_options").size()) {
0
       if (Cookie.get("show_more_options") == "true")
0
- var more_options_text = "<?php echo __("&laquo; Fewer Options"); ?>";
0
+ var more_options_text = "<?php echo __("&#171; Fewer Options"); ?>";
0
       else
0
- var more_options_text = "<?php echo __("More Options &raquo;"); ?>";
0
+ var more_options_text = "<?php echo __("More Options &#187;"); ?>";
0
 
0
       $(document.createElement("a")).attr({
0
         id: "more_options_link",
0
         href: "javascript:void(0)"
0
- }).addClass("more_options_link").html(more_options_text).insertBefore(".buttons")
0
+ }).addClass("more_options_link").append(more_options_text).insertBefore(".buttons")
0
       $("#more_options").clone().insertAfter("#more_options_link").removeClass("js_disabled")
0
 
0
       $("#more_options").wrap("<div></div>")
0
@@ -193,10 +199,10 @@ var Write = {
0
 
0
       $("#more_options_link").click(function(){
0
         if ($("#more_options").parent().css("display") == "none") {
0
- $(this).html("<?php echo __("&laquo; Fewer Options"); ?>")
0
+ $(this).empty().append("<?php echo __("&#171; Fewer Options"); ?>")
0
           Cookie.set("show_more_options", "true", 30)
0
         } else {
0
- $(this).html("<?php echo __("More Options &raquo;"); ?>")
0
+ $(this).empty().append("<?php echo __("More Options &#187;"); ?>")
0
           Cookie.destroy("show_more_options")
0
         }
0
         $("#more_options").parent().slideToggle()
0
@@ -273,7 +279,7 @@ var Extend = {
0
     confirmed: null
0
   },
0
   prepare_info: function(){
0
- $(".description").wrap("<div></div>").parent().hide()
0
+ $(".description:not(.expanded)").wrap("<div></div>").parent().hide()
0
     $(".info_link").click(function(){
0
       $(this).parent().find(".description").parent().slideToggle("normal", Extend.redraw)
0
       return false
0
@@ -302,7 +308,7 @@ var Extend = {
0
 
0
     if ($(".feather").size())
0
       <?php $tip = _f("(tip: drag the tabs on the <a href=\\\"%s\\\">write</a> page to reorder them)", array(url("/admin/?action=write"))); ?>
0
- $(document.createElement("small")).html("<?php echo $tip; ?>").css({
0
+ $(document.createElement("small")).text("<?php echo $tip; ?>").css({
0
         position: "relative",
0
         bottom: "-1em",
0
         display: "block",
0
@@ -365,7 +371,7 @@ var Extend = {
0
         $("#"+ dependee +" .dependencies_list ."+ Extend.Drop.extension.name).hide()
0
 
0
         if ($("#"+ dependee).attr("class").split(" ").find(/needs_(.+)/).length == 0)
0
- $("#"+ dependee).find(".dependencies_message, .dependencies_list, .description").hide().end()
0
+ $("#"+ dependee).find(".description").parent().hide().end()
0
            .draggable({
0
            zIndex: 100,
0
            cancel: "a",
0
@@ -374,10 +380,10 @@ var Extend = {
0
            .css("cursor", "move")
0
       }
0
     } else {
0
- $(".depends_"+ Extend.Drop.extension.name).find(".dependencies_message, .dependencies_list, .description").show()
0
+ $(".depends_"+ Extend.Drop.extension.name).find(".description").parent().show()
0
       $(".depends_"+ Extend.Drop.extension.name)
0
         .find(".dependencies_list")
0
- .append($(document.createElement("li")).html(Extend.Drop.extension.name).addClass(Extend.Drop.extension.name))
0
+ .append($(document.createElement("li")).text(Extend.Drop.extension.name).addClass(Extend.Drop.extension.name))
0
         .end()
0
         .addClass("needs_"+ Extend.Drop.extension.name)
0
     }
...
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
94
95
96
...
222
223
224
 
 
 
 
 
 
...
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
...
148
149
150
151
152
153
154
155
156
0
@@ -16,81 +16,7 @@
0
       $theme_file = THEME_DIR."/forms/feathers/".$post->feather.".php";
0
       $default_file = FEATHERS_DIR."/".$post->feather."/fields.php";
0
 
0
- if ($theme->file_exists("forms/post/edit"))
0
- $theme->load("forms/post/edit", array("post" => $post, "feather" => $feathers[$post->feather]));
0
- else {
0
-?>
0
-<form id="post_edit_form_<?php echo $post->id; ?>" class="inline_edit post_edit" action="<?php echo $config->chyrp_url."/admin/?action=update_post&amp;sub=text&amp;id=".$post->id; ?>" method="post" accept-charset="utf-8">
0
- <h2><?php echo _f("Editing &#8220;%s&#8221;", array(truncate($title, 40, false))); ?></h2>
0
- <br />
0
-<?php foreach ($feathers[$post->feather]->fields as $field): ?>
0
- <p>
0
- <label for="<?php echo $field["attr"]; ?>">
0
- <?php echo $field["label"]; ?>
0
- <?php if (isset($field["optional"]) and $field["optional"]): ?><span class="sub"><?php echo __("(optional)"); ?></span><?php endif; ?>
0
- <?php if (isset($field["help"]) and $field["help"]): ?>
0
- <span class="sub">
0
- <a href="<?php echo url("/admin/?action=help&id=".$field["help"]); ?>" class="help emblem"><img src="<?php echo $config->chyrp_url; ?>/admin/images/icons/help.png" alt="help" /></a>
0
- </span>
0
- <?php endif; ?>
0
- </label>
0
-<?php if ($field["type"] == "text" or $field["type"] == "file"): ?>
0
- <input class="<?php echo $field["type"]; ?><?php if (isset($field["classes"])): ?> <?php echo join(" ", $field["classes"]); ?><?php endif; ?>" type="<?php echo $field["type"]; ?>" name="<?php echo $field["attr"]; ?>" value="<?php echo ((isset($field["no_value"]) and $field["no_value"]) or $field["type"] == "file") ? "" : fix($post->$field["attr"]) ; ?>" id="<?php echo $field["attr"]; ?>" />
0
-<?php elseif ($field["type"] == "text_block"): ?>
0
- <textarea class="wide<?php if (isset($field["classes"])): ?> <?php echo join(" ", $field["classes"]); ?><?php endif; ?>" rows="<?php echo fallback($field["rows"], 12, true); ?>" name="<?php echo $field["attr"]; ?>" id="<?php echo $field["attr"]; ?>" cols="50"><?php echo (isset($field["no_value"]) and $field["no_value"]) ? "" : fix($post->$field["attr"]) ; ?></textarea>
0
-<?php elseif ($field["type"] == "select"): ?>
0
- <select name="<?php echo $field["attr"]; ?>" id="<?php echo $field["attr"]; ?>"<?php if (isset($field["classes"])): ?> class="<?php echo join(" ", $field["classes"]); ?>"<?php endif; ?>>
0
- <?php foreach ($field["options"] as $value => $name): ?>
0
- <option value="<?php echo fix($value); ?>"<?php if (!isset($field["no_value"]) or !$field["no_value"]): selected($value, $post->$field["attr"]); endif; ?>><?php echo fix($name); ?></option>
0
- <?php endforeach; ?>
0
- </select>
0
-<?php endif; ?>
0
- </p>
0
-<?php endforeach; ?>
0
- <a id="more_options_link_<?php echo $post->id; ?>" href="javascript:void(0)" class="more_options_link"><?php echo __("More Options &raquo;"); ?></a>
0
- <div id="more_options_<?php echo $post->id; ?>" class="more_options" style="display: none">
0
-<?php if ($visitor->group()->can("add_post")): ?>
0
- <p>
0
- <label for="status"><?php echo __("Status"); ?></label>
0
- <select name="status" id="status">
0
- <option value="draft"<?php selected("draft", $post->status); ?>><?php echo __("Draft"); ?></option>
0
- <option value="public"<?php selected("public", $post->status); ?>><?php echo __("Public"); ?></option>
0
- <option value="private"<?php selected("private", $post->status); ?>><?php echo __("Private"); ?></option>
0
- <option value="registered_only"<?php selected("registered_only", $post->status); ?>><?php echo __("Registered Only"); ?></option>
0
- </select>
0
- </p>
0
-<?php endif; ?>
0
- <p>
0
- <label for="pinned"><?php echo __("Pinned?"); ?></label>
0
- <input type="checkbox" name="pinned" id="pinned"<?php checked($post->pinned); ?> />&nbsp;
0
- <span class="sub"> <?php echo __("(shows this post above all others)"); ?></span>
0
- </p>
0
- <p>
0
- <label for="slug"><?php echo __("Slug"); ?></label>
0
- <input class="text" type="text" name="slug" value="<?php echo fix($post->url, "html"); ?>" id="slug" />
0
- </p>
0
- <p>
0
- <label for="created_at"><?php echo __("Timestamp"); ?></label>
0
- <input class="text" type="text" name="created_at" value="<?php echo when(__("F jS, Y H:i:s"), $post->created_at); ?>" id="created_at" />
0
- </p>
0
- <p>
0
- <label for="trackbacks"><?php echo __("Trackbacks"); ?></label>
0
- <input class="text" type="text" name="trackbacks" value="" id="trackbacks" />
0
- </p>
0
- <?php $trigger->call("edit_post_options", $post);?>
0
- <div class="clear"></div>
0
- </div>
0
- <br />
0
- <input type="hidden" name="id" value="<?php echo fix($post->id, "html"); ?>" id="id" />
0
- <input type="hidden" name="ajax" value="true" id="ajax" />
0
- <div class="buttons">
0
- <input type="submit" value="<?php echo __("Update"); ?>" accesskey="s" /> <?php echo __("or"); ?>
0
- <a href="javascript:void(0)" id="post_cancel_edit_<?php echo $post->id; ?>" class="cancel"><?php echo __("Cancel"); ?></a>
0
- </div>
0
- <input type="hidden" name="hash" value="<?php echo $config->secure_hashkey; ?>" id="hash" />
0
-</form>
0
-<?php
0
- }
0
+ $theme->load("forms/post/edit", array("post" => $post, "feather" => $feathers[$post->feather]));
0
       break;
0
     case "delete_post":
0
       $post = new Post($_POST['id']);
0
@@ -222,3 +148,9 @@
0
   }
0
 
0
   $trigger->call("ajax");
0
+
0
+ $response = ob_get_contents();
0
+ ob_end_clean();
0
+
0
+ # XHTML compatibility
0
+ echo name2codepoint($response);
...
132
133
134
135
 
136
137
138
...
152
153
154
155
 
156
157
158
...
132
133
134
 
135
136
137
138
...
152
153
154
 
155
156
157
158
0
@@ -132,7 +132,7 @@
0
 
0
       $config = Config::current();
0
       if (!$config->clean_urls or !$clean_urls or ADMIN)
0
- $mark = (strpos($request, "?") and !$only_page) ? "&" : "?" ;
0
+ $mark = (strpos($request, "?") and !$only_page) ? "&amp;" : "?" ;
0
 
0
       return ($config->clean_urls and $clean_urls and !ADMIN) ?
0
        preg_replace("/(\/{$this->name}\/([0-9]+)|$)/", "/".$this->name."/".($this->page + 1), "http://".$_SERVER['HTTP_HOST'].$request, 1) :
0
@@ -152,7 +152,7 @@
0
 
0
       $config = Config::current();
0
       if (!$config->clean_urls or !$clean_urls or ADMIN)
0
- $mark = (strpos($request, "?") and !$only_page) ? "&" : "?" ;
0
+ $mark = (strpos($request, "?") and !$only_page) ? "&amp;" : "?" ;
0
 
0
       return ($config->clean_urls and $clean_urls and !ADMIN) ?
0
        preg_replace("/(\/".$this->name."\/([0-9]+)|$)/", "/".$this->name."/".($this->page - 1), "http://".$_SERVER['HTTP_HOST'].$request, 1) :
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@
0
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
 <head>
0
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
0
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
0
 <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
0
 <title>Twig Template Engine Specification</title>
0
 <style type="text/css">
...
29
30
31
 
 
 
 
 
 
 
32
33
 
34
35
36
...
39
40
41
42
43
44
45
46
47
48
49
50
51
...
267
268
269
270
271
 
 
 
 
 
 
 
 
272
273
274
...
29
30
31
32
33
34
35
36
37
38
39
 
40
41
42
43
...
46
47
48
 
 
 
 
 
 
 
49
50
51
...
267
268
269
 
 
270
271
272
273
274
275
276
277
278
279
280
0
@@ -29,8 +29,15 @@
0
   # Is the requested file index.php?
0
   define('INDEX', (pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_BASENAME) == "index.php"));
0
 
0
+ # Fallback all these definitions.
0
+ if (!defined('JAVASCRIPT')) define('JAVASCRIPT', false);
0
+ if (!defined('ADMIN')) define('ADMIN', false);
0
+ if (!defined('AJAX')) define('AJAX', false);
0
+ if (!defined('XML_RPC')) define('XML_RPC', false);
0
+ if (!defined('TRACKBACK')) define('TRACKBACK', false);
0
+
0
   # Use GZip compression if available.
0
- if (extension_loaded("zlib") and
0
+ if (!AJAX and extension_loaded("zlib") and
0
    !ini_get("zlib.output_compression") and
0
    isset($_SERVER['HTTP_ACCEPT_ENCODING']) and
0
    substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) {
0
@@ -39,13 +46,6 @@
0
   } else
0
     ob_start();
0
 
0
- # Fallback all these definitions.
0
- if (!defined('JAVASCRIPT')) define('JAVASCRIPT', false);
0
- if (!defined('ADMIN')) define('ADMIN', false);
0
- if (!defined('AJAX')) define('AJAX', false);
0
- if (!defined('XML_RPC')) define('XML_RPC', false);
0
- if (!defined('TRACKBACK')) define('TRACKBACK', false);
0
-
0
   if (JAVASCRIPT) {
0
     error_reporting(0);
0
     header("Content-Type: application/x-javascript");
0
@@ -267,8 +267,14 @@
0
   foreach (Horde_Yaml::loadFile(THEME_DIR."/info.yaml") as $key => $val)
0
     $theme->$key = $val;
0
 
0
- if (!JAVASCRIPT and !XML_RPC)
0
- header("Content-type: ".fallback($theme->type, "application/xhtml+xml")."; charset=UTF-8");
0
+ # Only set to application/xhtml+xml if it's not set and they're not in IE
0
+ if (!isset($theme->type) and !substr_count($_SERVER['HTTP_USER_AGENT'], "MSIE"))
0
+ $theme->type = "application/xhtml+xml";
0
+
0
+ if (!JAVASCRIPT and !XML_RPC and !AJAX) # Fall back to text/html; if it's not set they're in IE (see above)
0
+ header("Content-type: ".fallback($theme->type, "text/html")."; charset=UTF-8");
0
+ elseif (AJAX)
0
+ header("Content-type: text/html; charset=UTF-8");
0
 
0
   # These are down here so that the modules are
0
   # initialized after the $_GET values are filled.
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@
0
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
   <head>
0
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0
+ <meta http-equiv="Content-Type" content="<?php echo (isset($theme->type)) ? $theme->type : "text/html" ; ?>; charset=utf-8"/>
0
     <title>Chyrp: <?php echo $title; ?></title>
0
 <?php if (class_exists("Config")): ?>
0
     <script src="<?php echo Config::current()->chyrp_url; ?>/includes/lib/gz.php?file=jquery.js" type="text/javascript" charset="utf-8"></script>
...
28
29
30
31
 
32
33
34
...
28
29
30
 
31
32
33
34
0
@@ -28,7 +28,7 @@
0
     <id>tag:<?php echo $tagged; ?></id>
0
     <updated><?php echo when("c", $updated); ?></updated>
0
     <published><?php echo when("c", $post->created_at); ?></published>
0
- <link rel="alternate" type="text/html" href="<?php echo $trigger->filter($url, "feed_url", $post); ?>" />
0
+ <link rel="alternate" type="<?php echo $theme->type; ?>" href="<?php echo $trigger->filter($url, "feed_url", $post); ?>" />
0
     <author>
0
       <name><?php echo safe(fallback($post->user()->full_name, $post->user()->login, true)); ?></name>
0
 <?php if (!empty($author_uri)): ?>
...
355
356
357
358
 
359
360
 
 
 
 
361
362
363
...
355
356
357
 
358
359
 
360
361
362
363
364
365
366
0
@@ -355,9 +355,12 @@
0
    * Function: fix
0
    * Returns a HTML-sanitized version of a string.
0
    */
0
- function fix($string, $quotes = true) {
0
+ function fix($string, $quotes = true, $decode_first = true) {
0
     $quotes = ($quotes) ? ENT_QUOTES : ENT_NOQUOTES ;
0
- $string = html_entity_decode($string, ENT_QUOTES, "utf-8");
0
+
0
+ if ($decode_first)
0
+ $string = html_entity_decode($string, ENT_QUOTES, "utf-8");
0
+
0
     return htmlspecialchars($string, $quotes, "utf-8");
0
   }
0
 
...
42
43
44
45
46
 
 
47
48
49
 
 
50
51
 
52
53
54
...
42
43
44
 
 
45
46
47
 
 
48
49
50
 
51
52
53
54
0
@@ -42,13 +42,13 @@ var Post = {
0
 <?php $trigger->call("ajax_post_edit_form_javascript"); ?>
0
           $("#more_options_link_"+id).click(function(){
0
             if ($("#more_options_"+id).css("display") == "none") {
0
- $(this).html("<?php echo __("&laquo; Fewer Options"); ?>")
0
- $("#more_options_"+id).slideDown("slow")
0
+ $(this).empty().append("<?php echo __("&#171; Fewer Options"); ?>")
0
+ $("#more_options_"+id).slideDown("slow");
0
             } else {
0
- $(this).html("<?php echo __("More Options &raquo;"); ?>")
0
- $("#more_options_"+id).slideUp("slow")
0
+ $(this).empty().append("<?php echo __("More Options &#187;"); ?>")
0
+ $("#more_options_"+id).slideUp("slow");
0
             }
0
- return false
0
+ return false;
0
           })
0
           $("#post_edit_form_"+id).ajaxForm({ beforeSubmit: function(){
0
             $("#post_edit_form_"+id).loader()
...
182
183
184
185
 
 
 
186
187
188
 
 
 
 
189
190
191
 
192
193
 
194
195
196
...
243
244
245
 
246
247
 
248
249
250
...
254
255
256
257
258
259
260
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
...
182
183
184
 
185
186
187
188
 
 
189
190
191
192
193
194
 
195
196
 
197
198
199
200
...
247
248
249
250
251
 
252
253
254
255
...
259
260
261
 
 
 
 
 
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
0
@@ -182,15 +182,19 @@ $(this).parent().find("ul:first").append(ui.draggable);self.element.data("sortab
0
  */
0
 (function(jQuery){var self=null;jQuery.fn.autogrow=function(o)
0
 {return this.each(function(){new jQuery.autogrow(th