]> git.mjollnir.org Git - s9y.git/commitdiff
Backport various 1.1 stuff for a 1.0.3 release
authorgarvinhicking <garvinhicking>
Sun, 5 Nov 2006 11:19:55 +0000 (11:19 +0000)
committergarvinhicking <garvinhicking>
Sun, 5 Nov 2006 11:19:55 +0000 (11:19 +0000)
12 files changed:
bundled-libs/docs/index.php [deleted file]
docs/NEWS
include/admin/comments.inc.php
include/admin/import.inc.php
include/admin/importers/generic.inc.php
include/admin/importers/voodoopad.inc.php [changed mode: 0644->0755]
include/functions_comments.inc.php
include/functions_config.inc.php
include/functions_entries.inc.php
index.php
rss.php
serendipity_config.inc.php

diff --git a/bundled-libs/docs/index.php b/bundled-libs/docs/index.php
deleted file mode 100644 (file)
index a4c6c12..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?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>
index f1563fedda9bb858ec5b72200052c5e214f78799..5839b5156783ecbb46fe9ddfe00f90e2a55cf19d 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -6,15 +6,34 @@ Version 1.0.3 ()
    * 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)
 ------------------------------------------------------------------------
 
@@ -23,17 +42,17 @@ 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)
index 5807f5a9100bba7167813266fdb09ba2f36f5e3c..3ea5c81f6cbdb286d078e49e4f4098f699a7e5cc 100644 (file)
@@ -226,7 +226,7 @@ function highlightComment(id, checkvalue) {
     <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>
@@ -297,6 +297,7 @@ foreach ($sql as $rs) {
         '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']
@@ -314,14 +315,14 @@ foreach ($sql as $rs) {
 
         $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>
index f03915d77e2eabf0a5b25b444e6ec52bd4d72cdb..24055d3e62b996f131ac9b461cc3c22448294103 100644 (file)
@@ -16,6 +16,7 @@ if (!serendipity_checkPermission('adminImport')) {
 /* 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
@@ -25,8 +26,8 @@ class Serendipity_Import {
  * @access public
  * @return string  HTML-code of a interface/user hint
  */
-    function getImportNotes() { 
-        return ""; 
+    function getImportNotes() {
+        return "";
     }
 
 /**
@@ -38,7 +39,7 @@ class Serendipity_Import {
  */
     function getCharsets($utf8_default = true) {
         $charsets = array();
-        
+
         if (!$utf8_default) {
             $charsets['native'] = LANG_CHARSET;
         }
@@ -50,11 +51,11 @@ class Serendipity_Import {
         if (LANG_CHARSET != 'ISO-8859-1') {
             $charsets['ISO-8859-1'] = 'ISO-8859-1';
         }
-        
+
         if ($utf8_default) {
             $charsets['native'] = LANG_CHARSET;
         }
-        
+
         return $charsets;
     }
 
@@ -67,7 +68,7 @@ class Serendipity_Import {
  */
     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;
         }
 
@@ -82,11 +83,13 @@ class Serendipity_Import {
                     $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);
@@ -126,7 +129,7 @@ class Serendipity_Import {
 
         return $data;
     }
-    
+
 /**
  * Get the transcoding table, depending on whether it was enabled for the instance of the importer plugin
  *
index 66b65479aed2482495059c28f55e692f7659ae11..fe38f2145a6f132792dd6607c6f1d8b1937993ca 100644 (file)
@@ -8,6 +8,7 @@ class Serendipity_Import_Generic extends Serendipity_Import {
     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;
old mode 100644 (file)
new mode 100755 (executable)
index f52c970..daab11e
@@ -2,7 +2,7 @@
 # Copyright (c) 2003-2005, Tim Putnam
 
 /*****************************************************************
- *                VoodooPad Importer, by Tim Putnam 
+ *                VoodooPad Importer, by Tim Putnam
  *               http://deepbluesea.fracsoft.com  *
  *****************************************************************/
 
@@ -38,7 +38,8 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
     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(
@@ -88,7 +89,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
         $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");
@@ -97,7 +98,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
         if (!file_exists($file)) {
             die(sprintf(DOCUMENT_NOT_FOUND, htmlspecialchars($file)));
         }
-                       
+
         if(!($handle = fopen($file, "r"))) {
             die(sprintf(SKIPPING_FILE_UNREADABLE, htmlspecialchars($file)));
         }
@@ -116,7 +117,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
         // 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();
@@ -127,8 +128,8 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
                     $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)) {
@@ -137,7 +138,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
                               $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;
@@ -161,7 +162,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
                         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);
@@ -173,7 +174,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
                         echo '<br/>'.IMPORTER_VOODOO_RECORDURL.': '.$thispage['headline'];
                         $aliases[$thispage['headline']] = $thispage['content'];
                     }
-                    break;                      
+                    break;
             }
         }
 
@@ -192,9 +193,9 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
 
         // **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) {
@@ -204,13 +205,13 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
             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
@@ -219,16 +220,16 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
         $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;
@@ -237,29 +238,29 @@ function start_element_handler($parser, $name, $attribs){
     $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;
 }
 
index ea1bb8fc6c0f61dd71599cc01e36f6c9a171f715..b8d58e8b259f43be50b9ae09d5529ae0703c45d1 100644 (file)
@@ -324,7 +324,7 @@ function serendipity_deleteComment($id, $entry_id, $type='comments') {
             } 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);
index 7a4de1f380c29fea2bc4364f2cc5cd90f97330ce..34509e0c6e224209f403e26ad7d094db4175d436 100644 (file)
@@ -722,16 +722,16 @@ function serendipity_getSessionLanguage() {
     }
 
     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'];
     }
 
@@ -739,7 +739,7 @@ function serendipity_getSessionLanguage() {
         $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;
index 9c1a8e64d07f7e64f450cb1c6e174bb65ce6f66f..6cb5d945d9a5bcc581b260a27f7bd16a6fa01e6c 100644 (file)
@@ -1161,7 +1161,7 @@ function serendipity_updertEntry($entry) {
         }
 
         if (!$_SESSION['serendipityRightPublish']) {
-            unset($entry['isdraft']);
+            $entry['isdraft'] = 'true';
         }
 
         if (is_array($categories)) {
@@ -1189,7 +1189,6 @@ function serendipity_updertEntry($entry) {
 
     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']);
@@ -1203,6 +1202,10 @@ function serendipity_updertEntry($entry) {
         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'];
 }
 
index 4c2733b2d3f86358be74350550edf3c6cd0b643f..3d9ff879e5b01cd59398d358e0da28f97709e339 100644 (file)
--- a/index.php
+++ b/index.php
@@ -17,7 +17,9 @@ if ($global_debug) {
 // 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();
diff --git a/rss.php b/rss.php
index 1dfe2b9857954b4c08379786670536766ab6cf3b..0db740eccc14dfdf22a738b292aaed148ab398ed 100644 (file)
--- a/rss.php
+++ b/rss.php
@@ -27,6 +27,7 @@ if (isset($_GET['viewAuthor'])) {
 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;
index 5e64cfd0f7ee93d8f5ffe7428b5ed1ea03ff93ce..ddb63ce92bf8b52893f0dcd0185f296c75196228 100644 (file)
@@ -68,6 +68,10 @@ if (!isset($serendipity['use_PEAR'])) {
     $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;