]> git.mjollnir.org Git - s9y.git/commitdiff
Allow to browse comments by authors, allow template specific language includes
authorgarvinhicking <garvinhicking>
Sun, 30 Jul 2006 10:54:09 +0000 (10:54 +0000)
committergarvinhicking <garvinhicking>
Sun, 30 Jul 2006 10:54:09 +0000 (10:54 +0000)
31 files changed:
docs/NEWS
include/functions_comments.inc.php
include/functions_entries.inc.php
include/functions_installer.inc.php
include/functions_permalinks.inc.php
include/genpage.inc.php
include/lang.inc.php
include/tpl/config_local.inc.php
include/tpl/htaccess_cgi_rewrite.tpl
include/tpl/htaccess_rewrite.tpl
index.php
lang/UTF-8/serendipity_lang_cn.inc.php
lang/UTF-8/serendipity_lang_cs.inc.php
lang/UTF-8/serendipity_lang_cz.inc.php
lang/UTF-8/serendipity_lang_da.inc.php
lang/UTF-8/serendipity_lang_de.inc.php
lang/UTF-8/serendipity_lang_en.inc.php
lang/UTF-8/serendipity_lang_es.inc.php
lang/UTF-8/serendipity_lang_fa.inc.php
lang/UTF-8/serendipity_lang_fi.inc.php
lang/UTF-8/serendipity_lang_fr.inc.php
lang/UTF-8/serendipity_lang_is.inc.php
lang/UTF-8/serendipity_lang_ja.inc.php
lang/UTF-8/serendipity_lang_ko.inc.php
lang/UTF-8/serendipity_lang_nl.inc.php
lang/UTF-8/serendipity_lang_no.inc.php
lang/UTF-8/serendipity_lang_pt.inc.php
lang/UTF-8/serendipity_lang_ru.inc.php
lang/UTF-8/serendipity_lang_tn.inc.php
lang/UTF-8/serendipity_lang_tw.inc.php
lang/UTF-8/serendipity_lang_zh.inc.php

index 66d141a6fc461f407739dd3be668bdce7df24863..519cdcda81941504a3bf0404075a5cb75769ce4d 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -1,8 +1,239 @@
 # $Id$
 
