Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv10880
Modified Files:
index.php
Log Message:
output utf8 for rss feeds
Index: index.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/index.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- index.php 3 Jul 2003 21:42:39 -0000 1.15
+++ index.php 3 Jul 2003 22:15:47 -0000 1.16
@@ -2,92 +2,94 @@
// We need to set this to return a 200 since we use .htaccess ErrorDocument
// rules to handle archives.
header("HTTP/1.0 200\r\n");
-header("Content-Type: text/html; charset=ISO-8859-1");
include_once("serendipity_config.inc.php");
$track_referer = true;
$uri = $_SERVER['REQUEST_URI'];
if (preg_match('@/archives/(\d+)\.html@', $uri, $matches)) {
- $range = $matches[1];
- $_GET['serendipity']['action'] = "read";
- $_GET['serendipity']['range'] = $range;
+ header("Content-Type: text/html; charset=ISO-8859-1");
+ $range = $matches[1];
+ $_GET['serendipity']['action'] = "read";
+ $_GET['serendipity']['range'] = $range;
- if (strlen($range) == 6) {
- $date = date("m/Y", mktime(0,0,0, substr($range, 4, 6), 2, substr($range, 0, 4)));
- } else {
- $date = date("d/m/Y", strtotime($range));
- }
+ if (strlen($range) == 6) {
+ $date = date("m/Y", mktime(0,0,0, substr($range, 4, 6), 2, substr($range, 0, 4)));
+ } else {
+ $date = date("d/m/Y", strtotime($range));
+ }
- $serendipity['blogSubTitle'] = "Entries for $date";
- ob_start();
- include_once("serendipity_genpage.inc.php");
- $data = ob_get_contents();
- ob_end_clean();
+ $serendipity['blogSubTitle'] = "Entries for $date";
+ ob_start();
+ include_once("serendipity_genpage.inc.php");
+ $data = ob_get_contents();
+ ob_end_clean();
- if ($serendipity['pregenerate']) {
- $fp = fopen("./archives/{$matches[1]}", "w");
- fwrite($fp, $data);
- fclose($fp);
- }
+ if ($serendipity['pregenerate']) {
+ $fp = fopen("./archives/{$matches[1]}", "w");
+ fwrite($fp, $data);
+ fclose($fp);
+ }
- echo $data;
+ echo $data;
}
else
if (preg_match('@/archives/(\d+)_short\.html@', $uri, $matches)) {
- $range = $matches[1];
- $_GET['serendipity']['action'] = "read";
- $_GET['serendipity']['range'] = $range;
- $_GET['serendipity']['short'] = true;
+ header("Content-Type: text/html; charset=ISO-8859-1");
+ $range = $matches[1];
+ $_GET['serendipity']['action'] = "read";
+ $_GET['serendipity']['range'] = $range;
+ $_GET['serendipity']['short'] = true;
- if (strlen($range) == 6) {
- $date = date("m/Y", mktime(0,0,0, substr($range, 4, 6), 2, substr($range, 0, 4)));
- } else {
- $date = date("d/m/Y", strtotime($range));
- }
+ if (strlen($range) == 6) {
+ $date = date("m/Y", mktime(0,0,0, substr($range, 4, 6), 2, substr($range, 0, 4)));
+ } else {
+ $date = date("d/m/Y", strtotime($range));
+ }
- $serendipity['blogSubTitle'] = "Topics for $date";
- ob_start();
- include_once("serendipity_genpage.inc.php");
- $data = ob_get_contents();
- ob_end_clean();
+ $serendipity['blogSubTitle'] = "Topics for $date";
+ ob_start();
+ include_once("serendipity_genpage.inc.php");
+ $data = ob_get_contents();
+ ob_end_clean();
- if ($serendipity['pregenerate']) {
- $fp = fopen("./archives/{$matches[1]}", "w");
- fwrite($fp, $data);
- fclose($fp);
- }
+ if ($serendipity['pregenerate']) {
+ $fp = fopen("./archives/{$matches[1]}", "w");
+ fwrite($fp, $data);
+ fclose($fp);
+ }
- echo $data;
+ echo $data;
}
else if (preg_match('@/(\d+)_\w*\.html@i', $uri, $matches)) {
- $id = $matches[1];
+ header("Content-Type: text/html; charset=ISO-8859-1");
+ $id = $matches[1];
serendipity_track_referrer($id);
$track_referer = false;
- $_GET['serendipity']['action'] = 'read';
- $_GET['serendipity']['id'] = $id;
+ $_GET['serendipity']['action'] = 'read';
+ $_GET['serendipity']['id'] = $id;
- $title = serendipity_db_query("SELECT title FROM {$serendipity['dbPrefix']}entries " .
+ $title = serendipity_db_query("SELECT title FROM {$serendipity['dbPrefix']}entries " .
'WHERE id=' . serendipity_db_escape_string($id), true);
- $title = $title[0];
+ $title = $title[0];
- $serendipity['blogTitle'] = htmlspecialchars($title);
+ $serendipity['blogTitle'] = htmlspecialchars($title);
- ob_start();
- include_once("serendipity_genpage.inc.php");
- $data = ob_get_contents();
- ob_end_clean();
+ ob_start();
+ include_once("serendipity_genpage.inc.php");
+ $data = ob_get_contents();
+ ob_end_clean();
- if ($serendipity['pregenerate']) {
+ if ($serendipity['pregenerate']) {
$fp = fopen("./archives/{$matches[1]}", "w");
fwrite($fp, $data);
fclose($fp);
- }
- print $data;
-
+ }
+ print $data;
} else if (preg_match('@/feeds/@', $uri)) {
+ header("Content-Type: text/html; charset=utf-8");
if (preg_match('@/index.(rss|rdf|rss2)$@', $uri, $matches)) {
switch ($matches[1]) {
case 'rss':
@@ -121,9 +123,11 @@
exit;
}
else if (preg_match('@/archive$@', $uri)) {
+ header("Content-Type: text/html; charset=ISO-8859-1");
$serendipity['GET']['action']="archives";
include_once("serendipity_genpage.inc.php");
} else if (preg_match('@/(index\.(php|html))?@', $uri)) {
+ header("Content-Type: text/html; charset=ISO-8859-1");
if (count($serendipity['GET']) == 2) {
ob_start();
include_once("serendipity_genpage.inc.php");
|