+++ /dev/null
-<?php
-
-error_reporting(E_ALL);
-require_once 'Text/Wiki.php';
-
-
-/**
-*
-* Gets microtime; for timing how long it takes to process code.
-*
-*/
-
-function getmicrotime()
-{
- list($usec, $sec) = explode(" ",microtime());
- return ((float)$usec + (float)$sec);
-}
-
-// Set up the wiki options
-$options = array();
-$options['view_url'] = "index.php?page=";
-
-
-// Get the list of existing wiki pages, based on the .wiki.txt
-// files in the current directory.
-$options['pages'] = array();
-
-$dir = opendir(dirname(__FILE__));
-
-while ($file = readdir($dir)) {
- if (substr($file, -9) == '.wiki.txt') {
- $options['pages'][] = substr($file, 0, -9);
- }
-}
-
-closedir($dir);
-
-// what page is being requested?
-if (isset($_GET['page'])) {
- $page = $_GET['page'];
-} else {
- $page = 'HomePage';
-}
-
-// load the text for the requested page
-$text = implode('', file($page . '.wiki.txt'));
-
-// create a Wiki objext with the loaded options
-$wiki =& new Text_Wiki($options);
-
-// time the operation, and transform the wiki text.
-$before = getMicroTime();
-$output = $wiki->transform($text);
-$after = getMicroTime();
-$time = (float)$after - (float)$before;
-
-
-// output the page!
-?>
-<?xml version="1.0" encoding="iso-8859-1" ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
- <head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- <title>Text_Wiki::<?php echo $page ?></title>
- <link rel="stylesheet" href="stylesheet.css" type="text/css" />
- </head>
-
- <body>
- <?php echo $output ?>
- <?php echo "<hr /><p>Transformed in $time seconds.</p>" ?>
- </body>
-</html>
* Fix PHP 5.2.0 compatibility issue. (garvinhicking)
* Add testsuite (nohn)
-
+
* Some minor 1.1 bug backports:
-
+
- Fix a problem where spartacus did not properly assign configured
permissions to downloaded directories, thanks to danilo from
the forums! (garvinhicking)
- "View Article" in "Save Entry" dialog (nohn)
-
+
+ - Fix possible integer wraparound in comment count leading to
+ a gazillion counter state. Also now show links to the entries
+ within the administration comment panel. Thanks to Julian Finn!
+
+ - Fix bug with using %username% in author permalinks, thanks to oeli
+ from the forums! (garvinhicking)
+
+ - Fix a problem where spartacus did not properly assign configured
+ permissions to downloaded directories, thanks to danilo from
+ the forums!
+
+ - Move trackback sending logic to the end when saving an entry.
+ Should get rid of event plugins not operating when trackbacks
+ painfully fail. Thanks to isotopp (garvinhicking)
+
+ - Fixed bug that prevented native imports from other blog system
+ to recode ISO-charsets into UTF-8. Major thanks to Jan of
+ blog.salid.de. (garvinhicking)
+
Version 1.0.2 (October 18th, 2006)
------------------------------------------------------------------------
Version 1.0.1 (August 14th, 2006)
------------------------------------------------------------------------
-
+
* Fix problem on newer Firefox versions, where insertion of images
in the WYSIWYG editor did not work. It might be necessary to
purge your browsers cache for this to properly work. (Jay Bertrandt)
* Fix utf8 iconv conversion failing on some older PHP setups.
Thanks to Matthias Leisi!
-
+
* Fix multi-authors view only showing first author (garvinhicking)
- * Fix bug sending comment-notification mails to subscribed users
+ * Fix bug sending comment-notification mails to subscribed users
without an email address (garvinhicking)
* Fixed icelandic language bug preventing upgrade (garvinhicking)
<tr>
<td><?php echo COMMENTS; ?>:</td>
<td><select name="serendipity[filter][perpage]">
- <?php
+ <?php
$filter_vals = array(10, 20, 50, COMMENTS_FILTER_ALL);
foreach($filter_vals AS $filter_val) { ?>
<option value="<?php echo $filter_val; ?>" <?php echo ($commentsPerPage == $filter_val ? ' selected="selected"' : ''); ?>><?php echo $filter_val; ?></option>
'referer' => $rs['referer'],
'url' => $rs['url'],
'ip' => $rs['ip'],
+ 'entry_url' => serendipity_archiveURL($rs['entry_id'], $rs['title']),
'email' => $rs['email'],
'author' => (empty($rs['author']) ? ANONYMOUS : $rs['author']),
'entry_id' => $rs['entry_id']
$comment['fullBody'] = $comment['summary'] = nl2br(htmlspecialchars($comment['fullBody']));
}
-
+
serendipity_plugin_api::hook_event('backend_view_comment', $comment);
$class = 'serendipity_admin_list_item_' . (($i % 2 == 0 ) ? 'even' : 'uneven');
$header_class = ($comment['status'] == 'pending' ? 'serendipityAdminMsgNote' : '');
?>
<tr>
<td class="<?php echo $header_class; ?>"><a name="c<?php echo $comment['id'] ?>"></a>
- <?php echo ($comment['type'] == 'NORMAL' ? COMMENT : TRACKBACK) . ' #'. $comment['id'] .', '. IN_REPLY_TO .' <strong>'. $comment['title'] .'</strong>, '. ON . ' ' . serendipity_mb('ucfirst', serendipity_strftime('%b %e %Y, %H:%M', $comment['timestamp']))?>
+ <?php echo ($comment['type'] == 'NORMAL' ? COMMENT : TRACKBACK) . ' #'. $comment['id'] .', '. IN_REPLY_TO .' <strong><a href="' . $comment['entry_url'] . '">'. $comment['title'] .'</a></strong>, '. ON . ' ' . serendipity_mb('ucfirst', serendipity_strftime('%b %e %Y, %H:%M', $comment['timestamp']))?>
</td>
</tr>
<tr>
/* Class construct. Each importer plugin must extend this class. */
class Serendipity_Import {
var $trans_table = '';
+ var $force_recode = true;
/**
* Return textual notes of an importer plugin
* @access public
* @return string HTML-code of a interface/user hint
*/
- function getImportNotes() {
- return "";
+ function getImportNotes() {
+ return "";
}
/**
*/
function getCharsets($utf8_default = true) {
$charsets = array();
-
+
if (!$utf8_default) {
$charsets['native'] = LANG_CHARSET;
}
if (LANG_CHARSET != 'ISO-8859-1') {
$charsets['ISO-8859-1'] = 'ISO-8859-1';
}
-
+
if ($utf8_default) {
$charsets['native'] = LANG_CHARSET;
}
-
+
return $charsets;
}
*/
function &decode($string) {
// xml_parser_* functions to recoding from ISO-8859-1/UTF-8
- if (LANG_CHARSET == 'ISO-8859-1' || LANG_CHARSET == 'UTF-8') {
+ if (!$this->force_decode && (LANG_CHARSET == 'ISO-8859-1' || LANG_CHARSET == 'UTF-8')) {
return $string;
}
$out = iconv('ISO-8859-1', LANG_CHARSET, $string);
} elseif (function_exists('recode')) {
$out = recode('iso-8859-1..' . LANG_CHARSET, $string);
+ } elseif (LANG_CHARSET == 'UTF-8') {
+ return utf8_encode($string);
} else {
return $string;
}
return $out;
-
+
case 'UTF-8':
default:
$out = utf8_decode($string);
return $data;
}
-
+
/**
* Get the transcoding table, depending on whether it was enabled for the instance of the importer plugin
*
var $info = array('software' => IMPORT_GENERIC_RSS);
var $data = array();
var $inputFields = array();
+ var $force_recode = false;
function Serendipity_Import_Generic($data) {
$this->data = $data;
# Copyright (c) 2003-2005, Tim Putnam
/*****************************************************************
- * VoodooPad Importer, by Tim Putnam
+ * VoodooPad Importer, by Tim Putnam
* http://deepbluesea.fracsoft.com *
*****************************************************************/
var $info = array('software' => 'VoodooPad');
var $data = array();
var $inputFields = array();
-
+ var $force_recode = false;
+
function Serendipity_Import_VoodooPad($data) {
$this->data = $data;
$this->inputFields = array(
$file = $_FILES['serendipity']['tmp_name']['import']['voodooPadXML'];
// Create a parser and set it up with the callbacks
- $xml_parser = xml_parser_create('');
+ $xml_parser = xml_parser_create('');
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($xml_parser, "start_element_handler", "end_element_handler");
xml_set_character_data_handler($xml_parser, "character_data_handler");
if (!file_exists($file)) {
die(sprintf(DOCUMENT_NOT_FOUND, htmlspecialchars($file)));
}
-
+
if(!($handle = fopen($file, "r"))) {
die(sprintf(SKIPPING_FILE_UNREADABLE, htmlspecialchars($file)));
}
// so loop through building and/or updating page objects
while(list($key_a) = each($elements)) {
$name = $elements[$key_a]->name;
-
+
switch ($name) {
case 'data': // <data> indicates the start of the VoodooPad entry, so create page object
$thispage = array();
$mykey = basename($this->data['keyPrefix']) . $mykey;
// Pluck out the existing one if its there
- $page = serendipity_db_query("SELECT *
- FROM {$serendipity['dbPrefix']}staticpages
+ $page = serendipity_db_query("SELECT *
+ FROM {$serendipity['dbPrefix']}staticpages
WHERE filename = '" . serendipity_db_escape_string($mykey.'.htm') . "'
LIMIT 1", true, 'assoc');
if (is_array($page)) {
$thispage['timestamp'] = time();
}
}
-
+
$thispage['filename'] = $mykey.'.htm';
// Thanks for pointing this out to me and not just fixing it, I'm learning.
$thispage['permalink'] = $serendipity['serendipityHTTPPath'] . 'index.php?serendipity[subpage]=' . $mykey;
if (!isset($thispage['id'])) {
echo '<br/>'.IMPORTER_VOODOO_CREATINGPAGE.': '. $mykey;
serendipity_db_insert('staticpages', $thispage);
- $serendipity["POST"]["staticpage"] = serendipity_db_insert_id("staticpages", 'id');
+ $serendipity["POST"]["staticpage"] = serendipity_db_insert_id("staticpages", 'id');
} elseif ($this->data['updateExisting'] == 'true') {
echo '<br/>'.IMPORTER_VOODOO_UPDATINGPAGE.': '. $mykey;
serendipity_db_update("staticpages", array("id" => $thispage["id"]), $thispage);
echo '<br/>'.IMPORTER_VOODOO_RECORDURL.': '.$thispage['headline'];
$aliases[$thispage['headline']] = $thispage['content'];
}
- break;
+ break;
}
}
// **TODO** Change this to pull out only entries for the current wiki
echo '<br/><p>'.IMPORTER_VOODOO_WRITEINTRALINKS.'</p>';
-
- $pages= &serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}staticpages ORDER BY pagetitle DESC");
-
+
+ $pages= &serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}staticpages ORDER BY pagetitle DESC");
+
foreach ($pages as $thispage) {
// Parse the content string
foreach ($aliases as $alias => $permalink) {
for ($counter = 0; $counter <= 12; $counter+=1) {
unset ($thispage[$counter]);
}
-
+
// Write back to the database
serendipity_db_update("staticpages", array("id" => $thispage["id"]), $thispage);
}
-
+
echo DONE . '<br />';
- }
+ }
// Search and replace avoiding content of links
// **TODO** Fix this to avoid short links screwing up longer links
$ns = '';
for ($i = 0; $i < count($r); $i++) {
if ($r[$i] == "<") {
- $i+=2;
+ $i+=2;
continue;
}
$r[$i] = eregi_replace(sql_regcase($alias), '<a href="'.$link.'">'.$alias.'</a>', $r[$i]);
}
return join("", $r);
- }
+ }
}
-
+
// XML Parser callbacks
function start_element_handler($parser, $name, $attribs){
global $elements, $stack, $count, $depth;
$element = new element;
$elements[$id] = $element;
$elements[$id]->name = $name;
-
+
while(list($key, $value) = each($attribs)) {
$elements[$id]->attributes[$key] = $value;
}
-
+
$elements[$id]->depth = $depth;
array_push($stack, $id);
-
+
$count++;
$depth++;
}
function end_element_handler($parser, $name){
global $stack, $depth;
-
+
array_pop($stack);
-
+
$depth--;
}
function character_data_handler($parser, $data){
global $elements, $stack;
-
+
$elements[$stack[count($stack)-1]]->data .= $data;
}
} else {
$type = 'comments';
}
- serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id);
+ serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id . " AND $type > 0 $admin");
}
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id);
}
if (isset($serendipity['COOKIE']['serendipityLanguage'])) {
- serendipity_header('X-Serendipity-InterfaceLangSource: Cookie');
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Cookie');
$lang = $serendipity['COOKIE']['serendipityLanguage'];
} elseif (!empty($serendipity['languages'][$serendipity['GET']['lang_selected']])) {
- serendipity_header('X-Serendipity-InterfaceLangSource: GET');
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: GET');
$lang = $serendipity['GET']['lang_selected'];
} elseif (serendipity_db_bool($serendipity['lang_content_negotiation'])) {
- serendipity_header('X-Serendipity-InterfaceLangSource: Content-Negotiation');
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Content-Negotiation');
$lang = serendipity_detectLang();
} elseif ($_SESSION['serendipityAuthedUser']) {
- serendipity_header('X-Serendipity-InterfaceLangSource: Database');
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Database');
$lang = $serendipity['lang'];
}
$lang = $serendipity['lang'];
}
- serendipity_header('X-Serendipity-InterfaceLang: ' . $lang);
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLang: ' . $lang);
if ($lang != $serendipity['lang']) {
$serendipity['content_lang'] = $lang;
}
if (!$_SESSION['serendipityRightPublish']) {
- unset($entry['isdraft']);
+ $entry['isdraft'] = 'true';
}
if (is_array($categories)) {
if (!serendipity_db_bool($entry['isdraft'])) {
serendipity_plugin_api::hook_event('frontend_display', $entry, array('no_scramble' => true, 'from' => 'functions_entries:updertEntry'));
- serendipity_handle_references($entry['id'], $serendipity['blogTitle'], $entry['title'], $entry['body'] . $entry['extended'], $newEntry);
}
serendipity_purgeEntry($entry['id'], $entry['timestamp']);
serendipity_plugin_api::hook_event('backend_save', $entry, $newEntry);
}
+ if (!serendipity_db_bool($entry['isdraft'])) {
+ serendipity_handle_references($entry['id'], $serendipity['blogTitle'], $entry['title'], $entry['body'] . $entry['extended'], $newEntry);
+ }
+
return (int)$entry['id'];
}
// We need to set this to return a 200 since we use .htaccess ErrorDocument
// rules to handle archives.
header('HTTP/1.0 200');
-header('X-Blog: Serendipity'); // Used for installer detection
+if ($serendipity['expose_s9y']) {
+ header('X-Blog: Serendipity'); // Used for installer detection
+}
// Session are needed to also remember an autologin user on the frontend
ob_start();
if (!isset($_GET['type'])) {
$_GET['type'] = 'content';
}
+$serendipity['view'] = 'feed';
if (!empty($_SERVER['HTTP_USER_AGENT']) && stristr($_SERVER['HTTP_USER_AGENT'], 'feedburner')) {
$_GET['nocache'] = true;
$serendipity['use_PEAR'] = false;
}
+if (!isset($serendipity['expose_s9y'])) {
+ $serendipity['expose_s9y'] = true;
+}
+
// Should IFRAMEs be used for previewing entries and sending trackbacks?
$serendipity['use_iframe'] = true;