Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30835
Modified Files:
Tag: branch-0-5
NEWS comment.php serendipity_admin_installer.inc.php
serendipity_config_local.tpl
Log Message:
MFH.
If nobody disagrees, I'll release 0.5 this (middle-european) evening.
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.54
retrieving revision 1.54.2.1
diff -u -d -r1.54 -r1.54.2.1
--- NEWS 31 Jan 2004 15:41:13 -0000 1.54
+++ NEWS 3 Feb 2004 10:34:09 -0000 1.54.2.1
@@ -2,6 +2,7 @@
Version 0.5 (January 31, 2004)
------------------------------------
+ * Redirection after a comment has been added to prevent users refreshing a page and double-submitting. (garvinhicking)
* Fixed RSS feed to only show comments when they are associated with an entry_id (garvinhicking)
* Fixed page counter to count pages depending on the entries per page, and not hardcoded 15 entries (garvinhicking)
* Atom 0.3 feed supported (with xml-stylesheet display) (garvinhicking)
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- comment.php 23 Jan 2004 05:50:19 -0000 1.27
+++ comment.php 3 Feb 2004 10:34:10 -0000 1.27.2.1
@@ -52,24 +52,32 @@
}
} else {
$id = $serendipity['GET']['entry_id'];
+ $html_header = '';
if ($serendipity['XHTML11']) {
- echo '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n";
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<?php
+ $html_header .= '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n";
+ $html_header .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . "\n";
}
-?>
-<html<?php echo ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : ''); ?>>
+
+ $html_header .= '<html' . ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : '') . '>
<head>
- <title><?php echo COMMENTS; ?></title>
- <link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity.css.php?mode=comments" />
+ <title>' . COMMENTS . '</title>
+ <link rel="stylesheet" type="text/css" href="' . $serendipity['serendipityHTTPPath'] . 'serendipity.css.php?mode=comments" />
</head>
<body>
+';
+ if (isset($_GET['success']) && $_GET['success'] == 'true') {
+ echo $html_header;
+ printf(
+ COMMENT_ADDED,
-<?php
- if (!isset($serendipity['POST']['comment'])) {
+ '<a href="' . $_GET['url'] . '">',
+ '</a>',
+ '<a href="#" onclick="self.close()">',
+ '</a>'
+ );
+ } else if (!isset($serendipity['POST']['comment'])) {
+ echo $html_header;
if ($serendipity['GET']['type'] == 'trackbacks') {
$tbu = $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . $serendipity['GET']['entry_id'];
$query = 'SELECT title FROM ' . $serendipity['dbPrefix'] . 'entries WHERE id = ' . $serendipity['GET']['entry_id'];
@@ -115,15 +123,10 @@
$comment['subscribe'] = $serendipity['POST']['subscribe'];
if ( !empty($comment['comment']) ) {
if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) {
- printf(
- COMMENT_ADDED,
-
- '<a href="' . $_SERVER['HTTP_REFERER'] . '">',
- '</a>',
- '<a href="#" onclick="self.close()">',
- '</a>'
- );
+ header('Location: ' . $serendipity['baseURL'] . 'comment.php?success=true&url=' . urlencode($_SERVER['HTTP_REFERER']));
+ exit;
} else {
+ echo $html_header;
printf(
COMMENT_NOT_ADDED,
@@ -134,6 +137,7 @@
);
}
} else {
+ echo $html_header;
printf(
EMPTY_COMMENT,
Index: serendipity_admin_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_installer.inc.php,v
retrieving revision 1.50
retrieving revision 1.50.2.1
diff -u -d -r1.50 -r1.50.2.1
--- serendipity_admin_installer.inc.php 21 Jan 2004 18:28:25 -0000 1.50
+++ serendipity_admin_installer.inc.php 3 Feb 2004 10:34:10 -0000 1.50.2.1
@@ -100,6 +100,12 @@
}
function serendipity_guessInput($type, $name, $value='', $default='') {
+global $serendipity;
+
+ if ($name == 'rewrite' && $default == $value && isset($serendipity['rewrite_default']) && $serendipity['rewrite_default'] != '') {
+ $value = $serendipity['rewrite_default'];
+ }
+
switch ($type) {
case 'bool' :
$value = serendipity_get_bool($value);
@@ -118,7 +124,7 @@
for ($x=0; $x<sizeof($res[1]); $x++) {
printf('<option value="%s"%s>%s</option>'. "\n",
$res[1][$x],
- (($res[1][$x] == $value) ? ' SELECTED' : ''),
+ (($res[1][$x] == $value) ? ' selected="selected"' : ''),
$res[2][$x]);
}
echo '</select>';
@@ -131,6 +137,49 @@
function serendipity_printConfigTemplate($t, $from = false) {
global $serendipity;
+
+ // If not yet installed, do some magic:
+ $abort = false;
+ if (IS_installed !== true) {
+ $old_htaccess = @file_get_contents('./.htaccess');
+ $fp = @fopen('./.htaccess', 'w');
+ $serendipity_root = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
+
+ if (!$fp) {
+ printf(HTACCESS_ERROR,
+ '<b>chmod go+rwx ' . getcwd() . '/</b>'
+ );
+ $abort = true;
+ } else {
+ fwrite($fp, 'ErrorDocument 404 ' . $serendipity_root . 'index.php');
+ fclose($fp);
+
+ // Do a request on a nonexistant file to see, if our htaccess allows ErrorDocument
+ $sock = fsockopen($_SERVER['HTTP_HOST'], 80, $errorno, $errorstring, 10);
+ fputs($sock, "GET {$_SERVER['REQUEST_URI']}nonexistant HTTP/1.0\n\n");
+ $response = '';
+ while (!feof($sock) && strlen($response) < 4096) {
+ $response .= fgets($sock, 400);
+ }
+ fclose($sock);
+
+ if (preg_match('@^HTTP/\d\.\d 200@', $response)) {
+ $serendipity['rewrite_default'] = 'errordocs';
+ } else {
+ $serendipity['rewrite_default'] = 'none';
+ }
+
+ if ($old_htacces != '') {
+ $fp = @fopen('./.htaccess', 'w');
+ fwrite($fp, $old_htaccess);
+ fclose($fp);
+ } else {
+ unlink('./.htaccess');
+ }
+ }
+ }
+
+ if ($abort === false) {
?>
<script type="text/javascript" language="JavaScript">
function showConfig(id) {
@@ -174,9 +223,9 @@
<a style="border:0; text-decoration: none" href="#" onclick="showConfigAll(<?php echo count($t['categories']); ?>)" title="<?php echo TOGGLE_ALL; ?>"><img src="pixel/plus.png" id="optionall" alt="+/-" border="0" /> <?php echo TOGGLE_ALL; ?></a></a><br />
</div>
<?php
- $el_count = 0;
- foreach ($t['categories'] as $key => $value) {
- $el_count++;
+ $el_count = 0;
+ foreach ($t['categories'] as $key => $value) {
+ $el_count++;
?>
<table width="100%" cellspacing="2">
<tr>
@@ -195,16 +244,16 @@
<?php
- for ($x=0; $x<count($value); $x++) {
- /* If we have a valuelist, then use the value from there */
- if (@is_array($from)) {
- $value[$x]['value'] = $from[$value[$x]['name']];
- }
-
- /* If the value is never assigned in the valuelist, then use our default value */
- if (!isset($from[$value[$x]['name']])) {
- $value[$x]['value'] = $value[$x]['default'];
- }
+ for ($x=0; $x<count($value); $x++) {
+ /* If we have a valuelist, then use the value from there */
+ if (@is_array($from)) {
+ $value[$x]['value'] = $from[$value[$x]['name']];
+ }
+
+ /* If the value is never assigned in the valuelist, then use our default value */
+ if (!isset($from[$value[$x]['name']])) {
+ $value[$x]['value'] = $value[$x]['default'];
+ }
?>
<tr>
<td style="border-bottom: 1px #000000 solid" align="left" valign="top" width="75%">
@@ -217,19 +266,20 @@
</td>
</tr>
<?php
- }
+ }
?>
</table><br /><br />
</td>
</tr>
</table>
<?php
- }
+ }
?>
<input type="submit" value="<?php echo CHECK_N_SAVE; ?>" />
</div>
</form>
<?php
+ }
}
function serendipity_parse_sql_tables($filename) {
@@ -276,14 +326,14 @@
}
elseif ( !is_writable($_POST['serendipityPath'] . $_POST['uploadPath']) ) {
$errs[] = sprintf(DIRECTORY_WRITE_ERROR, $_POST['serendipityPath'] . $_POST['uploadPath']);
- $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod g+rws', $_POST['serendipityPath'] . $_POST['uploadPath']);
+ $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod go+rws', $_POST['serendipityPath'] . $_POST['uploadPath']);
}
// Attempt to create the archives directory
if ( !is_dir($_POST['serendipityPath'] . 'archives') && @mkdir($_POST['serendipityPath'] . 'archives', $umask) !== true ) {
$errs[] = sprintf(DIRECTORY_CREATE_ERROR, $_POST['serendipityPath'] . 'archives');
$errs[] = sprintf(DIRECTORY_RUN_CMD , 'mkdir' , $_POST['serendipityPath'] . 'archives');
- $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod g+rwx', $_POST['serendipityPath'] . 'archives');
+ $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod go+rwx', $_POST['serendipityPath'] . 'archives');
}
// plugins directory now part of basic CVS
Index: serendipity_config_local.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config_local.tpl,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -d -r1.28 -r1.28.2.1
--- serendipity_config_local.tpl 29 Jan 2004 09:22:56 -0000 1.28
+++ serendipity_config_local.tpl 3 Feb 2004 10:34:10 -0000 1.28.2.1
@@ -38,7 +38,7 @@
$serendipity['embed'] = '{Is serendipity embedded?|embed|bool|0}'; // If you want to embed serendipity within a regular page, set to true to discard any headers and just print the contents. You can make use of the indexFile option to use a wrapper class where you put your normal webpage headers. See the INSTALL file for more information!
$serendipity['track_exits'] = '{Track exit URLs|track_exits|bool|1}'; // Do you want to track exit targets?
$serendipity['blockReferer'] = '{Blocked Referers|blockReferer|string|;}'; // Are there any special hosts you want not to show up in the referers list? Separate the list of hostnames with ';' and note that the host is blocked by substring matches!
-$serendipity['rewrite'] = '{URL Rewriting|rewrite|list|none=>Disable URL Rewriting,errordocs=>Use Apache errorhandling,rewrite=>Use Apache mod_rewrite}'; // Select which rules you wish to use when generating URLs. Enabling rewrite rules will make petty URLs for your blog. If you don't know what this is, then you don't need it
+$serendipity['rewrite'] = '{URL Rewriting|rewrite|list|none=>Disable URL Rewriting,errordocs=>Use Apache errorhandling,rewrite=>Use Apache mod_rewrite}'; // Select which rules you wish to use when generating URLs. Enabling rewrite rules will make pretty URLs for your blog and make it better indexable for spiders like google. The webserver needs to support either mod_rewrite or "AllowOverride All" for your serendipity dir. The default setting is auto-detected.
// Imageconversion Settings
# Enter general information about how serendipity should handle Images
|