Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24806
Modified Files:
.cvsignore comment.php exit.php index.php rss.php
serendipity_admin.php serendipity_admin_image_selector.php
serendipity_config.inc.php serendipity_entries.php
serendipity_xmlrpc.php
Removed Files:
INSTALL LICENSE NEWS README TODO compat.php
htaccess.cgi.errordocs.tpl htaccess.cgi.normal.tpl
htaccess.cgi.rewrite.tpl htaccess.errordocs.tpl
htaccess.normal.tpl htaccess.rewrite.tpl serendipity.inc.php
serendipity_admin_category.inc.php
serendipity_admin_comments.inc.php
serendipity_admin_entries.inc.php
serendipity_admin_images.inc.php
serendipity_admin_installer.inc.php
serendipity_admin_interop.inc.php
serendipity_admin_overview.inc.php
serendipity_admin_plugins.inc.php
serendipity_admin_templates.inc.php
serendipity_admin_upgrader.inc.php
serendipity_admin_users.inc.php serendipity_config_local.tpl
serendipity_config_user.tpl serendipity_db.inc.php
serendipity_db_mysql.inc.php serendipity_db_mysqli.inc.php
serendipity_db_postgres.inc.php serendipity_db_sqlite.inc.php
serendipity_entries_overview.inc.php
serendipity_functions.inc.php
serendipity_functions_config.inc.php
serendipity_functions_images.inc.php
serendipity_functions_installer.inc.php
serendipity_genpage.inc.php serendipity_lang.inc.php
serendipity_layout.inc.php serendipity_layout_table.inc.php
serendipity_plugin_api.php serendipity_rss_exchange.inc.php
serendipity_sidebar_items.php upgrade.sh
Log Message:
Merge from 'branch-smarty' to HEAD.
--- serendipity_admin_installer.inc.php DELETED ---
--- serendipity_lang.inc.php DELETED ---
--- serendipity_genpage.inc.php DELETED ---
--- htaccess.normal.tpl DELETED ---
Index: serendipity_admin_image_selector.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_image_selector.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- serendipity_admin_image_selector.php 30 Aug 2004 18:56:19 -0000 1.32
+++ serendipity_admin_image_selector.php 19 Nov 2004 11:04:59 -0000 1.33
@@ -22,6 +22,14 @@
die(HAVE_TO_BE_LOGGED_ON);
}
+if (!isset($serendipity['GET']['adminModule'])) {
+ $serendipity['GET']['adminModule'] = (isset($serendipity['POST']['adminModule']) ? $serendipity['POST']['adminModule'] : '');
+}
+
+if (!isset($serendipity['GET']['step'])) {
+ $serendipity['GET']['step'] = (isset($serendipity['POST']['step']) ? $serendipity['POST']['step'] : '');
+}
+
?>
<html>
<head>
@@ -31,10 +39,46 @@
</head>
<body class="s9y_wrap" id="serendipity_admin_image_page">
+<div style="margin: 5px">
<?php
switch ($serendipity['GET']['step']) {
case '1':
- $file = serendipity_fetchImageFromDatabase($serendipity['GET']['image']);
+ if (isset($serendipity['GET']['adminAction'])) { // Embedded upload form
+ switch ($serendipity['GET']['adminAction']) {
+ case 'addSelect':
+ $image_selector_addvars = array(
+ 'step' => 1,
+ 'textarea' => (!empty($serendipity['GET']['textarea']) ? $serendipity['GET']['textarea'] : ''),
+ 'htmltarget' => (!empty($serendipity['GET']['htmltarget']) ? $serendipity['GET']['htmltarget'] : ''),
+ 'filename_only' => (!empty($serendipity['GET']['filename_only']) ? $serendipity['GET']['filename_only'] : '')
+ );
+ include S9Y_INCLUDE_PATH . 'include/admin/images.inc.php';
+ break 2;
+
+ case 'add':
+ include S9Y_INCLUDE_PATH . 'include/admin/images.inc.php';
+ if (isset($created_thumbnail) && is_array($created_thumbnail) && isset($created_thumbnail['image_id'])) {
+ $serendipity['GET']['image'] = (int)$created_thumbnail['image_id'];
+
+ if (!empty($serendipity['POST']['htmltarget'])) {
+ $serendipity['GET']['htmltarget'] = $serendipity['POST']['htmltarget'];
+ }
+
+ if (!empty($serendipity['POST']['filename_only'])) {
+ $serendipity['GET']['filename_only'] = $serendipity['POST']['filename_only'];
+ }
+
+ if (!empty($serendipity['POST']['textarea'])) {
+ $serendipity['GET']['textarea'] = $serendipity['POST']['textarea'];
+ }
+ break;
+ } else {
+ break 2;
+ }
+ }
+ }
+
+ $file = serendipity_fetchImageFromDatabase($serendipity['GET']['image']);
$imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$imgName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] .'.'. $file['extension'];
$thumbbasename = $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
@@ -46,7 +90,9 @@
<script type="text/javascript" language="Javascript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_editor.js"></script>
<div>
-<?php if ($is_image) {?>
+<?php
+ if ($is_image) {
+?>
<img align="right" src="<?php echo $imgsrc; ?>">
<h1><?php printf(YOU_CHOSE, $file['name']); ?></h1>
<p>
@@ -135,10 +181,8 @@
$add_url .= '&serendipity[filename_only]=' . $serendipity['GET']['filename_only'];
}
?>
- <b><?php echo SELECT_FILE; ?></b>
- <br />
-
- <?php echo CLICK_FILE_TO_INSERT; ?>
+ <h1><?php echo SELECT_FILE; ?></h1>
+ <h2><?php echo CLICK_FILE_TO_INSERT; ?></h2>
<br />
<?php
@@ -146,11 +190,13 @@
isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1,
4,
false,
- '?serendipity[step]=1' . $add_url . '&serendipity[textarea]='. $serendipity['GET']['textarea']
+ '?serendipity[step]=1' . $add_url . '&serendipity[textarea]='. $serendipity['GET']['textarea'],
+ true
);
}
?>
+</div>
</body>
</html>
--- serendipity_layout_table.inc.php DELETED ---
--- serendipity_rss_exchange.inc.php DELETED ---
--- htaccess.cgi.rewrite.tpl DELETED ---
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- serendipity_config.inc.php 8 Nov 2004 08:55:08 -0000 1.100
+++ serendipity_config.inc.php 19 Nov 2004 11:04:59 -0000 1.101
@@ -4,20 +4,20 @@
if (!defined('S9Y_INCLUDE_PATH')) {
define('S9Y_INCLUDE_PATH', dirname(__FILE__) . '/');
}
-define('S9Y_CONFIG_TEMPLATE', S9Y_INCLUDE_PATH . 'serendipity_config_local.tpl');
-define('S9Y_CONFIG_USERTEMPLATE', S9Y_INCLUDE_PATH . 'serendipity_config_user.tpl');
+define('S9Y_CONFIG_TEMPLATE', S9Y_INCLUDE_PATH . 'include/tpl/config_local.tpl');
+define('S9Y_CONFIG_USERTEMPLATE', S9Y_INCLUDE_PATH . 'include/tpl/config_user.tpl');
define('IS_installed', file_exists('serendipity_config_local.inc.php'));
-if ( IS_installed === true ) {
+if (IS_installed === true) {
define('IN_serendipity', true);
}
-include_once(S9Y_INCLUDE_PATH . 'compat.php');
+include_once(S9Y_INCLUDE_PATH . 'include/compat.inc.php');
-$serendipity['version'] = '0.7';
+$serendipity['version'] = '0.8-alpha3';
$serendipity['defaultTemplate'] = 'default'; // Name of folder for the default theme
-$serendipity['production'] = 1;
+$serendipity['production'] = true; // Setting this to 'false' will enable debugging output
$serendipity['rewrite'] = 'none';
$serendipity['messagestack'] = array();
@@ -48,10 +48,14 @@
// How many bytes are allowed for fetching trackbacks, so that no binary files get accidently trackbacked?
$serendipity['trackback_filelimit'] = 150 * 1024;
+if (!isset($serendipity['fetchLimit'])) {
+ $serendipity['fetchLimit'] = 15;
+}
+
/*
* Load main language file
*/
-include($serendipity['serendipityPath'] . 'serendipity_lang.inc.php');
+include($serendipity['serendipityPath'] . 'include/lang.inc.php');
/* URI paths
* These could be defined in the language headers, except that would break
@@ -67,6 +71,7 @@
@define('PATH_ENTRIES', 'entries');
@define('PATH_CATEGORIES', 'categories');
@define('PATH_PLUGIN', 'plugin');
+@define('PATH_SMARTY_COMPILE', 'templates_c'); // will be placed inside the template directory
/* URI patterns
* Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts
@@ -76,8 +81,7 @@
@define('PAT_UNSUBSCRIBE', '@/'.PATH_UNSUBSCRIBE.'/(.*)/([0-9]+)@');
@define('PAT_APPROVE', '@/'.PATH_APPROVE.'/(.*)/(.*)/([0-9]+)@');
@define('PAT_DELETE', '@/'.PATH_DELETE.'/(.*)/(.*)/([0-9]+)@');
-@define('PAT_ARCHIVES', '@/'.PATH_ARCHIVES.'/([0-9]+)\.html@');
-@define('PAT_ARCHIVES_SHORT', '@/'.PATH_ARCHIVES.'/([0-9]+)[_\-]short\.html@');
+@define('PAT_ARCHIVES', '@/'.PATH_ARCHIVES.'([/A-Za-z0-9]+)\.html@');
@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
@define('PAT_FEEDS', '@/'.PATH_FEEDS.'/@');
@define('PAT_FEED', '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
@@ -121,13 +125,15 @@
include_once(S9Y_INCLUDE_PATH . '/serendipity_config_local.inc.php');
}
+define('IS_up2date', version_compare(serendipity_version($serendipity['version']), serendipity_version($serendipity['versionInstalled']), '<='));
+
/*
* Include main functions
*/
-include_once(S9Y_INCLUDE_PATH . 'serendipity_functions.inc.php');
+include_once(S9Y_INCLUDE_PATH . 'include/functions.inc.php');
if (serendipity_FUNCTIONS_LOADED!== true) {
- die(sprintf(INCLUDE_ERROR, 'serendipity_functions.inc.php'));
+ die(sprintf(INCLUDE_ERROR, 'include/functions.inc.php'));
}
/*
@@ -147,6 +153,7 @@
/*
* If a user is logged in, fetch his preferences. He possibly wants to have a different language
*/
+
if (isset($_SESSION['serendipityAuthorid'])) {
serendipity_load_configuration($_SESSION['serendipityAuthorid']);
}
@@ -154,9 +161,8 @@
/*
* Load main language file again, because now we have the preferred language
*/
-define('IS_up2date', version_compare(serendipity_version($serendipity['version']), serendipity_version($serendipity['versionInstalled']), '<='));
-include(S9Y_INCLUDE_PATH .'serendipity_lang.inc.php');
+include(S9Y_INCLUDE_PATH . 'include/lang.inc.php');
/*
* Set current locale, if any has been defined
@@ -182,7 +188,7 @@
}
/*
- * Check if the installed version is highter than the version of the config
+ * Check if the installed version is higher than the version of the config
*/
if (IS_up2date === false && $serendipity['production'] && !defined('IN_upgrader')) {
@@ -223,5 +229,33 @@
serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
+define('SMARTY_DIR', S9Y_INCLUDE_PATH . 'bundled-libs/Smarty/libs/');
+require_once SMARTY_DIR . 'Smarty.class.php';
+$serendipity['smarty'] = new Smarty;
+if (!$serendipity['production']) {
+ $serendipity['smarty']->force_compile = true;
+ $serendipity['smarty']->debugging = true;
+}
+$serendipity['smarty']->template_dir = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'];
+$serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
+$serendipity['smarty']->config_dir = &$serendipity['smarty']->template_dir;
+$serendipity['smarty']->secure_dir = array($serendipity['serendipityPath'] . $serendipity['templatePath']);
+$serendipity['smarty']->security_settings['MODIFIER_FUNCS'] = array('sprintf', 'sizeof', 'count');
+$serendipity['smarty']->security = true;
+$serendipity['smarty']->use_sub_dirs = false;
+$serendipity['smarty']->compile_check = true;
+$serendipity['smarty']->compile_id = &$serendipity['template'];
+
+$serendipity['smarty']->register_modifier('makeFilename', 'serendipity_makeFilename');
+$serendipity['smarty']->register_modifier('xhtml_target', 'serendipity_xhtml_target');
+$serendipity['smarty']->register_modifier('emptyPrefix', 'serendipity_emptyPrefix');
+$serendipity['smarty']->register_modifier('formatTime', 'serendipity_smarty_formatTime');
+$serendipity['smarty']->register_function('serendipity_printSidebar', 'serendipity_smarty_printSidebar');
+$serendipity['smarty']->register_function('serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
+$serendipity['smarty']->register_function('serendipity_getFile', 'serendipity_smarty_getFile');
+$serendipity['smarty']->register_function('serendipity_printComments', 'serendipity_smarty_printComments');
+$serendipity['smarty']->register_function('serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
+
+
/* vim: set sts=4 ts=4 expandtab : */
?>
--- INSTALL DELETED ---
--- NEWS DELETED ---
--- serendipity_db.inc.php DELETED ---
--- serendipity_admin_category.inc.php DELETED ---
--- serendipity_db_mysql.inc.php DELETED ---
Index: .cvsignore
===================================================================
RCS file: /cvsroot/php-blog/serendipity/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- .cvsignore 2 Aug 2003 15:14:19 -0000 1.3
+++ .cvsignore 19 Nov 2004 11:04:57 -0000 1.4
@@ -2,4 +2,4 @@
serendipity_config_local.inc.php
.htaccess
uploads
-archives
\ No newline at end of file
+archives
--- serendipity_admin_templates.inc.php DELETED ---
--- LICENSE DELETED ---
--- htaccess.rewrite.tpl DELETED ---
Index: index.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/index.php,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- index.php 3 Nov 2004 10:00:16 -0000 1.53
+++ index.php 19 Nov 2004 11:04:58 -0000 1.54
@@ -1,12 +1,26 @@
<?php # $Id$
+$global_debug = true;
+
+if ($global_debug) {
+ #apd_set_pprof_trace();
+
+ function microtime_float() {
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+ }
+
+ $time_start = microtime_float();
+}
+
// We need to set this to return a 200 since we use .htaccess ErrorDocument
// rules to handle archives.
-header('HTTP/1.0 200\r\n');
+header('HTTP/1.0 200');
header('X-Blog: Serendipity'); // Used for installer detection
// Session and serendipity_login() are needed to also remember an autologin
// user on the frontend
+ob_start();
session_start();
include_once('serendipity_config.inc.php');
serendipity_login();
@@ -16,15 +30,15 @@
$uri = $_SERVER['REQUEST_URI'];
if (preg_match(PAT_UNSUBSCRIBE, $uri, $res)) {
- if ( serendipity_cancelSubscription(urldecode($res[1]), $res[2]) ) {
+ if (serendipity_cancelSubscription(urldecode($res[1]), $res[2])) {
define('DATA_UNSUBSCRIBED', urldecode($res[1]));
}
- $uri = '/'.PATH_UNSUBSCRIBE.'/'. $res[2] .'_untitled.html';
+ $uri = '/' . PATH_UNSUBSCRIBE . '/' . $res[2] . '_untitled.html';
}
if (preg_match(PAT_DELETE, $uri, $res) && $serendipity['serendipityAuthedUser'] === true) {
- if ( $res[1] == 'comment' && serendipity_deleteComment($res[2], $res[3], 'comments') ) {
+ if ($res[1] == 'comment' && serendipity_deleteComment($res[2], $res[3], 'comments')) {
define('DATA_COMMENT_DELETED', $res[2]);
} elseif ( $res[1] == 'trackback' && serendipity_deleteComment($res[2], $res[3], 'trackbacks') ) {
define('DATA_TRACKBACK_DELETED', $res[2]);
@@ -32,62 +46,64 @@
}
if (preg_match(PAT_APPROVE, $uri, $res) && $serendipity['serendipityAuthedUser'] === true) {
- if ( $res[1] == 'comment' && serendipity_approveComment($res[2], $res[3]) ) {
+ if ($res[1] == 'comment' && serendipity_approveComment($res[2], $res[3])) {
define('DATA_COMMENT_APPROVED', $res[2]);
- } elseif ( $res[1] == 'trackback' && serendipity_approveComment($res[2], $res[3]) ) {
+ } elseif ($res[1] == 'trackback' && serendipity_approveComment($res[2], $res[3])) {
define('DATA_TRACKBACK_APPROVED', $res[2]);
}
}
if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range']) && is_numeric($serendipity['GET']['range'])) {
- if (!empty($serendipity['GET']['range'])) {
- $range = $serendipity['GET']['range'];
- } else {
- $range = $matches[1];
- }
- $_GET['serendipity']['action'] = 'read';
- $_GET['serendipity']['range'] = $range;
+ preg_match_all('@/([a-z0-9]+)@i', $matches[1], $args);
- if (strlen($range) == 6) {
- $date = serendipity_formatTime('%B %Y', mktime(0, 0, 0, substr($range, 4, 6), 2, substr($range, 0, 4)));
- } else {
- $date = serendipity_formatTime(DATE_FORMAT_ENTRY, strtotime($range));
+ /* Attempt to locate hidden variables within the URI */
+ foreach ($args[1] as $k => $v){
+ if ($v{0} == 'C') { /* category */
+ $serendipity['GET']['category'] = substr($v, 1);
+ unset($args[1][$k]);
+ } elseif ($v{0} == 'W') { /* Week */
+ $week = substr($v, 1);
+ unset($args[1][$k]);
+ } elseif ($v == 'summary') { /* Summary */
+ $serendipity['short_archives'] = true;
+ unset($args[1][$k]);
+ }
}
- $serendipity['blogSubTitle'] = sprintf(ENTRIES_FOR, $date);
- ob_start();
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
- $data = ob_get_contents();
- ob_end_clean();
-
- if (isset($serendipity['pregenerate']) && $serendipity['pregenerate']) {
- $fp = fopen('./'.PATH_ARCHIVES.'/' . $matches[1], 'w');
- fwrite($fp, $data);
- fclose($fp);
- }
+ /* We must always *assume* that Year, Month and Day are the first 3 arguments */
+ list($year, $month, $day) = $args[1];
- echo $data;
-} else if (preg_match(PAT_ARCHIVES_SHORT, $uri, $matches)) {
- $range = $matches[1];
- $_GET['serendipity']['action'] = 'read';
- $_GET['serendipity']['range'] = $range;
- $serendipity['short_archives'] = true;
+ $_GET['serendipity']['action'] = 'read';
+ $_GET['serendipity']['hidefooter'] = true;
- if (strlen($range) == 6) {
- $date = date('m/Y', mktime(0,0,0, substr($range, 4, 6), 2, substr($range, 0, 4)));
+ if ($week) {
+ $tm = strtotime('+ '. ($week-2) .' WEEKS monday', mktime(0, 0, 0, 1, 1, $year));
+ $ts = mktime(0, 0, 0, date('m', $tm), date('j', $tm), $year);
+ $te = mktime(23, 59, 59, date('m', $tm), date('j', $tm)+7, $year);
+ $date = serendipity_formatTime(WEEK .' '. $week .', %Y', $ts, false);
} else {
- $date = date('d/m/Y', strtotime($range));
+ if ($day) {
+ $ts = mktime(0, 0, 0, $month, $day, $year);
+ $te = mktime(23, 59, 59, $month, $day, $year);
+ $date = serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false);
+ } else {
+ $ts = mktime(0, 0, 0, $month, 1, $year);
+ $te = mktime(23, 59, 59, $month, date('t', $ts), $year);
+ $date = serendipity_formatTime('%B %Y', $ts, $false);
+ }
}
- $serendipity['blogSubTitle'] = sprintf(ENTRIES_FOR, $date);
+ $serendipity['range'] = array($ts, $te);
+ $serendipity['smarty']->assign('head_subtitle', sprintf(ENTRIES_FOR, $date));
+
ob_start();
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
$data = ob_get_contents();
ob_end_clean();
if (isset($serendipity['pregenerate']) && $serendipity['pregenerate']) {
- $fp = fopen('./archives/' . $matches[1], 'w');
+ $fp = fopen('./'.PATH_ARCHIVES.'/' . $matches[1], 'w');
fwrite($fp, $data);
fclose($fp);
}
@@ -129,41 +145,36 @@
$title = serendipity_db_query("SELECT title FROM {$serendipity['dbPrefix']}entries WHERE id=$id", true);
$title = $title[0];
- $serendipity['blogSubTitle'] = $serendipity['blogTitle'];
- $serendipity['blogTitle'] = $title;
+ $serendipity['smarty']->assign(array('head_title' => $title, 'head_subtitle' => $serendipity['blogTitle']));
ob_start();
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
$data = ob_get_contents();
ob_end_clean();
if (isset($serendipity['pregenerate']) && $serendipity['pregenerate']) {
- $fp = fopen('./'.PATH_ARCHIVES.'/' . $matches[1], 'w');
+ $fp = fopen($serendipity['serendipityPath'] . PATH_ARCHIVES.'/' . $id, 'w');
fwrite($fp, $data);
fclose($fp);
}
print $data;
-} else if (preg_match(PAT_FEEDS, $uri)) {
+} elseif (preg_match(PAT_FEEDS, $uri) && preg_match('@/(index|atom|rss|comments|opml)\.(rss[0-9]?|rdf|rss|xml|atom)$@', $uri, $matches)) {
header('Content-Type: text/html; charset=utf-8');
- if (preg_match('@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@', $uri, $matches)) {
- $_GET['version'] = serendipity_discover_rss($matches[1], $matches[2]);
-
- ob_start();
- include_once(S9Y_INCLUDE_PATH . 'rss.php');
- $data = ob_get_contents();
- ob_end_clean();
-
- $data = ltrim($data);
+ list($_GET['version'], $_GET['type']) = serendipity_discover_rss($matches[1], $matches[2]);
- if ($serendipity['pregenerate']) {
- $fp = fopen('./'.PATH_FEEDS.'/index.' . $matches[1], 'w');
- fwrite($fp, $data);
- fclose($fp);
- }
+ ob_start();
+ include_once(S9Y_INCLUDE_PATH . 'rss.php');
+ $data = ob_get_contents();
+ ob_end_clean();
- print $data;
- exit;
+ if ($serendipity['pregenerate']) {
+ $fp = fopen($serendipity['serendipityPath'] . PATH_FEEDS.'/index.' . $matches[1], 'w');
+ fwrite($fp, $data);
+ fclose($fp);
}
+
+ print $data;
+ exit;
} else if (preg_match(PAT_ADMIN, $uri)) {
header("Location: {$serendipity['serendipityHTTPPath']}serendipity_admin.php");
exit;
@@ -172,7 +183,7 @@
exit;
} else if (preg_match(PAT_ARCHIVE, $uri)) {
$serendipity['GET']['action'] = 'archives';
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else if (preg_match(PAT_PLUGIN, $uri, $matches)) {
serendipity_plugin_api::hook_event('external_plugin', $matches[1]);
exit;
@@ -186,11 +197,11 @@
}
ob_start();
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
$data = ob_get_contents();
ob_end_clean();
if (isset($serendipity['pregenerate']) && $serendipity['pregenerate']) {
- $fp = fopen('./index.html', 'w');
+ $fp = fopen($serendipity['serendipityPath'] . 'index.html', 'w');
fwrite($fp, $data);
fclose($fp);
}
@@ -202,9 +213,9 @@
if (isset($serendipity['GET']['calendarZoom'])) {
$serendipity['GET']['action'] = 'read';
- $serendipity['GET']['range'] = $serendipity['GET']['calendarZoom'];
+ $serendipity['GET']['range'] = $serendipity['GET']['calendarZoom'];
}
- include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
}
} else {
printf(DOCUMENT_NOT_FOUND, $uri);
@@ -214,5 +225,18 @@
serendipity_track_referrer();
}
+$raw_data = ob_get_contents();
+ob_end_clean();
+$serendipity['smarty']->assign('raw_data', $raw_data);
+if (empty($serendipity['smarty_file'])) {
+ $serendipity['smarty_file'] = '404.tpl';
+}
+$serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
+
+if ($global_debug) {
+ /* TODO: Remove (hide) this debug */
+ echo '<div id="s9y_debug" style="text-align: center; color: red; font-size: 10pt; font-weight: bold; padding: 10px">Page generated in '. round(microtime_float()-$time_start,6) .' seconds, '. sizeof(get_included_files()) .' files included</div>';
+}
+
/* vim: set sts=4 ts=4 expandtab : */
?>
--- serendipity_layout.inc.php DELETED ---
--- serendipity_admin_users.inc.php DELETED ---
Index: serendipity_xmlrpc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_xmlrpc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- serendipity_xmlrpc.php 20 Oct 2004 16:27:23 -0000 1.19
+++ serendipity_xmlrpc.php 19 Nov 2004 11:05:20 -0000 1.20
@@ -484,8 +484,8 @@
'mt_convert_breaks' => new XML_RPC_Value('', 'string'),
'mt_keywords' => new XML_RPC_Value('', 'string'),
'title' => new XML_RPC_Value($entry['title'],'string'),
- 'permalink' => new XML_RPC_Value($serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? '/' . $serendipity['indexFile'] . '?' : '') . '/'.PATH_ARCHIVES.'/' . $postid . '_.html', 'string'),
- 'link' => new XML_RPC_Value($serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? '/' . $serendipity['indexFile'] . '?' : '') . '/'.PATH_ARCHIVES.'/' . $postid . '_.html', 'string'),
+ 'permalink' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html', 'baseURL'), 'string'),
+ 'link' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html', 'baseURL'), 'string'),
);
return array_merge($entry, $tmp);
@@ -499,4 +499,4 @@
ob_end_flush();
}
/* vim: set sts=4 ts=4 expandtab : */
-?>
\ No newline at end of file
+?>
Index: serendipity_admin.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- serendipity_admin.php 28 Sep 2004 10:03:43 -0000 1.42
+++ serendipity_admin.php 19 Nov 2004 11:04:59 -0000 1.43
@@ -28,7 +28,7 @@
?>
</head>
-<body class="s9y_wrap" id="serendipity_admin_page" onload="if (self.Spawnnugget) { Spawnnugget(); }">
+<body class="s9y_wrap" id="serendipity_admin_page" onLoad="if (self.Spawnnugget) { Spawnnugget(); }">
<div id="serendipity_banner">
<?php if ( IS_installed === true && IS_up2date === true ) { ?>
<h1><?php echo (isset($serendipity['blogTitle']) ? $serendipity['blogTitle'] : ''); ?></h1>
@@ -43,9 +43,9 @@
<?php
if (!isset($serendipity['serendipityPath']) || IS_installed === false || IS_up2date === false ) {
if (IS_installed === false) {
- $file = 'serendipity_admin_installer.inc.php';
+ $file = 'include/admin/installer.inc.php';
} elseif ( IS_up2date === false ) {
- $file = 'serendipity_admin_upgrader.inc.php';
+ $file = 'include/admin/upgrader.inc.php';
} else {
$file = ''; // For register_global users don't let us be tricked to include a different file somehow
}
@@ -67,6 +67,7 @@
<div class="serendipitySideBarContent">
• <a href="?serendipity[adminModule]=templates"><?php echo MANAGE_STYLES; ?></a><br />
• <a href="?serendipity[adminModule]=plugins"><?php echo CONFIGURE_PLUGINS; ?></a><br />
+ <?php serendipity_plugin_api::hook_event('backend_sidebar_admin_appearance', $serendipity); ?>
</div>
</div>
<?php } ?>
@@ -77,7 +78,9 @@
<?php if ($serendipity['serendipityUserlevel'] >= USERLEVEL_CHIEF) { ?>
• <a href="?serendipity[adminModule]=users"><?php echo MANAGE_USERS; ?></a><br />
<?php } ?>
- • <a href="?serendipity[adminModule]=interop"><?php echo IMPORT_EXPORT_ENTRIES; ?></a><br />
+ • <a href="?serendipity[adminModule]=import"><?php echo IMPORT_ENTRIES; ?></a><br />
+ • <a href="?serendipity[adminModule]=export"><?php echo EXPORT_ENTRIES; ?></a><br />
+ <?php serendipity_plugin_api::hook_event('backend_sidebar_admin', $serendipity); ?>
</div>
</div>
<div class="serendipitySideBarItem">
@@ -99,27 +102,31 @@
switch($serendipity['GET']['adminModule']) {
case 'installer':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_installer.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/installer.inc.php';
break;
case 'images':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_images.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/images.inc.php';
break;
case 'templates':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_templates.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/templates.inc.php';
break;
case 'plugins':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_plugins.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/plugins.inc.php';
break;
case 'users':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_users.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/users.inc.php';
break;
- case 'interop':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_interop.inc.php';
+ case 'export':
+ include S9Y_INCLUDE_PATH . 'include/admin/export.inc.php';
+ break;
+
+ case 'import':
+ include S9Y_INCLUDE_PATH . 'include/admin/import.inc.php';
break;
case 'logout':
@@ -127,7 +134,7 @@
break;
default:
- include S9Y_INCLUDE_PATH . 'serendipity_admin_overview.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/overview.inc.php';
}
}
?>
--- serendipity_functions_images.inc.php DELETED ---
--- compat.php DELETED ---
--- README DELETED ---
--- serendipity_functions_installer.inc.php DELETED ---
--- upgrade.sh DELETED ---
--- serendipity_admin_interop.inc.php DELETED ---
--- TODO DELETED ---
Index: rss.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/rss.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- rss.php 19 Oct 2004 20:29:44 -0000 1.31
+++ rss.php 19 Nov 2004 11:04:59 -0000 1.32
@@ -2,14 +2,15 @@
header('Content-Type: text/xml; charset=utf-8');
include_once('serendipity_config.inc.php');
-$version = strtolower($_GET['version']);
-if (empty($version)) {
- $version = serendipity_discover_rss($_GET['file'], $_GET['ext']);
-}
-
+$version = $_GET['version'];
$description = $serendipity['blogDescription'];
$title = $serendipity['blogTitle'];
$comments = FALSE;
+
+if ( empty($version) ) {
+ list($version) = serendipity_discover_rss($_GET['file'], $_GET['ext']);
+}
+
if (isset($_GET['category'])) {
$serendipity['GET']['category'] = $_GET['category'];
}
@@ -25,7 +26,7 @@
break;
case 'content':
default:
- $latest_entry = serendipity_fetchEntries(null, false, 1, false, false, 'last_modified DESC');
+ $latest_entry = serendipity_fetchEntries(null, false, 1, false, false, 'last_modified DESC', '', false, true);
break;
}
@@ -37,14 +38,14 @@
// See if the client has provided the required headers.
// Always convert the provided header into GMT timezone to allow comparing to the server-side last-modified header
$modified_since = !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])
- ? gmdate('D, d M Y H:i:s \G\M\T', strtotime(stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE'])))
+ ? gmdate('D, d M Y H:i:s \G\M\T', serendipity_serverOffsetHour(strtotime(stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE'])), true))
: false;
$none_match = !empty($_SERVER['HTTP_IF_NONE_MATCH'])
? str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH']))
: false;
if (is_array($latest_entry) && isset($latest_entry[0]['last_modified'])) {
- $last_modified = gmdate('D, d M Y H:i:s \G\M\T', $latest_entry[0]['last_modified']);
+ $last_modified = gmdate('D, d M Y H:i:s \G\M\T', serendipity_serverOffsetHour($latest_entry[0]['last_modified'], true));
$etag = '"' . $last_modified . '"';
header('Last-Modified: ' . $last_modified);
@@ -69,25 +70,28 @@
case 'content':
default:
if (isset($_GET['all']) && $_GET['all']) {
- $entries = serendipity_fetchEntries(null, true);
+ // Fetch all entries in reverse order for later importing. Fetch sticky entries as normal entries.
+ $entries = serendipity_fetchEntries(null, true, '', false, false, 'id ASC', '', false, true);
} else {
- $entries = serendipity_fetchEntries(null, true, 15, false, (isset($modified_since) ? $modified_since : false));
+ $entries = serendipity_fetchEntries(null, true, 15, false, (isset($modified_since) ? $modified_since : false), 'timestamp DESC', '', false, true);
}
break;
}
$title = serendipity_utf8_encode(htmlspecialchars($title));
$description = serendipity_utf8_encode(htmlspecialchars($description));
+$fullFeed = false;
-include_once(S9Y_INCLUDE_PATH . 'serendipity_plugin_api.php');
+include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
$plugins = serendipity_plugin_api::enum_plugins();
if (is_array($plugins)) {
// load each plugin to make some introspection
foreach ($plugins as $plugin_data) {
if (preg_match('|@serendipity_syndication_plugin|', $plugin_data['name'])) {
- $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name']);
+ $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']);
$additional_fields = $plugin->generate_rss_fields($title, $description, $entries);
+ $fullFeed = $plugin->get_config('fullfeed', false);
break;
}
}
@@ -176,7 +180,7 @@
break;
case 'atom0.3':
- $modified = gmdate('Y-m-d\TH:i:s\Z', $entries[0]['last_modified']);
+ $modified = gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entries[0]['last_modified']));
print <<<HEAD
<feed version="0.3"
xmlns="http://purl.org/atom/ns#"
@@ -203,7 +207,7 @@
break;
case 'opml1.0':
- $modified = gmdate('Y-m-d\TH:i:s\Z', $entries[0]['last_modified']);
+ $modified = gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entries[0]['last_modified']));
print <<<HEAD
<opml version="{$version}">
<head>
@@ -219,7 +223,7 @@
die("Invalid RSS version specified\n");
}
-serendipity_printEntries_rss($entries, $version, $comments);
+serendipity_printEntries_rss($entries, $version, $comments, $fullFeed);
switch ($version) {
case '0.91':
--- serendipity_config_local.tpl DELETED ---
--- serendipity_config_user.tpl DELETED ---
--- serendipity_db_sqlite.inc.php DELETED ---
--- htaccess.cgi.errordocs.tpl DELETED ---
--- serendipity_admin_plugins.inc.php DELETED ---
--- serendipity_entries_overview.inc.php DELETED ---
--- serendipity_admin_overview.inc.php DELETED ---
--- serendipity_plugin_api.php DELETED ---
Index: exit.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/exit.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- exit.php 15 Oct 2004 14:22:28 -0000 1.11
+++ exit.php 19 Nov 2004 11:04:58 -0000 1.12
@@ -4,15 +4,15 @@
$url = $serendipity['baseURL'];
-if (isset($_GET['url_id']) && !empty($_GET['url_id']) && isset($_GET['entry_id']) && !empty($_GET['entry_id']) && is_numeric($_GET['url_id']) && is_numeric($_GET['entry_id'])) {
+if (isset($_GET['url_id']) && !empty($_GET['url_id']) && isset($_GET['entry_id']) && !empty($_GET['entry_id'])) {
// See if the submitted link is in our database and should be tracked
- $links = serendipity_db_query("SELECT link FROM {$serendipity['dbPrefix']}references WHERE id = '". (int)$_GET['url_id'] ."' AND entry_id = '". (int)$_GET['entry_id'] ."'", true);
+ $links = serendipity_db_query("SELECT link FROM {$serendipity['dbPrefix']}references WHERE id = {$_GET['url_id']} AND entry_id = {$_GET['entry_id']}", true);
if (is_array($links) && isset($links['link'])) {
// URL is valid. Track it.
$url = $links['link'];
- serendipity_track_url('exits', $url, (int)$_GET['entry_id']);
+ serendipity_track_url('exits', $url, $_GET['entry_id']);
} elseif (isset($_GET['url']) && !empty($_GET['url'])) {
// URL is invalid. But a URL-location was sent, so we want to redirect the user kindly.
$url = str_replace('&', '&', base64_decode($_GET['url']));
@@ -22,8 +22,11 @@
// No entry-link ID was submitted. Possibly a spammer tried to mis-use the script to get into the top-list.
$url = str_replace('&', '&', base64_decode($_GET['url']));
}
-if (serendipity_isResponseClean($url))
+
+if (serendipity_isResponseClean($url)) {
+ header('HTTP/1.0 301 Moved Permanently');
header('Location: ' . $url);
+}
exit;
/* vim: set sts=4 ts=4 expandtab : */
?>
--- htaccess.cgi.normal.tpl DELETED ---
--- serendipity_db_postgres.inc.php DELETED ---
--- serendipity.inc.php DELETED ---
--- serendipity_admin_comments.inc.php DELETED ---
Index: serendipity_entries.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_entries.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- serendipity_entries.php 20 Oct 2004 16:27:23 -0000 1.43
+++ serendipity_entries.php 19 Nov 2004 11:05:17 -0000 1.44
@@ -37,7 +37,7 @@
<body class="s9y_wrap" id="serendipity_admin_entries_page" onload="if (self.Spawnextended) { Spawnextended(); } if (self.Spawnbody) { Spawnbody(); }">
<div id="serendipity_banner">
<h1><?php echo $serendipity['blogTitle'] ; ?></h1>
- <h2><?php echo SERENDIPITY_AUTHORING_SUITE . ' ('. sprintf(USER_SELF_INFO, $serendipity['serendipityUser'], $serendipity['serendipityUserlevel']) .')'; ?></h2>
+ <h2><?php echo SERENDIPITY_AUTHORING_SUITE . ((serendipity_userLoggedIn()) ? ' ('. sprintf(USER_SELF_INFO, $serendipity['serendipityUser'], $serendipity['serendipityUserlevel']) .')' : ''); ?></h2>
</div>
<table id="mainpane">
@@ -98,19 +98,19 @@
switch($serendipity['GET']['adminModule']) {
case 'entries':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_entries.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/entries.inc.php';
break;
case 'images':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_images.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/images.inc.php';
break;
case 'comments':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_comments.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/comments.inc.php';
break;
case 'category':
- include S9Y_INCLUDE_PATH . 'serendipity_admin_category.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/category.inc.php';
break;
case 'logout':
@@ -122,7 +122,7 @@
break;
default:
- include S9Y_INCLUDE_PATH . 'serendipity_entries_overview.inc.php';
+ include S9Y_INCLUDE_PATH . 'include/admin/overview.inc.php';
}
?>
</div>
--- serendipity_admin_entries.inc.php DELETED ---
--- serendipity_admin_images.inc.php DELETED ---
--- serendipity_functions.inc.php DELETED ---
--- htaccess.errordocs.tpl DELETED ---
--- serendipity_admin_upgrader.inc.php DELETED ---
--- serendipity_functions_config.inc.php DELETED ---
--- serendipity_db_mysqli.inc.php DELETED ---
--- serendipity_sidebar_items.php DELETED ---
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- comment.php 16 Oct 2004 09:09:46 -0000 1.51
+++ comment.php 19 Nov 2004 11:04:58 -0000 1.52
@@ -11,7 +11,6 @@
if (serendipity_isResponseClean($_SERVER['HTTP_REFERER'])) {
header('Location: '. $_SERVER['HTTP_REFERER']);
}
- die();
}
if (isset($serendipity['GET']['switch'], $serendipity['GET']['entry'])) {
@@ -131,7 +130,7 @@
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $id . "'";
$ca = serendipity_db_query($query, true);
- serendipity_printComments(serendipity_fetchComments($id), (isset($ca['allow_comments']) ? $ca['allow_comments'] : true));
+ serendipity_printComments(serendipity_fetchComments($id));
if ($serendipity['POST']['preview']) {
serendipity_printComments(
@@ -143,9 +142,7 @@
'url' => $serendipity['POST']['url'],
'timestamp' => time()
)
- ),
- false,
- false
+ )
);
}
|