+Version 1.1-alpha7()
+------------------------------------------------------------------------
+
+    * Add new template 'comments_by_author' which show comments made
+      by authors. New permalink structure:
+       "/comments/[AUTHORNAME]/comments|trackbacks|comments_and_trackbacks/P[PAGENUMBER]/FROM [YYYY-MM-DD]/TO [YYYY-MM-DD]"
+      (garvinhicking)
+
+    * Add "Comments and Trackbacks" feed feature (stm99..)
+
+    * Add LiveJournal XML importer (garvinhicking)
+
+    * Fix not fetching allow_comments/moderate_comments value when
+      inside search function. Thanks to stm! (garvinhicking)
+
+    * Add new links to check for upgradable SPARTACUS plugins
+      (garvinhicking)
+
+    * Add new frontend view "Archive by Authors": /archive/Axx.html to
+      view the archive listing for specific authors only (like viewing
+      archive by specific categories only via /archive/Cxx.html etc.)
+      (garvinhicking)
+
+    * Templating: Add new {$entry.html_title} variable that holds
+      unescaped HTML code of the Entry's title (garvinhicking)
+
+    * BC-Break / Plugin API change: The serendipity_getTemplate() file
+      now no longer returns FALSE when a file is not found, but instead
+      the filename without a path. This is required so that the smarty-
+      created error message contains the missing filename instead of an
+      empty '' string.
+      Plugins based on this function need to make sure that they will
+      now properly use a file_exists() check on the returned function,
+      if they want to probe different locations of a file.
+      All template files containing the string "plugin" will still return
+      FALSE for the function call, to circumvent problems with spartacus
+      plugins.
+      Bottom line: Plugins that use "*plugin*.tpl" filenames or check
+      via file_exists() on the returned variable are safe.
+      (garvinhicking)
+      
+    * Added arabic (sa) language by Way
+
+    * Add patch to allow entryproperties plugin to define passwords for
+      specific entries (Falk Döring)
+
+    * Made smarty function "serendipity_printComments" accept to new
+      parameters: "order" (ASC/DESC) and "limit" (garvinhicking)
+
+    * Comment moderation panel, usability improvement: Blocking authors/
+      URLs will lead to the originating page. Thanks to Tanel Raja!
+      (garvinhicking)
+
+    * Patch mb-functions to better work on foreign/japanese charsets
+      (thanks to deminy!)
+
+    * Replaced core smarty assign() calls to assign_by_ref() where
+      appropriate. (Falk Döring, garvinhicking)
+      TODO: This might introduce oddities! Check thoroughly.
+
+    * Fixed not showing entries in the quicksearch that have the
+      "no frontpage" entryproperty set (garvinhicking)
+
+    * Fixed sidebar category plugin to show proper category listing
+      for permission-based restrictions, when "current autho" mode
+      is selected (garvinhicking)
+
+    * Added experimental XML-engine, for XSLT templating support
+      (garvinhicking)
+
+    * Added experimental PHP-engine templating support, bypassing
+      Smarty. Work in progress, mostly proof-of-concept. Might
+      be changed completely. Read instructions in the 
+      include/template_api.inc.php file. Dedicated to Davey. ;)
+      (garvinhicking)
+
+    * Support to crop images from within the media database. Pick a
+      picture in the MDB, go to the property section of that image
+      and click on the "EDIT" link. (garvinhicking)
+      
+        TODO:
+            - Operate also on PNG, TIFF etc. (currently only JPEG!)
+            - Support image magick (currently ony gdlib!)
+            - Currently backup files are scattered around, fix this.
+            - Interface cleanup
+            - Add options to only affect the images thumbnail instead
+              of always saving the whole picture.
+            - Internationalization!
+        
+    * Move the DB charset option to serendipity_config_local.inc.php to
+      issue propper DB connections instantly. (garvinhicking)
+
+Version 1.1-alpha6()
+------------------------------------------------------------------------
+
+    * Use possibly existing local PEAR by default. Patch by Davey 
+      (garvinhicking)
+
+    * Add missing indices for the statistics visitor DB tables
+      (garvinhicking)
+
+    * Add new "custom" property bag type, which can emit any kind of
+      custom HTML/JS values. Current property bag value can be referenced
+      by DOM GetElementById('config_plugin_XXX') if you want to emit
+      specific JavaScript. Can also be used by template configurator for
+      heavily customized output. (garvinhicking)
+
+    * Fix bug #1494653: Non-Unique index constraint for 'exits' table.
+      Thanks to Markus Brueckner! (garvinhicking)
+      
+Version 1.1-alpha5()
+------------------------------------------------------------------------
+
+   * Implemented Drag and Drop based plugin configuration panel for
+     re-ordering plugin layout. Uses JavaScript - works like old
+     manager when having JS disabled! (garvinhicking)
+
+   * Changed "Auto-Login" via Cookie behaviour to only issue single-
+     time valid cookies to users and no longer put username/pw into
+     serialized cookie data. Many thanks to Yasuo Ohgaki for giving
+     a helping hand! (garvinhicking)
+
+   * Added possibility to hide/temporarily disable Event plugins
+     (garvinhicking)
+
+   * Added "plugin_api_extension" class, which contains some helper
+     methods for future use, like re-ordering DB items or checking
+     valid emails. (Falk Döring)
+
+   * Fix multiple occurences of the string "--" in the entry title to
+     not mess up HTML display because of weird Firefox interpretation
+     (Bug #1474290) (garvinhicking)
+
+   * Made "fullfeed" syndication option also support "let the client
+     decide", via $_GET['fullFeed'] = true/false. (garvinhicking)
+
+   * Added new configuration option to that lets you toggle whether to
+     comply with RFC2616 on Conditional GET. (Garvinhicking)
+
+   * Support template/theme/style-specific options via "config.inc.php"
+     file in template directory. Allows values like "background-color",
+     "header" etc. to be made configurable in the admin screen.
+     (garvinhicking)
+
+   * Make media manager able to store media properties and many other
+     enhancements:
+
+     DETAILS:
+         - Smarty templates for all media-related output
+         - New DHTML widget for tree navigation
+         - Store+Retrieve EXIF/XMP/ITPC/ID3 metadata for uploaded files
+           [new database table]
+         - Manage custom keywords for media items
+         - Option for enabling the toolbar in the popup media window
+         - Plugin API hooks for fetching media metadata (like via
+           getID3() plugin)
+         - Make media chooser also return the media ID
+         - Detect if a file is video, audio, image, document, archive,
+           binary. Unify image fetching functionality.
+         - Allow to create directories from the popup media window
+         - Optionally increase filename (1, 2, 4, 5, ...) when file
+           already exists
+         - Restrict file upload by size/dimensions via configuration
+           options
+         - Sort media files by all custom property fields
+         - Search/Filter for specific properties/keywords.
+         - Enhanced media filter for keywords
+         - Use entered comments in the "You choose..." picking page
+         - Integrate new page for viewing images with media properties
+           through serendipity_admin_image_selector.php?serendipity[image]=X
+         - Integrate imageselectorplus plugin options for giving a target
+           to links
+         - New option for image_Selector to save a specific sized version
+           (?serendipity[image]=X&serendipity[step]=showItem
+            &serendipity[resizeWidth]=X&serendipity[resizeHeight]=Y
+         - Track referrers by image selector and show them on detail
+           page
+         - Allow to move directories with files and updating all links
+           in your entries to those moved items. (MySQL only!)
+         - Allow to move single images.
+     (garvinhicking)
+
+   * Create a new index on the plugin DB table, optimize fetching config
+     values for plugins. Load language file when permissions could not
+     allow reading the config file. (garvinhicking)
+
+   * Fix blocking site during file requests by writing session data to
+     disk. Thanks to jgoerzen! (garvinhicking)
+
+   * Make categories sidebar plugin able to only show categories
+     readable for logged in user (garvinhicking)
+
+   * Fix getting multiple images for directories that were put into
+     the Acccess List (garvinhicking)
+
+   * Allow to create new groups from existing ones, by editing them
+     and clicking on "Create new group". (garvinhicking)
+
+   * Statistic plugin update by Shrikee: Graphically display visitors,
+     bot banning.
+
+   * Deleting a comment that has replies will replace that comment with
+     a "Comment deleted" reference. Deleting such a comment again will
+     completely remove it. (garvinhicking, Jabrwock)
+
+   * Added "further links" infobox to Admin interface (garvinhicking)
+
+   * Media manager gallery will use (user-specified)
+     "admin/img/mime_XXX-YYY.png" images of a template for non-image
+     mimetypes. (garvinhicking)
+
+   * Allow entryproperties plugin to define which markup plugins are
+     applied per-entry (garvinhicking)
+
+   * Added links to view an entry in reasonable places (comments / entry
+     overview) (garvinhicking)
+
+   * Added on-the-fly synchronizing of the Serendipity media database
+     with the file system (Marty, garvinhicking)
+
+   * Introduce permission setup for media directories (garvinhicking)
+
+   * Added config option for specifying number of entries in the RSS
+     feed (garvinhicking)
+
+   * Added option whether to issue the "SET NAMES" mysql command
+     (garvinhicking)
+
+   * Removed config option "XHTML11 compliance" and enabled by default
+     now (garvinhicking)
+
 Version 1.0.1 ()
 ------------------------------------------------------------------------
-   
+
    * Fix multi-authors view only showing first author (garvinhicking)
 
    * Fix bug sending comment-notification mails to subscribed users 
@@ -16,7 +247,7 @@ Version 1.0 (June 15th, 2006)
    * Insert logic for saving an entry that prevents the iframe for
      trackbacks/xml-rpc pings to save an entry multiple times upon
      failure. Many thanks to tharos from the Forums! (garvinhicking)
-
+             
    * Add smarty parameter $view which can be used to detect what kind
      of page is being displayed. One of: archives, entry, feed, admin,
      archives, plugin, categories, authors, search, css, start, 404
@@ -26,12 +257,6 @@ Version 1.0 (June 15th, 2006)
 
    * Added polish language translation by CoSTa
 
-   * Fix media browser sorting by authorid causing trouble in SQLite
-     (Sven Oliver Moll)
-
-Version 1.0-beta3 (May 5th, 2006)
-------------------------------------------------------------------------
-
    * Fix another (minor) XSRF for entry manager, thanks to Geoff Johnson
      (garvinhicking)
 
@@ -70,6 +295,7 @@ Version 1.0-beta3 (May 5th, 2006)
      objects (like emoticonchooser). Also replace <i> with <em> and
      <b> with <strong>. (Jay Bertrandt)
 
+
 Version 1.0-beta2 (March 13th, 2006)
 ------------------------------------------------------------------------
 
index ea1bb8fc6c0f61dd71599cc01e36f6c9a171f715..bc7a29feb288941e3c9c52412bc6046f95004b78 100644 (file)
@@ -2,6 +2,11 @@
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 
+if (defined('S9Y_FRAMEWORK_COMMENTS')) {
+    return;
+}
+@define('S9Y_FRAMEWORK_COMMENTS', true);
+
 /**
  * Store the personal details of a commenting user in a cookie (or delete that cookie)
  *
@@ -80,8 +85,7 @@ function serendipity_displayCommentForm($id, $url = '', $comments = NULL, $data
         $comments = serendipity_fetchComments($id);
     }
 
-    $serendipity['smarty']->assign(
-      array(
+    $commentform_data = array(
         'commentform_action'         => $url,
         'commentform_id'             => $id,
         'commentform_name'           => isset($data['name'])      ? htmlspecialchars($data['name'])       : (isset($serendipity['COOKIE']['name'])     ? htmlspecialchars($serendipity['COOKIE']['name'])     : ''),
@@ -95,9 +99,10 @@ function serendipity_displayCommentForm($id, $url = '', $comments = NULL, $data
         'is_allowSubscriptions'      => $serendipity['allowSubscriptions'],
         'is_moderate_comments'       => $moderate_comments,
         'commentform_entry'          => $entry
-      )
     );
 
+    $serendipity['smarty']->assign($commentform_data);
+
     serendipity_smarty_fetch('COMMENTFORM', 'commentform.tpl');
 }
 
@@ -109,9 +114,10 @@ function serendipity_displayCommentForm($id, $url = '', $comments = NULL, $data
  * @param   int     How many comments to fetch (empty: all)
  * @param   string  How shall comments be ordered (ASC|DESC)
  * @param   boolean Shall non-approved comments be displayed?
+ * @param   string  Comment type to fetch
  * @return  array   The SQL result of comments
  */
-function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = false) {
+function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = false, $type = 'NORMAL', $where = '') {
     global $serendipity;
     $and = '';
 
@@ -120,6 +126,14 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
     } else {
         $limit = '';
     }
+    
+    if ($type == 'comments' || empty($type)) {
+        $type = 'NORMAL';
+    } elseif ($type == 'trackbacks') {
+        $type = 'TRACKBACK';
+    } elseif ($type == 'comments_and_trackbacks') {
+        $type = '%';
+    }
 
     if (!empty($id)) {
         $and .= " AND co.entry_id = '" . (int)$id ."'";
@@ -128,6 +142,8 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
     if (!$showAll) {
         $and .= ' AND co.status = \'approved\'';
     }
+    
+    $and .= $where;
 
     if ($serendipity['dbType'] == 'postgres') {
         $group    = '';
@@ -139,9 +155,10 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
 
     $query = "SELECT $distinct
                     co.id,
-                    co.entry_id, co.timestamp, co.title, co.email, co.url, co.ip, co.body, co.type, co.subscribed,
+                    co.entry_id, co.timestamp, co.title AS ctitle, co.email, co.url, co.ip, co.body, co.type, co.subscribed,
                     co.author,
                     e.title,
+                    e.timestamp AS entrytimestamp,
                     e.id AS entryid,
                     e.authorid,
                     co.id AS commentid,
@@ -149,13 +166,12 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
               FROM
                     {$serendipity['dbPrefix']}comments co
                     LEFT JOIN {$serendipity['dbPrefix']}entries e ON (co.entry_id = e.id)
-              WHERE co.type LIKE 'NORMAL' AND co.entry_id > 0 $and
+              WHERE co.type LIKE '" . $type . "' AND co.entry_id > 0 $and
               $group
               ORDER BY
-                    co.id " . ($order != '' ? $order : '') . "
+                    " . ($where != '' ? '' : 'co.id') . " " . ($order != '' ? $order : '') . "
                     $limit";
-
-    $comments = serendipity_db_query($query);
+    $comments = serendipity_db_query($query, false, 'assoc');
 
     if (!is_array($comments)) {
         return array();
@@ -213,7 +229,7 @@ function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $
  * @param   string      A string repesenting the actual comment (1.1.2.1)
  * @return  string      The HTML construct of all comments
  */
-function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace = null) {
+function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace = null, $smarty_block = 'COMMENTS', $smarty_file = 'comments.tpl') {
     global $serendipity;
     static $_smartyComments;
 
@@ -257,7 +273,8 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
             if (isset($comment['no_email']) && $comment['no_email']) {
                 $comment['email'] = false;
             } elseif (!empty($comment['email'])) {
-                $comment['email'] = htmlspecialchars(str_replace('@', '[at]', $comment['email']));
+                $comment['clear_email'] = $comment['email'];
+                $comment['email']       = htmlspecialchars(str_replace('@', '[at]', $comment['email']));
             }
 
             $comment['body']    = $comment['comment'];
@@ -268,7 +285,7 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
 
             $_smartyComments[] = $comment;
             if ($comment['id'] && $parentid !== VIEWMODE_LINEAR ) {
-                serendipity_printComments($comments, $comment['id'], ($depth+1), ($trace . $i . '.'));
+                serendipity_printComments($comments, $comment['id'], ($depth+1), ($trace . $i . '.'), $smarty_block, $smarty_file);
             }
         }
     }
@@ -278,10 +295,83 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
         return true;
     }
 
-    $serendipity['smarty']->assign('comments', $_smartyComments);
+    $serendipity['smarty']->assign_by_ref('comments', $_smartyComments);
     unset($_smartyComments);
 
-    return serendipity_smarty_fetch('COMMENTS', 'comments.tpl');
+    return serendipity_smarty_fetch($smarty_block, $smarty_file);
+}
+
+/**
+ * Fetches and prints a listing of comments by author
+ */
+function serendipity_printCommentsByAuthor() {
+    global $serendipity;
+
+    $type      = $serendipity['GET']['commentMode'];
+
+    if ($type == 'comments' || empty($type)) {
+        $type = 'NORMAL';
+    } elseif ($type == 'trackbacks') {
+        $type = 'TRACKBACK';
+    } elseif ($type == 'comments_and_trackbacks') {
+        $type = '%';
+    }
+
+    $sql_where = " AND co.author = '" . serendipity_db_escape_string($serendipity['GET']['viewCommentAuthor']) . "'";
+
+    if (!empty($serendipity['GET']['commentStartTime'])) {
+        $sql_where .= " AND co.timestamp >= " . (int)$serendipity['GET']['commentStartTime'];
+    }
+
+    if (!empty($serendipity['GET']['commentEndTime'])) {
+        $sql_where .= " AND co.timestamp <= " . (int)$serendipity['GET']['commentEndTime'];
+    }
+
+    if (empty($serendipity['GET']['page'])) {
+        $serendipity['GET']['page'] = 1;
+    }
+    $sql_limit = $serendipity['fetchLimit'] * ($serendipity['GET']['page']-1) . ',' . $serendipity['fetchLimit'];
+    $c = serendipity_fetchComments(null, $sql_limit, 'co.entry_id DESC, co.id ASC', false, $type, $sql_where);
+    
+    $entry_comments = array();
+    foreach($c as $i => $comment) {
+        if (!isset($entry_comments[$comment['entry_id']])) {
+            $comment['link'] = serendipity_archiveURL($comment['entry_id'], $comment['title'], 'serendipityHTTPPath', true, array('timestamp' => $comment['entrytimestamp']));
+            $entry_comments[$comment['entry_id']] = $comment;
+        }
+        $entry_comments[$comment['entry_id']]['comments'][] = $comment;
+    }
+    
+    foreach($entry_comments AS $entry_id => $_data) {
+        $entry_comments[$entry_id]['tpl_comments'] =& serendipity_printComments($_data['comments'], VIEWMODE_LINEAR, 0, null, 'COMMENTS', 'comments.tpl');
+    }
+
+    $serendipity['smarty']->assign_by_ref('comments_by_authors', $entry_comments);
+
+    if (!empty($id)) {
+        $and .= " AND co.entry_id = '" . (int)$id ."'";
+    }
+
+    if (!$showAll) {
+        $and .= ' AND co.status = \'approved\'';
+    }
+
+    $cc = serendipity_db_query("SELECT count(co.id) AS counter 
+                                  FROM {$serendipity['dbPrefix']}comments AS co
+                                 WHERE co.entry_id > 0 
+                                   AND co.type LIKE '" . $type . "' 
+                                   AND co.status = 'approved' " . $sql_where . "
+                              GROUP BY co.author", true, 'assoc');
+    if (!isset($cc['counter'])) {
+        $totalComments = 0;
+    } else {
+        $totalComments = $cc['counter'];
+    }
+    serendipity_printEntryFooter('', $totalComments);
+
+    serendipity_smarty_fetch('ENTRIES', 'comments_by_author.tpl');
+
+    return true;
 }
 
 /**
@@ -310,25 +400,41 @@ function serendipity_deleteComment($id, $entry_id, $type='comments') {
 
         /* We have to figure out if the comment we are about to delete, is awaiting approval,
            if so - we should *not* subtract it from the entries table */
-        $sql = serendipity_db_query("SELECT type, status, parent_id FROM {$serendipity['dbPrefix']}comments
+        $sql = serendipity_db_query("SELECT type, status, parent_id, body FROM {$serendipity['dbPrefix']}comments
                                             WHERE entry_id = ". $entry_id ."
-                                                    AND id = ". $id , true);
-
-        serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}comments
-                                    WHERE entry_id = ". $entry_id ."
-                                            AND id = ". $id );
-
-        if ($sql['status'] !== 'pending') {
-            if (!empty($sql['type']) && $sql['type'] != 'NORMAL') {
-                $type = 'trackbacks';
-            } else {
-                $type = 'comments';
+                                                    AND id = ". $id, true);
+
+
+        /* Check to see if the comment has children
+         * if it does, don't delete, but replace with "*(COMMENT DELETED)*"
+            to delete a tree, delete children first */
+        $has_parent = serendipity_db_query("SELECT count(id) AS count
+                                              FROM {$serendipity['dbPrefix']}comments
+                                             WHERE parent_id = ". $id . "
+                                             LIMIT 1", true);
+
+        if (is_array($has_parent) && isset($has_parent['count']) && $has_parent['count'] > 0 && $sql['body'] != 'COMMENT_DELETED') {
+            // Comment has childs, so don't delete it.
+            serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments
+                                     SET body = 'COMMENT_DELETED'
+                                   WHERE id = " . $id);
+        } else {
+            // Comment has no childs or had already been deleted., it can be safely removed.
+            serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}comments
+                                        WHERE entry_id = ". $entry_id ."
+                                                AND id = ". $id);
+
+            if (is_array($sql) && $sql['status'] !== 'pending') {
+                if (!empty($sql['type']) && $sql['type'] != 'NORMAL') {
+                    $type = 'trackbacks';
+                } else {
+                    $type = 'comments';
+                }
+                serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id ." $admin");
             }
-            serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id);
-        }
-
-        serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id);
 
+            serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id);
+        }
         return true;
     } else {
         return false;
index d320e2eb4d065890ae15469c0139174818cfe1ae..7e13738557f1cd64f195ccc022fc5e54973584c4 100644 (file)
@@ -2,6 +2,11 @@
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 
+if (defined('S9Y_FRAMEWORK_ENTRIES')) {
+    return;
+}
+@define('S9Y_FRAMEWORK_ENTRIES', true);
+
 /**
  * Delete a category or range of categories
  *
@@ -562,10 +567,17 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
     }
 
     $where = '';
+
+    if ($authorid === -1 OR $authorid === 0) {
+        $sql_groupid = '0';
+    } else {
+        $sql_groupid = 'ag.groupid';
+    }
+
     if ($authorid != 'all' && is_numeric($authorid)) {
         $sql_authorid = $authorid;
         if (!serendipity_checkPermission('adminCategoriesMaintainOthers', $authorid)) {
-            $where = " WHERE (c.authorid = $authorid OR c.authorid = 0)";
+            $where = " WHERE (c.authorid = $authorid OR c.authorid = 0) ";
             $where .= "OR (
                           acl.artifact_type = 'category'
                           AND acl.artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'
@@ -612,7 +624,7 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
            LEFT OUTER JOIN {$serendipity['dbPrefix']}authorgroups AS ag
                         ON ag.authorid = $sql_authorid
            LEFT OUTER JOIN {$serendipity['dbPrefix']}access AS acl
-                        ON (ag.groupid = acl.groupid AND acl.artifact_id = c.categoryid)
+                        ON ($sql_groupid = acl.groupid AND acl.artifact_id = c.categoryid)
                            $where
                            $group";
     if (!empty($order)) {
@@ -719,6 +731,8 @@ function serendipity_searchEntries($term, $limit = '') {
                             e.id,
                             e.authorid,
                             a.realname AS author,
+                            e.allow_comments,
+                            e.moderate_comments,
                             a.email,
                             e.timestamp,
                             e.comments,
@@ -746,14 +760,18 @@ function serendipity_searchEntries($term, $limit = '') {
  *
  * The list of total entries is calculated from the serendipity_getTotelEntries() function
  *
+ * @param string    suffix for URLs
+ * @param int       Amount of total entries
  * @access public
  * @see serendipity_getTotalEntries()
  * @return null
  */
-function serendipity_printEntryFooter() {
+function serendipity_printEntryFooter($suffix = '.html', $totalEntries = null) {
     global $serendipity;
 
-    $totalEntries = serendipity_getTotalEntries();
+    if ($totalEntries === null) {
+        $totalEntries = serendipity_getTotalEntries();
+    }
     $totalPages   = ceil($totalEntries / $serendipity['fetchLimit']);
 
     if (!isset($serendipity['GET']['page'])) {
@@ -767,7 +785,7 @@ function serendipity_printEntryFooter() {
     if ($serendipity['GET']['page'] > 1) {
         $uriArguments = $serendipity['uriArguments'];
         $uriArguments[] = 'P'. ($serendipity['GET']['page'] - 1);
-        $serendipity['smarty']->assign('footer_prev_page', serendipity_rewriteURL(implode('/', $uriArguments) .'.html'));
+        $serendipity['smarty']->assign('footer_prev_page', serendipity_rewriteURL(implode('/', $uriArguments) . $suffix));
     }
 
     $uriArguments = $serendipity['uriArguments'];
@@ -775,13 +793,13 @@ function serendipity_printEntryFooter() {
     $serendipity['smarty']->assign('footer_totalEntries', $totalEntries);
     $serendipity['smarty']->assign('footer_totalPages', $totalPages);
     $serendipity['smarty']->assign('footer_currentPage', $serendipity['GET']['page']);
-    $serendipity['smarty']->assign('footer_pageLink', serendipity_rewriteURL(implode('/', $uriArguments) . '.html'));
+    $serendipity['smarty']->assign('footer_pageLink', serendipity_rewriteURL(implode('/', $uriArguments) . $suffix));
     $serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, (int)$serendipity['GET']['page'], $totalPages, $totalEntries));
 
     if ($serendipity['GET']['page'] < $totalPages) {
         $uriArguments = $serendipity['uriArguments'];
         $uriArguments[] = 'P'. ($serendipity['GET']['page'] + 1);
-        $serendipity['smarty']->assign('footer_next_page', serendipity_rewriteURL(implode('/', $uriArguments) .'.html'));
+        $serendipity['smarty']->assign('footer_next_page', serendipity_rewriteURL(implode('/', $uriArguments) . $suffix));
     }
 }
 
@@ -927,9 +945,13 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
 
             $entry['link']      = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
             $entry['commURL']   = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', false, array('timestamp' => $entry['timestamp']));
-            $entry['rdf_ident'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
+            $entry['html_title']= $entry['title'];
             $entry['title']     = htmlspecialchars($entry['title']);
 
+            $entry['title_rdf']          = preg_replace('@-{2,}@', '-', $entry['title']);
+            $entry['rdf_ident']          = serendipity_archiveURL($entry['id'], $entry['title_rdf'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
+            $entry['link_rdf']           = serendipity_rewriteURL(PATH_FEEDS . '/ei_'. $entry['id'] .'.rdf');
+
             $entry['link_allow_comments']    = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=enable&amp;serendipity[entry]=' . $entry['id'];
             $entry['link_deny_comments']     = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=disable&amp;serendipity[entry]=' . $entry['id'];
             $entry['allow_comments']         = serendipity_db_bool($entry['allow_comments']);
@@ -939,7 +961,6 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
             $entry['link_popup_trackbacks']  = $serendipity['serendipityHTTPPath'] .'comment.php?serendipity[entry_id]='. $entry['id'] .'&amp;serendipity[type]=trackbacks';
             $entry['link_edit']              = $serendipity['baseURL'] .'serendipity_admin.php?serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=edit&amp;serendipity[id]='. $entry['id'];
             $entry['link_trackback']         = $serendipity['baseURL'] .'comment.php?type=trackback&amp;entry_id='. $entry['id'];
-            $entry['link_rdf']               = serendipity_rewriteURL(PATH_FEEDS . '/ei_'. $entry['id'] .'.rdf');
             $entry['link_viewmode_threaded'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] .'?url='. $entry['commURL'] .'&amp;serendipity[cview]='. VIEWMODE_THREADED;
             $entry['link_viewmode_linear']   = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] .'?url='. $entry['commURL'] .'&amp;serendipity[cview]='. VIEWMODE_LINEAR;
             $entry['link_author']            = serendipity_authorURL($authorData);
@@ -985,14 +1006,14 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
 
             /* IF WE ARE DISPLAYING A FULL ENTRY */
             if (isset($serendipity['GET']['id'])) {
-                $serendipity['smarty']->assign(
-                    array(
-                        'comments_messagestack' => (isset($serendipity['messagestack']['comments']) ? (array)$serendipity['messagestack']['comments'] : array()),
-                        'is_comment_added'      => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'true' ? true: false),
-                        'is_comment_moderate'   => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'moderate' ? true: false)
-                    )
+                $comment_add_data = array(
+                    'comments_messagestack' => (isset($serendipity['messagestack']['comments']) ? (array)$serendipity['messagestack']['comments'] : array()),
+                    'is_comment_added'      => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'true' ? true: false),
+                    'is_comment_moderate'   => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'moderate' ? true: false)
                 );
 
+                $serendipity['smarty']->assign($comment_add_data);
+
                 serendipity_displayCommentForm(
                     $entry['id'],
                     $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'],
@@ -1013,7 +1034,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
         serendipity_printEntryFooter();
     }
 
-    $serendipity['smarty']->assign('entries', $dategroup);
+    $serendipity['smarty']->assign_by_ref('entries', $dategroup);
     unset($entries, $dategroup);
 
     if (isset($serendipity['short_archives']) && $serendipity['short_archives']) {
@@ -1086,6 +1107,10 @@ function serendipity_updertEntry($entry) {
     $newEntry = 0;
     $exflag = 0;
 
+    if (isset($entry['properties'])) {
+        unset($entry['properties']);
+    }
+    
     if (!is_numeric($entry['timestamp'])) {
         $entry['timestamp'] = time();
     }
@@ -1233,7 +1258,7 @@ function serendipity_deleteEntry($id) {
     serendipity_db_query("DELETE FROM {$serendipity["dbPrefix"]}entrycat WHERE entryid=$id");
     serendipity_db_query("DELETE FROM {$serendipity["dbPrefix"]}entryproperties WHERE entryid=$id");
     serendipity_db_query("DELETE FROM {$serendipity["dbPrefix"]}comments WHERE entry_id=$id");
-    serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE entry_id='$id'");
+    serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE entry_id='$id' AND type = ''");
     serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}permalinks WHERE entry_id='$id'");
 }
 
@@ -1340,6 +1365,7 @@ function serendipity_updateEntryCategories($postid, $categories) {
  *
  * The archives are created according to the current timestamp and show the current year.
  * $serendipity['GET']['category'] is honoured like in serendipity_fetchEntries()
+ * $serendipity['GET']['viewAuthor'] is honoured like in serendipity_fetchEntries()
  *
  * @access public
  * @return null
@@ -1356,12 +1382,12 @@ function serendipity_printArchives() {
             $thisYear   = date('Y', serendipity_serverOffsetHour());
             $thisMonth  = date('m', serendipity_serverOffsetHour());
             break;
-        case 'jalali-utf8':
+        case 'persian-utf8':
             require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
-            $lastYear   = jalali_date_utf('Y', serendipity_serverOffsetHour($f[0][0]));
-            $lastMonth  = jalali_date_utf('m', serendipity_serverOffsetHour($f[0][0]));
-            $thisYear   = jalali_date_utf('Y', serendipity_serverOffsetHour());
-            $thisMonth  = jalali_date_utf('m', serendipity_serverOffsetHour());
+            $lastYear   = persian_date_utf('Y', serendipity_serverOffsetHour($f[0][0]));
+            $lastMonth  = persian_date_utf('m', serendipity_serverOffsetHour($f[0][0]));
+            $thisYear   = persian_date_utf('Y', serendipity_serverOffsetHour());
+            $thisMonth  = persian_date_utf('m', serendipity_serverOffsetHour());
             break;
     }
     $max = 0;
@@ -1374,6 +1400,12 @@ function serendipity_printArchives() {
         $cat_get = '';
     }
 
+    if (isset($serendipity['GET']['viewAuthor'])) {
+        $author_get = '/A' . (int)$serendipity['GET']['viewAuthor'];
+    } else {
+        $author_get = '';
+    }
+
     $output = array();
     for ($y = $thisYear; $y >= $lastYear; $y--) {
         $output[$y]['year'] = $y;
@@ -1395,10 +1427,10 @@ function serendipity_printArchives() {
                     $s = serendipity_serverOffsetHour(mktime(0, 0, 0, $m, 1, $y), true);
                     $e = serendipity_serverOffsetHour(mktime(23, 59, 59, $m, date('t', $s), $y), true);
                     break;
-                case 'jalali-utf8':
+                case 'persian-utf8':
                     require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
-                    $s = serendipity_serverOffsetHour(jalali_mktime(0, 0, 0, $m, 1, $y), true);
-                    $e = serendipity_serverOffsetHour(jalali_mktime(23, 59, 59, $m, date('t', $s), $y), true);
+                    $s = serendipity_serverOffsetHour(persian_mktime(0, 0, 0, $m, 1, $y), true);
+                    $e = serendipity_serverOffsetHour(persian_mktime(23, 59, 59, $m, date('t', $s), $y), true);
                     break;
             }
 
@@ -1412,7 +1444,8 @@ function serendipity_printArchives() {
                                                 AND timestamp >= $s
                                                 AND timestamp <= $e "
                                                     . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND timestamp <= " . time() : '')
-                                                    . (!empty($cat_sql) ? ' AND ' . $cat_sql : '') . "
+                                                    . (!empty($cat_sql) ? ' AND ' . $cat_sql : '')
+                                                    . (!empty($serendipity['GET']['viewAuthor']) ? ' AND e.authorid = ' . (int)$serendipity['GET']['viewAuthor'] : '') . "
                                            GROUP BY ec.entryid", false, 'assoc');
             if (is_array($entries)) {
                 $entry_count = count($entries);
@@ -1427,14 +1460,15 @@ function serendipity_printArchives() {
 
             $data = array();
             $data['entry_count']    = $entry_count;
-            $data['link']           = serendipity_archiveDateUrl($y . '/'. sprintf('%02s', $m) . $cat_get);
-            $data['link_summary']   = serendipity_archiveDateUrl($y . '/'. sprintf('%02s', $m) . $cat_get, true);
+            $data['link']           = serendipity_archiveDateUrl($y . '/'. sprintf('%02s', $m) . $cat_get . $author_get);
+            $data['link_summary']   = serendipity_archiveDateUrl($y . '/'. sprintf('%02s', $m) . $cat_get . $author_get, true);
             $data['date']           = $s;
             $output[$y]['months'][] = $data;
         }
     }
-    $serendipity['smarty']->assign(array('archives' => $output,
-                                         'max_entries' => $max));
+
+    $serendipity['smarty']->assign_by_ref('archives', $output);
+    $serendipity['smarty']->assign_by_ref('max_entries', $max);
 
     serendipity_smarty_fetch('ARCHIVES', 'entries_archives.tpl', true);
 }
index f0553b4d35a4e6e4239ea6b1e8d71b13e8f6d19f..44f3050f42e41f616d7862b48eab025a1ee9aa32 100644 (file)
@@ -3,6 +3,11 @@
 # All rights reserved.  See LICENSE file for licensing details
 
 
+if (defined('S9Y_FRAMEWORK_INSTALLER')) {
+    return;
+}
+@define('S9Y_FRAMEWORK_INSTALLER', true);
+
 /**
  * Convert a PHP Ini setting to a boolean flag
  *
@@ -102,6 +107,9 @@ function serendipity_updateLocalConfig($dbName, $dbPrefix, $dbHost, $dbUser, $db
     fwrite($configfp, "\t\$serendipity['dbPass']            = '" . addslashes($dbPass) . "';\n");
     fwrite($configfp, "\t\$serendipity['dbType']            = '" . addslashes($dbType) . "';\n");
     fwrite($configfp, "\t\$serendipity['dbPersistent']      = ". (serendipity_db_bool($dbPersistent) ? 'true' : 'false') .";\n");
+    if ($serendipity['dbNames']) {
+        fwrite($configfp, "\t\$serendipity['dbCharset']         = '" . addslashes(SQL_CHARSET) . "';\n");
+    }
 
     if (is_array($privateVariables) && count($privateVariables) > 0) {
         foreach($privateVariables AS $p_idx => $p_val) {
@@ -417,6 +425,10 @@ function serendipity_guessInput($type, $name, $value='', $default='') {
             echo '<input type="file" size="30" name="' . $name . '" />';
             break;
 
+        case 'textarea':
+            echo '<textarea rows="5" cols="40" name="' . $name . '">' . htmlspecialchars($value) . '</textarea>';
+            break;
+
         default:
             echo '<input type="text" size="30" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
             break;
@@ -436,9 +448,6 @@ function serendipity_guessInput($type, $name, $value='', $default='') {
  */
 function serendipity_printConfigTemplate($config, $from = false, $noForm = false, $folded = true, $allowToggle = true) {
     global $serendipity;
-    if (!isset($serendipity['XHTML11'])) {
-        $serendipity['XHTML11'] = FALSE;
-    }
     if ( $allowToggle ) {
 ?>
 <script type="text/javascript" language="JavaScript">
@@ -561,7 +570,7 @@ function showConfigAll(count) {
                                 <span style="color: #5E7A94; font-size: 8pt;"><?php echo $item['description']; ?></span>
                             </td>
                             <td style="border-bottom: 1px #000000 solid; font-size: 8pt" align="left" valign="middle" width="25%">
-                                <?php echo ($serendipity['XHTML11'] ? '<span style="white-space: nowrap">' : '<nobr>'); ?><?php echo serendipity_guessInput($item['type'], $item['var'], $value, $item['default']); ?><?php echo ($serendipity['XHTML11'] ? '</span>' : '</nobr>'); ?>
+                                <span style="white-space: nowrap"><?php echo serendipity_guessInput($item['type'], $item['var'], $value, $item['default']); ?></span>
                             </td>
                         </tr>
 <?php
@@ -839,6 +848,7 @@ function serendipity_installFiles($serendipity_core = '') {
                    '{PAT_DELETE}', '{PATH_DELETE}',
                    '{PAT_APPROVE}', '{PATH_APPROVE}',
                    '{PAT_SEARCH}', '{PATH_SEARCH}',
+                   '{PAT_COMMENTS}', '{PATH_COMMENTS}',
                    '{PAT_CSS}',
                    '{PAT_PERMALINK}',
                    '{PAT_PERMALINK_AUTHORS}',
@@ -860,6 +870,7 @@ function serendipity_installFiles($serendipity_core = '') {
                    trim($PAT['DELETE'], '@/i'),      $serendipity['permalinkDeletePath'],
                    trim($PAT['APPROVE'], '@/i'),     $serendipity['permalinkApprovePath'],
                    trim($PAT['SEARCH'], '@/i'),      $serendipity['permalinkSearchPath'],
+                   trim($PAT['COMMENTS'], '@/i'),    $serendipity['permalinkCommentsPath'],
                    trim(PAT_CSS, '@/i'),
                    trim($PAT['PERMALINK'], '@/i'),
                    trim($PAT['PERMALINK_AUTHORS'], '@/i'),
index b97dd052d4ae626f304a8e448df913ae133e8e5b..c1939f7f87fc906d44a6c84184eea4ca2f0cfc2b 100644 (file)
@@ -2,6 +2,11 @@
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 
+if (defined('S9Y_FRAMEWORK_PERMALINKS')) {
+    return;
+}
+@define('S9Y_FRAMEWORK_PERMALINKS', true);
+
 /**
  * Converts a string into a filename that can be used safely in HTTP URLs
  *
@@ -131,7 +136,7 @@ function serendipity_makeFilename($str, $stripDots = false) {
 
     // Remove excess separators
     $str = trim($str, $to[0]);
-    
+
     if (empty($str)) {
         if (isset($GLOBALS['i18n_unknown'])) {
             $str = $GLOBALS['i18n_unknown'];
@@ -155,67 +160,71 @@ function serendipity_initPermalinks() {
     if (!isset($serendipity['permalinkStructure'])) {
         $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html';
     }
-    
+
     if (!isset($serendipity['permalinkFeedAuthorStructure'])) {
         $serendipity['permalinkFeedAuthorStructure'] = 'feeds/authors/%id%-%realname%.rss';
     }
-    
+
     if (!isset($serendipity['permalinkFeedCategoryStructure'])) {
         $serendipity['permalinkFeedCategoryStructure'] = 'feeds/categories/%id%-%name%.rss';
     }
-    
+
     if (!isset($serendipity['permalinkCategoryStructure'])) {
         $serendipity['permalinkCategoryStructure'] = 'categories/%id%-%name%';
     }
-    
+
     if (!isset($serendipity['permalinkAuthorStructure'])) {
         $serendipity['permalinkAuthorStructure'] = 'authors/%id%-%realname%';
     }
-    
+
     if (!isset($serendipity['permalinkArchivesPath'])) {
         $serendipity['permalinkArchivesPath'] = 'archives';
     }
-    
+
     if (!isset($serendipity['permalinkArchivePath'])) {
         $serendipity['permalinkArchivePath'] = 'archive';
     }
-    
+
     if (!isset($serendipity['permalinkCategoriesPath'])) {
         $serendipity['permalinkCategoriesPath'] = 'categories';
     }
-    
+
     if (!isset($serendipity['permalinkAuthorsPath'])) {
         $serendipity['permalinkAuthorsPath'] = 'authors';
     }
-    
+
     if (!isset($serendipity['permalinkUnsubscribePath'])) {
         $serendipity['permalinkUnsubscribePath'] = 'unsubscribe';
     }
-    
+
     if (!isset($serendipity['permalinkDeletePath'])) {
         $serendipity['permalinkDeletePath'] = 'delete';
     }
-    
+
     if (!isset($serendipity['permalinkApprovePath'])) {
         $serendipity['permalinkApprovePath'] = 'approve';
     }
-    
+
     if (!isset($serendipity['permalinkFeedsPath'])) {
         $serendipity['permalinkFeedsPath'] = 'feeds';
     }
-    
+
     if (!isset($serendipity['permalinkPluginPath'])) {
         $serendipity['permalinkPluginPath'] = 'plugin';
     }
-    
+
     if (!isset($serendipity['permalinkAdminPath'])) {
         $serendipity['permalinkAdminPath'] = 'admin';
     }
-    
+
     if (!isset($serendipity['permalinkSearchPath'])) {
         $serendipity['permalinkSearchPath'] = 'search';
     }
-    
+
+    if (!isset($serendipity['permalinkCommentsPath'])) {
+        $serendipity['permalinkCommentsPath'] = 'comments';
+    }
+
     /* URI paths
      * These could be defined in the language headers, except that would break
      * backwards URL compatibility
@@ -230,7 +239,8 @@ function serendipity_initPermalinks() {
     @define('PATH_PLUGIN',      $serendipity['permalinkPluginPath']);
     @define('PATH_ADMIN',       $serendipity['permalinkAdminPath']);
     @define('PATH_SEARCH',      $serendipity['permalinkSearchPath']);
-    
+    @define('PATH_COMMENTS',    $serendipity['permalinkCommentsPath']);
+
     /* URI patterns
      * Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts
      * like \d or \s, since mod_rewrite will use the regexps as well and chokes on them.
@@ -254,7 +264,7 @@ function serendipity_initPermalinks() {
  */
 function &serendipity_permalinkPatterns($return = false) {
     global $serendipity;
-    
+
     $PAT = array();
 
     $PAT['UNSUBSCRIBE']              = '@/'  . $serendipity['permalinkUnsubscribePath'].'/(.*)/([0-9]+)@';
@@ -267,6 +277,7 @@ function &serendipity_permalinkPatterns($return = false) {
     $PAT['CATEGORIES']               = '@/'  . $serendipity['permalinkCategoriesPath'].'/([0-9;]+)@';
     $PAT['PLUGIN']                   = '@/('  . $serendipity['permalinkPluginPath'] . '|plugin)/(.*)@';
     $PAT['SEARCH']                   = '@/'  . $serendipity['permalinkSearchPath'] . '/(.*)@';
+    $PAT['COMMENTS']                 = '@/'  . $serendipity['permalinkCommentsPath'] . '/(.*)@';
     $PAT['PERMALINK']                = '@'   . serendipity_makePermalinkRegex($serendipity['permalinkStructure'], 'entry') . '@i';
     $PAT['PERMALINK_CATEGORIES']     = '@'   . serendipity_makePermalinkRegex($serendipity['permalinkCategoryStructure'], 'category') . '@i';
     $PAT['PERMALINK_FEEDCATEGORIES'] = '@'   . serendipity_makePermalinkRegex($serendipity['permalinkFeedCategoryStructure'], 'category') . '@i';
@@ -318,7 +329,7 @@ function serendipity_searchPermalink($struct, $url, $default, $type = 'entry') {
         if (is_array($permalink)) {
             return $permalink['entry_id'];
         }
-    }    
+    }
 
     return $default;
 }
@@ -349,12 +360,12 @@ function serendipity_getPermalink(&$data, $type = 'entry') {
         case 'category':
             return serendipity_categoryURL($data, '', false);
             break;
-            
+
         case 'author':
             return serendipity_authorURL($data, '', false);
             break;
     }
-    
+
     return false;
 }
 
@@ -399,16 +410,16 @@ function serendipity_insertPermalink(&$data, $type = 'entry') {
         case 'entry':
             $idfield = 'id';
             break;
-            
+
         case 'author':
             $idfield = 'authorid';
             break;
-            
+
         case 'category':
             $idfield = 'categoryid';
             break;
     }
-    
+
     return(serendipity_db_query(sprintf("INSERT INTO {$serendipity['dbPrefix']}permalinks
                                                     (permalink, entry_id, type)
                                              VALUES ('%s', '%s', '%s')",
@@ -498,9 +509,9 @@ function serendipity_makePermalink($format, $data, $type = 'entry') {
                     $data['entry']['timestamp'] = time();
                 }
             }
-        
+
             $ts = serendipity_serverOffsetHour($data['entry']['timestamp']);
-        
+
             $replacements =
                 array(
                     (int)$data['id'],
@@ -511,7 +522,7 @@ function serendipity_makePermalink($format, $data, $type = 'entry') {
                 );
             return str_replace($entryKeys, $replacements, $format);
             break;
-            
+
         case 'author':
             $replacements =
                 array(
@@ -522,7 +533,7 @@ function serendipity_makePermalink($format, $data, $type = 'entry') {
                 );
             return str_replace($authorKeys, $replacements, $format);
             break;
-            
+
         case 'category':
             $replacements =
                 array(
@@ -703,7 +714,7 @@ function serendipity_currentURL() {
             "'",
             '<',
             '>',
-            '`',
+            '`'
         ),
 
         array(
index 9f9a1872a752a346b9f185aea67f67644d90ca53..36f02da87c145f0d7bfb39ea0a40c525ed61cb18 100644 (file)
@@ -2,9 +2,17 @@
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 
-include_once('serendipity_config.inc.php');
-include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
-include_once(S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php');
+if (!defined('S9Y_FRAMEWORK')) {
+    include('serendipity_config.inc.php');
+}
+
+if (!defined('S9Y_FRAMEWORK_PLUGIN_API')) {
+    include(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
+}
+
+if (!defined('S9Y_FRAMEWORK_PLUGIN_INTERNAL')) {
+    include(S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php');
+}
 
 $uri_addData = array(
     'startpage' => false,
@@ -19,16 +27,14 @@ $serendipity['plugindata']['smartyvars'] = $uri_addData; // Plugins can change t
 serendipity_plugin_api::hook_event('genpage', $uri, $uri_addData);
 serendipity_smarty_init($serendipity['plugindata']['smartyvars']);
 
-$serendipity['smarty']->assign(
-    array(
-        'leftSidebarElements'       => serendipity_plugin_api::count_plugins('left'),
-        'rightSidebarElements'      => serendipity_plugin_api::count_plugins('right')
-    )
-);
+$leftSidebarElements  = serendipity_plugin_api::count_plugins('left');
+$rightSidebarElements = serendipity_plugin_api::count_plugins('right');
+$serendipity['smarty']->assign_by_ref('leftSidebarElements', $leftSidebarElements);
+$serendipity['smarty']->assign_by_ref('rightSidebarElements', $rightSidebarElements);
 
 if ($serendipity['smarty_raw_mode']) {
     /* For BC reasons, we have to ask for layout.php */
-    @include_once(serendipity_getTemplateFile('layout.php', 'serendipityPath'));
+    @include(serendipity_getTemplateFile('layout.php', 'serendipityPath'));
 } else {
     switch ($serendipity['GET']['action']) {
         // User wants to read the diary
@@ -87,6 +93,13 @@ if ($serendipity['smarty_raw_mode']) {
             serendipity_printEntries($r);
             break;
 
+        // Show the comments
+        case 'comments':
+            serendipity_printCommentsByAuthor();
+            // use 'content_message' for pagination?
+            
+            break;
+
         // Show the archive
         case 'archives':
             serendipity_printArchives();
@@ -99,6 +112,7 @@ if ($serendipity['smarty_raw_mode']) {
     }
 
     serendipity_smarty_fetch('CONTENT', 'content.tpl');
+    $serendipity['smarty']->assign('ENTRIES', '');
 }
 
 /* vim: set sts=4 ts=4 expandtab : */
index 68d2b4fd04852601e85820f48f32f51a597c1e67..5f62335fffec948f5ab1d88c74c83debf7125f0c 100644 (file)
@@ -3,10 +3,21 @@
 # All rights reserved.  See LICENSE file for licensing details
 
 if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) {
+    $charset = serendipity_getCharset();
+
+    // The following variable can be set in serendipity_config_local.inc.php to force your templates being able to use language override includes
+    if ($serendipity['useTemplateLanguage']) {
+        @include (S9Y_INCLUDE_PATH . 'templates/' . $serendipity['template'] . '/' . $charset .  'lang_' . $serendipity['lang'] . '.inc.php');
+        @include (S9Y_INCLUDE_PATH . 'templates/' . $serendipity['template'] . '/lang_en.inc.php');
+    }
+
     // Try and include preferred language from the configurated setting
-    if (@include(S9Y_INCLUDE_PATH . 'lang/' . $serendipity['charset'] . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) {
+    if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) {
         // Only here can we truely say the language is loaded
         define('serendipity_LANG_LOADED', true);
+        if (function_exists('serendipity_db_reconnect')) {
+            serendipity_db_reconnect();
+        }
     } elseif (IS_installed === false || (defined('IS_up2date') && IS_up2date === false)) {   /* -- Auto-Guess -- */
         // If no config file is loaded, language includes are not available.
         // Now include one. Try to auto-guess the language by looking up the HTTP_ACCEPT_LANGUAGE.
@@ -15,7 +26,7 @@ if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) {
 
     // Do fallback to english
     if (IS_installed === false || (defined('IS_up2date') && IS_up2date === false)) {
-        @include_once(S9Y_INCLUDE_PATH . 'lang/serendipity_lang_en.inc.php');
+        @include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_en.inc.php');
     }
 }
 
@@ -25,7 +36,7 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
     if (function_exists('mb_language')) {
         @mb_language($serendipity['lang']);
     }
-    
+
     if (function_exists('mb_internal_encoding')) {
         @mb_internal_encoding(LANG_CHARSET);
     }
@@ -60,7 +71,8 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
             case 'ucfirst':
                 // there's no mb_ucfirst, so emulate it
                 if ($mbstring === 2) {
-                    return mb_strtoupper(mb_substr($args[1], 0, 1)) . mb_substr($args[1], 1);
+                    $enc = LANG_CHARSET;
+                    return mb_strtoupper(mb_substr($args[1], 0, 1, $enc), $enc) . mb_substr($args[1], 1, mb_strlen($args[1], $enc), $enc);
                 } else {
                     return ucfirst($args[1]);
                 }
index 205d710d5621216ccfbba286bae399685d65ba1c..911f2622aa70ec2b194d92fe25fa2b53c372b19c 100644 (file)
                                           'type'        => 'bool',
                                           'default'     => false,
                                           'permission'  => 'siteConfiguration',
-                                          'flags'       => array('nosave'))
+                                          'flags'       => array('nosave')),
+
+                                    array('var'         => 'dbNames',
+                                          'title'       => INSTAL_DB_UTF8,
+                                          'description' => INSTAL_DB_UTF8_DESC,
+                                          'type'        => 'bool',
+                                          'default'     => true,
+                                          'permission'  => 'siteConfiguration')
                                 ));
 
     $res['paths'] =
                                           'permission'  => 'siteConfiguration',
                                           'flags'       => array('ifEmpty')),
 
+                                    array('var'         => 'permalinkCommentsPath',
+                                          'title'       => INSTALL_PERMALINK_COMMENTSPATH,
+                                          'description' => '',
+                                          'type'        => 'string',
+                                          'default'     => 'comments',
+                                          'permission'  => 'siteConfiguration',
+                                          'flags'       => array('ifEmpty')),
+
                     )
             );
 
                                           'default'     => 15,
                                           'permission'  => 'blogConfiguration'),
 
+                                    array('var'         => 'RSSfetchLimit',
+                                          'title'       => INSTALL_RSSFETCHLIMIT,
+                                          'description' => INSTALL_RSSFETCHLIMIT_DESC,
+                                          'type'        => 'int',
+                                          'default'     => 15,
+                                          'permission'  => 'blogConfiguration'),
+
+                                    array('var'         => 'enforce_RFC2616',
+                                          'title'       => SYNDICATION_RFC2616,
+                                          'description' => SYNDICATION_RFC2616_DESC,
+                                          'type'        => 'bool',
+                                          'default'     => false,
+                                          'permission'  => 'blogConfiguration'),
+
                                     array('var'         => 'useGzip',
                                           'title'       => INSTALL_USEGZIP,
                                           'description' => INSTALL_USEGZIP_DESC,
                                           'permission'  => 'blogConfiguration',
                                           'flags'       => array('simpleInstall', 'installOnly')),
 
-                                    array('var'         => 'XHTML11',
-                                          'title'       => INSTALL_XHTML11,
-                                          'description' => INSTALL_XHTML11_DESC,
-                                          'type'        => 'bool',
-                                          'permission'  => 'siteConfiguration',
-                                          'default'     => true),
-
                                     array('var'         => 'enablePopup',
                                           'title'       => INSTALL_POPUP,
                                           'description' => INSTALL_POPUP_DESC,
                                           'type'        => 'int',
                                           'permission'  => 'siteConfiguration',
                                           'default'     => 110),
+
+                                    array('var'         => 'maxFileSize',
+                                          'title'       => MEDIA_UPLOAD_SIZE,
+                                          'description' => MEDIA_UPLOAD_SIZE_DESC,
+                                          'type'        => 'int',
+                                          'permission'  => 'blogConfiguration',
+                                          'default'     => ''),
+
+                                    array('var'         => 'maxImgWidth',
+                                          'title'       => MEDIA_UPLOAD_MAXWIDTH,
+                                          'description' => MEDIA_UPLOAD_MAXWIDTH_DESC,
+                                          'type'        => 'int',
+                                          'permission'  => 'blogConfiguration',
+                                          'default'     => ''),
+
+                                    array('var'         => 'maxImgHeight',
+                                          'title'       => MEDIA_UPLOAD_MAXHEIGHT,
+                                          'description' => MEDIA_UPLOAD_MAXHEIGHT_DESC,
+                                          'type'        => 'int',
+                                          'permission'  => 'blogConfiguration',
+                                          'default'     => ''),
+
+                                    array('var'         => 'onTheFlySynch',
+                                          'title'       => ONTHEFLYSYNCH,
+                                          'description' => ONTHEFLYSYNCH_DESC,
+                                          'type'        => 'bool',
+                                          'permission'  => 'siteConfiguration',
+                                          'default'     => true),
+
+                                    array('var'         => 'dynamicResize',
+                                          'title'       => MEDIA_DYN_RESIZE,
+                                          'description' => MEDIA_DYN_RESIZE_DESC,
+                                          'type'        => 'bool',
+                                          'permission'  => 'siteConfiguration',
+                                          'default'     => false),
+
+                                    array('var'         => 'mediaExif',
+                                          'title'       => MEDIA_EXIF,
+                                          'description' => MEDIA_EXIF_DESC,
+                                          'type'        => 'bool',
+                                          'permission'  => 'siteConfiguration',
+                                          'default'     => true),
+
+                                    array('var'         => 'mediaProperties',
+                                          'title'       => MEDIA_PROP,
+                                          'description' => MEDIA_PROP_DESC . MEDIA_PROP_MULTI_DESC,
+                                          'type'        => 'string',
+                                          'permission'  => 'blogConfiguration',
+                                          'default'     => 'DPI:IMAGE;RUN_LENGTH:VIDEO:AUDIO;DATE;COPYRIGHT;TITLE;COMMENT1:MULTI;COMMENT2:MULTI'),
+
+                                    array('var'         => 'mediaKeywords',
+                                          'title'       => MEDIA_KEYWORDS,
+                                          'description' => MEDIA_KEYWORDS_DESC,
+                                          'type'        => 'textarea',
+                                          'permission'  => 'blogConfiguration',
+                                          'default'     => ''),
                             ));
 
     return $res;
index 3529b5f96fc171f91c49a406a5721786d7657eba..40667dc75bdacd55fa597aafff5d85dea62026f9 100644 (file)
@@ -20,6 +20,7 @@ RewriteRule ^{PAT_ARCHIVE} {indexFile}?url=/{PATH_ARCHIVE} [L,QSA]
 RewriteRule ^{PAT_FEED} rss.php?file=$1&ext=$2
 RewriteRule ^{PAT_PLUGIN} {indexFile}?url=$1/$2 [L,QSA]
 RewriteRule ^{PAT_SEARCH} {indexFile}?url=/{PATH_SEARCH}/$1 [L,QSA]
+RewriteRule ^{PAT_COMMENTS} {indexFile}?url=/{PATH_COMMENTS}/$1 [L,QSA]
 RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
 RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
 RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
index 764de68bcde5d5b81f6a95a8ebda51212812b501..b8f46d84e624f0e80980b3c60701f52333eef232 100644 (file)
@@ -22,6 +22,7 @@ RewriteRule ^{PAT_ARCHIVE} {indexFile}?url=/{PATH_ARCHIVE} [L,QSA]
 RewriteRule ^{PAT_FEED} rss.php?file=$1&ext=$2
 RewriteRule ^{PAT_PLUGIN} {indexFile}?url=$1/$2 [L,QSA]
 RewriteRule ^{PAT_SEARCH} {indexFile}?url=/{PATH_SEARCH}/$1 [L,QSA]
+RewriteRule ^{PAT_COMMENTS} {indexFile}?url=/{PATH_COMMENTS}/$1 [L,QSA]
 RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
 RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
 RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
index 4c2733b2d3f86358be74350550edf3c6cd0b643f..82706e37d50ab91d36d6b165d36a003c1b26eec8 100644 (file)
--- a/index.php
+++ b/index.php
@@ -21,7 +21,7 @@ header('X-Blog: Serendipity'); // Used for installer detection
 
 // Session are needed to also remember an autologin user on the frontend
 ob_start();
-include_once('serendipity_config.inc.php');
+include('serendipity_config.inc.php');
 header('Content-Type: text/html; charset='. LANG_CHARSET);
 $track_referer = true;
 $uri = $_SERVER['REQUEST_URI'];
@@ -93,6 +93,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
                 $serendipity['GET']['category'] = $cat;
                 unset($_args[$k]);
             }
+        } elseif ($v{0} == 'A') { /* Author */
+            $serendipity['GET']['viewAuthor'] = $_GET['viewAuthor'] = (int)substr($v, 1);
+            unset($_args[$k]);
         } elseif ($v{0} == 'W') { /* Week */
             $week = substr($v, 1);
             if (is_numeric($week)) {
@@ -151,7 +154,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
             }
             break;
 
-        case 'jalali-utf8':
+        case 'persian-utf8':
             require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
             $gday = 1;
             if ($week) {
@@ -172,26 +175,26 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
                     }
                 }
 
-                $tm = jalali_mktime(0, 0, 0, $i, $day, $year);
-                $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm), $year);
-                $te = jalali_mktime(23, 59, 59, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm)+7, $year);
+                $tm = persian_mktime(0, 0, 0, $i, $day, $year);
+                $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $tm), persian_date_utf('j', $tm), $year);
+                $te = persian_mktime(23, 59, 59, persian_date_utf('m', $tm), persian_date_utf('j', $tm)+7, $year);
                 $date = serendipity_formatTime(WEEK .' '. $week .'، %Y', $ts, false);
             } else {
                 if ($day) {
-                    $ts = jalali_mktime(0, 0, 0, $month, $day, $year);
-                    $te = jalali_mktime(23, 59, 59, $month, $day, $year);
+                    $ts = persian_mktime(0, 0, 0, $month, $day, $year);
+                    $te = persian_mktime(23, 59, 59, $month, $day, $year);
                     $date = serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false);
                 } else {
-                    $ts = jalali_mktime(0, 0, 0, $month, $gday, $year);
+                    $ts = persian_mktime(0, 0, 0, $month, $gday, $year);
                     if (!isset($gday2)) {
-                        $gday2 = jalali_date_utf('t', $ts);
+                        $gday2 = persian_date_utf('t', $ts);
                     }
-                    $te = jalali_mktime(23, 59, 59, $month, $gday2, $year);
+                    $te = persian_mktime(23, 59, 59, $month, $gday2, $year);
                     $date = serendipity_formatTime('%B %Y', $ts, false);
                 }
             }
 
-            list($year, $month, $day) = j2g ($year, $month, $day);
+            list($year, $month, $day) = p2g ($year, $month, $day);
             break;
     }
 
@@ -206,7 +209,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     }
 
     ob_start();
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
     $data = ob_get_contents();
     ob_end_clean();
 
@@ -220,6 +223,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
 } else if ( preg_match(PAT_COMMENTSUB, $uri, $matches) ||
             preg_match(PAT_PERMALINK, $uri, $matches) ) {
     $serendipity['view'] = 'entry';
+
     $matches[1] = serendipity_searchPermalink($serendipity['permalinkStructure'], $uri, $matches[1], 'entry');
     serendipity_rememberComment();
 
@@ -232,7 +236,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
         $comment['parent_id'] = $serendipity['POST']['replyTo'];
         if (!empty($comment['comment'])) {
             if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) {
-                $sc_url = $_SERVER['REQUEST_URI'] . (strstr($_SERVER['REQUEST_URI'], '?') ? '&' : '?') . 'serendipity[csuccess]=' . (isset($serendipity['csuccess']) ? $serendipity['csuccess'] : 'true');
+                $sc_url = ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . (strstr($_SERVER['REQUEST_URI'], '?') ? '&' : '?') . 'serendipity[csuccess]=' . (isset($serendipity['csuccess']) ? $serendipity['csuccess'] : 'true');
                 if (serendipity_isResponseClean($sc_url)) {
                     header('Location: ' . $sc_url);
                 }
@@ -260,7 +264,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     }
 
     ob_start();
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
     $data = ob_get_contents();
     ob_end_clean();
 
@@ -274,7 +278,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     $serendipity['view'] = 'feed';
     header('Content-Type: text/html; charset=utf-8');
 
-    if (preg_match('@/(index|atom[0-9]*|rss|comments|opml)\.(rss[0-9]?|rdf|rss|xml|atom)@', $uri, $vmatches)) {
+    if (preg_match('@/(index|atom[0-9]*|rss|comments|trackbacks|comments_and_trackbacks|opml)\.(rss[0-9]?|rdf|rss|xml|atom)@', $uri, $vmatches)) {
         list($_GET['version'], $_GET['type']) = serendipity_discover_rss($vmatches[1], $vmatches[2]);
     }
 
@@ -295,7 +299,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     }
 
     ob_start();
-    include_once(S9Y_INCLUDE_PATH . 'rss.php');
+    include(S9Y_INCLUDE_PATH . 'rss.php');
     $data = ob_get_contents();
     ob_end_clean();
 
@@ -333,10 +337,13 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
                 $serendipity['GET']['category'] = $cat;
                 unset($_args[$k]);
             }
+        } elseif ($v{0} == 'A') { /* Author */
+            $serendipity['GET']['viewAuthor'] = $_GET['viewAuthor'] = (int)substr($v, 1);
+            unset($_args[$k]);
         }
     }
 
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else if (preg_match(PAT_PLUGIN, $uri, $matches)) {
     $serendipity['view'] = 'plugin';
     serendipity_plugin_api::hook_event('external_plugin', $matches[2]);
@@ -371,6 +378,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
                 unset($_args[$k]);
                 unset($serendipity['uriArguments'][$k]);
             }
