I found a way to use Serendipity having only relative link paths in the source code. How about incorporating this patch into the next version? To me, this would be a great help, since relative paths are required for a service that uses my serendipity application. I tested this patch with Serendipity 0.8.2.
The first thing you have to do is to delete the 'Relative path' $serendipity['baseURL'] and the 'URL to blog' $serendipity['serendipityHTTPPath'] in the Serendipity Administration Suite under Configuration --> Paths. Simply delete all characters in the input fields and click 'Check & save'.
All right, this is not everything. The first problem is the patch in line 224 in serendipity_config.inc.php which says:
Code: Select all
// Try to fix some path settings. It seems common users have this setting wrong
// when s9y is installed into the root directory, especially 0.7.1 upgrade users.
if (empty($serendipity['serendipityHTTPPath'])) {
$serendipity['serendipityHTTPPath'] = '/';
}
Code: Select all
// Try to fix some path settings. It seems common users have this setting wrong
// when s9y is installed into the root directory, especially 0.7.1 upgrade users.
/*if (empty($serendipity['serendipityHTTPPath'])) {
$serendipity['serendipityHTTPPath'] = '/';
}*/
Code: Select all
function serendipity_getUriArguments($uri, $wildcard = false) {
global $serendipity;
/* Explode the path into sections, to later be able to check for arguments and add our own */
preg_match('/^'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?\/)?(' . ($wildcard ? '.+' : '[a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
if (strlen($_res[2]) != 0) {
$args = explode('/', $_res[2]);
if ($args[0] == 'index') {
unset($args[0]);
}
return $args;
} else {
return array();
}
}
Code: Select all
function serendipity_getUriArguments($uri, $wildcard = false) {
global $serendipity;
/* Explode the path into sections, to later be able to check for arguments and add our own */
preg_match('/'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?)\/?(' . ($wildcard ? '.+' : '[a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
if (strlen($_res[2]) != 0) {
$args = explode('/', $_res[2]);
return $args;
} else {
return array();
}
}
Still, we are not finished yet. There is still an error message raised by serendipity_track_referrer() which can be found in /include/functions.inc.php as well. Right at the beginning, the function checks, wether the client comes from this website or from another one:
Code: Select all
if (stristr($_SERVER['HTTP_REFERER'], $serendipity['baseURL']) !== false) {
return;
}
Code: Select all
$url = parse_url($_SERVER['REQUEST_URI']);
if (stristr($_SERVER['HTTP_REFERER'], $url['path']) !== false) {
return;
}