+        } elseif ($v{0} == 'A') { /* Author */
+            $serendipity['GET']['viewAuthor'] = $_GET['viewAuthor'] = (int)substr($v, 1);
+            unset($_args[$k]);
         }
     }
 
@@ -383,7 +393,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     $serendipity['head_title']    = $cInfo['category_name'];
     $serendipity['head_subtitle'] = $serendipity['blogTitle'];
 
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else if ($is_multiauth || preg_match(PAT_PERMALINK_AUTHORS, $uri, $matches)) {
     $serendipity['view'] = 'authors';
 
@@ -422,7 +432,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     $serendipity['head_title']    = sprintf(ENTRIES_BY, $uInfo[0]['realname']);
     $serendipity['head_subtitle'] = $serendipity['blogTitle'];
 
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else if (preg_match(PAT_SEARCH, $uri, $matches)) {
     $serendipity['view'] = 'search';
     $_args = $serendipity['uriArguments'];
@@ -448,12 +458,61 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
 
     $serendipity['GET']['action']     = 'search';
     $serendipity['GET']['searchTerm'] = urldecode(htmlspecialchars(strip_tags(implode(' ', $search))));
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } elseif (preg_match(PAT_CSS, $uri, $matches)) {
     $serendipity['view'] = 'css';
     $css_mode = $matches[1];
-    include_once(S9Y_INCLUDE_PATH . 'serendipity.css.php');
+    include(S9Y_INCLUDE_PATH . 'serendipity.css.php');
     exit;
+} else if (preg_match(PAT_COMMENTS, $uri, $matches)) {
+    $serendipity['view'] = 'comments';
+    $_args = $serendipity['uriArguments'];
+    $timedesc = array();
+
+    /* Attempt to locate hidden variables within the URI */
+    $search = array();
+    foreach ($_args as $k => $v){
+        if ($v == PATH_COMMENTS) {
+            continue;
+        }
+
+        if ($v{0} == 'P') { /* Page */
+            $page = substr($v, 1);
+            if (is_numeric($page)) {
+                $serendipity['GET']['page'] = $page;
+                unset($_args[$k]);
+                unset($serendipity['uriArguments'][$k]);
+            }
+        } elseif (preg_match('@^(f|t|from|to)[\s_-]*([\d-/ ]+)$@', strtolower(urldecode($v)), $m)) {
+            $date = strtotime($m[2]);
+            if ($date < 1) {
+                continue;
+            }
+            if ($m[1] == 'f' || $m[1] == 'from') {
+                $serendipity['GET']['commentStartTime'] = $date;
+                $timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
+            } else {
+                $serendipity['GET']['commentEndTime'] = $date;
+                $timedesc['end'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
+            }
+        } elseif ($v == 'trackbacks' || $v == 'comments_and_trackbacks' || $v == 'comments') {
+            $serendipity['GET']['commentMode'] = $v;
+        } else {
+            $serendipity['GET']['viewCommentAuthor'] = urldecode($v);
+        }
+    }
+
+    $serendipity['head_title']    = COMMENTS_FROM . ' ' . htmlspecialchars($serendipity['GET']['viewCommentAuthor']);
+    if (isset($timedesc['start']) && isset($timedesc['end'])) {
+        $serendipity['head_title'] .= ' (' . $timedesc['start'] . ' - ' . $timedesc['end'] . ')';
+    } elseif (isset($timedesc['start'])) {
+        $serendipity['head_title'] .= ' (&gt; ' . $timedesc['start'] . ')';
+    } elseif (isset($timedesc['end'])) {
+        $serendipity['head_title'] .= ' (&lt; ' . $timedesc['end'] . ')';
+    }
+    $serendipity['head_subtitle'] = $serendipity['blogTitle'];
+    $serendipity['GET']['action']     = 'comments';
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else if (preg_match('@/(index(\.php|\.html)?)|'. preg_quote($serendipity['indexFile']) .'@', $uri) ||
            preg_match('@^/' . preg_quote(trim($serendipity['serendipityHTTPPath'], '/')) . '/?(\?.*)?$@', $uri)) {
 
@@ -466,12 +525,11 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
         $serendipity['uriArguments'][] = PATH_ARCHIVES;
     }
 
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else {
     $serendipity['view'] = '404';
-
     header('HTTP/1.0 404 Not found');
-    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
     // printf('<div class="serendipity_msg_important">' . DOCUMENT_NOT_FOUND . '</div>', $uri);
 }
 
@@ -482,7 +540,7 @@ if ($track_referer) {
 if (!defined('NO_EXIT')) {
     $raw_data = ob_get_contents();
     ob_end_clean();
-    $serendipity['smarty']->assign('raw_data', $raw_data);
+    $serendipity['smarty']->assign_by_ref('raw_data', $raw_data);
     if (empty($serendipity['smarty_file'])) {
         $serendipity['smarty_file'] = '404.tpl';
     }
index 24c6c184111e35cffbf28bf4ecacd76681f2b442..ec46c9f097646b61871350d8ec9dd47f1ea56b1f 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_cn.inc.php 1150 2006-04-24 17:39:59Z garvinhicking $
+<?php # $Id: serendipity_lang_cn.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translated by
 @define('PREFERENCE_USE_JS', 'Enable advanced JS usage?');
 @define('PREFERENCE_USE_JS_DESC', 'If enabled, advanced JavaScript sections will be enabled for better usability, like in the Plugin Configuration section you can use drag and drop for re-ordering plugins.');
 @define('PREFERENCE_USE_JS_WARNING', '(This page uses advanced JavaScripting. If you are having functionality issues, please disable the use of advanced JS usage in your personal preferences or disable your browser\'s JavaScript)');
+@define('INSTALL_PERMALINK_COMMENTSPATH', 'Path to comments');
index c0bc9b20efdc14b970501ee8965f3128a33da0a9..8f2f5c8825c127163d9870eb84e88dbe592fe82e 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_cs.inc.php 1286 2006-06-22 07:48:10Z garvinhicking $
+<?php # $Id: serendipity_lang_cs.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) 2004 Josef Klimosz <ok2wo@centrum.cz>
index de6667fa72e7aca2009d3b69601a11c9c4895bc7..6e00978eab6b809a5d03631f97a7c5701fe3a4f9 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_cz.inc.php 1286 2006-06-22 07:48:10Z garvinhicking $
+<?php # $Id: serendipity_lang_cz.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) 2004 Josef Klimosz <ok2wo@centrum.cz>
index 20b06112a193d37143ca2ab6e039fdd6b3d3e417..98aa8c7d95768466dac3e8cac3e439ad24bf0faa 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_da.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_da.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) by Tom Sommer, <ts@dreamcoder.dk>
index 0fe82b7c9b435eeef69e2048472d895322a884f1..6a7098dc966a882f59e50470659cd9ac67529485 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_de.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_de.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) Jannis Hermanns, Garvin Hicking and others
index 93229caa33d863f7f7547979df93e8498aa42f24..2475cd3128980636fbef795706613b5666dfe6fa 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_en.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_en.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 /* vim: set sts=4 ts=4 expandtab : */
 @define('PLUGIN_INACTIVE', 'Inactive');
 @define('PREFERENCE_USE_JS', 'Enable advanced JS usage?');
 @define('PREFERENCE_USE_JS_DESC', 'If enabled, advanced JavaScript sections will be enabled for better usability, like in the Plugin Configuration section you can use drag and drop for re-ordering plugins.');
-
 @define('PREFERENCE_USE_JS_WARNING', '(This page uses advanced JavaScripting. If you are having functionality issues, please disable the use of advanced JS usage in your personal preferences or disable your browser\'s JavaScript)');
-
-
 @define('INSTALL_PERMALINK_COMMENTSPATH', 'Path to comments');
index b6b7da7af7eefe166aebfa99846235165ba2fd35..2c7f80692f7627dea5169cbb451d31a88c2c9f5c 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_es.inc.php 1330 2006-07-22 14:32:10Z rlazo $
+<?php # $Id: serendipity_lang_es.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) by Luis Cervantes <LuisCervantes@ono.com>,
index eb103e2902e0e205f1931d2585115c77609ae478..c45f004764259f50c8c1db6b3cd028460a684915 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_fa.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_fa.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved. See LICENSE file for licensing details
 # this translation, translated by Omid Mottaghi <http://oxygenws.com>
index c7efa3d58c4df90b1a002bc0ee4aeb3aee9121fe..7de4ca8135f7d89be0c31ff415c04e488e4d02a6 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_fi.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_fi.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation by Mauri Sahlberg <mos@iki.fi>
index 670a959bf0bec661431779261209564c78ac2390..e2f172e403428f129241174e0df3aaec3b6bd9f2 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_fr.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_fr.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation by Sebastian Mordziol <argh@php-tools.net>
index d6bc031e348ddcad148a3020ff1f34ab37e90443..b3bdfe96539142bb8953d644a5f91ba7c063eca2 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_is.inc.php 1273 2006-06-19 08:17:00Z garvinhicking $
+<?php # $Id: serendipity_lang_is.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation by Örn Arnarson <orn@arnarson.net>
index a2be761b05e8282025bda30dfaa7a837f7c9e863..66ad67c0aec93a9a2b002f506809e4a3f87cb9c3 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_ja.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_ja.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) Tadashi Jokagi <elf2000@users.sourceforge.net>, 2004-2005.
index 53e12908895819de8b19b583ff9a0c893454398d..edbb273791a6dd0208163f2073d1368912275b14 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_ko.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_ko.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translated by: Wesley Hwang-Chung <wesley96@gmail.com>
index 55c97fbaec4749b6b849c6c90d12510347b0b1ea..d97a25667b6d08b4cd22e7581b1807298c7af665 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_nl.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_nl.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) by Christiaan Heerze <webmaster@heimp.nl>
index a8d860963566775b178775dace527129b3284248..98d5bcd5c947ed5e37d13594eb9d23798514a3f5 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_no.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_no.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) by Jo Christian Oterhals <oterhals@gmail.com>
index e38576a2b8e8615c0856fef63a1fa421f6feb0a3..1abbd7bf7bf7564ba0c5948d8e45bc78c76d6cd3 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_pt.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_pt.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation (c) by Agner Olson <agner@agner.net>
index 7769719c0d44b5c91af05b136f52ca0eb27b0055..f013888750b99423eca4f597e43b273aada8df72 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_ru.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_ru.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translation by Nightly <nightly@reys.net>
index 988a8a06585b84696ce5403481aeeb250dbcbf0a..8feeab0ecf1dd893f16144bec5ec4e2dc1053ff9 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_tn.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_tn.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translated by CapriSkye <admin@capriskye.com>
index 15d51771890e0ad3a8ae7df98cd6799669d34326..6e66bf71d430d1fd06d4056e757a2b743ce72878 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_tw.inc.php 1252 2006-06-09 20:17:14Z garvinhicking $
+<?php # $Id: serendipity_lang_tw.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translated by CapriSkye <admin@capriskye.com>
index 60fcbdae4f2c65ce9a345da21afbe7309bc39cea..c920fa50b3f534f672e79a04c09b05295fa9545b 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_lang_cn.inc.php 1150 2006-04-24 17:39:59Z garvinhicking $
+<?php # $Id: serendipity_lang_zh.inc.php 1342 2006-07-28 11:07:54Z garvinhicking $
 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
 # All rights reserved.  See LICENSE file for licensing details
 # Translated by
@@ -8,8 +8,7 @@
 
 @define('LANG_CHARSET', 'UTF-8');
 @define('SQL_CHARSET', 'utf8');
-@define('DATE_LOCALES', 'zh_CN.UTF-8, cn, zh');
-@define('DATE_FORMAT_ENTRY', '%A, %B %e. %Y');
+@define('DATE_LOCALES', 'zh_CN.UTF-8, cn, zh, zh_GB, zh_CN');
 @define('DATE_FORMAT_SHORT', '%Y-%m-%d %H:%M');
 @define('WYSIWYG_LANG', 'en');
 @define('NUMBER_FORMAT_DECIMALS', '2');
 @define('PERMISSION_ADMINIMAGESVIEWOTHERS', '浏览会员的媒体文件');
 @define('CHARSET_NATIVE', '预设');
 @define('INSTALL_CHARSET', '语言选项');
-@define('INSTALL_CHARSET_DESC', '这里可以让你转换 UTF-8 或预设编码 (ISO, GB2312, ...)有些语言包只有 UTF-8 编码,所以换成预设语言有不会任何改变。新安装的日志建议使用 UTF-8 编码。记得不要改变这个设定如果你已经发布了文章。详情参阅 http://www.s9y.org/index.php?node=46');
+@define('INSTALL_CHARSET_DESC', '这里可以让你转换 UTF-8 或预设编码 (ISO, UTF-8, ...)有些语言包只有 UTF-8 编码,所以换成预设语言有不会任何改变。新安装的日志建议使用 UTF-8 编码。记得不要改变这个设定如果你已经发布了文章。详情参阅 http://www.s9y.org/index.php?node=46');
 @define('CALENDAR_ENABLE_EXTERNAL_EVENTS', 'External Events');
 @define('CALENDAR_EXTEVENT_DESC', '如果开启,外挂可以在日历内以颜色显示它的事件。如果没有使用这些特殊的外挂,建议不要使用。');
 @define('XMLRPC_NO_LONGER_BUNDLED', 'XML-RPC API 功能不会添加在 s9y 的安装里,因为漏洞和不多人使用的关系。所以必须安装 XML-RPC 的外挂如果使用 XML-RPC API。所有的 URL 不会因此改变,安装这个外挂后马上使用。');