# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
-function serendipity_makeFilename($str) {
+function serendipity_makeFilename($str, $stripDots = false) {
static $from = array(
' ',
// Nuke chars not allowed in our URI
$str = preg_replace('#[^' . PAT_FILENAME . ']#i', '', $str);
+ // Check if dots are allowed
+ if ($stripDots) {
+ $str = str_replace('.', '', $str);
+ }
+
// Remove consecutive separators
$str = preg_replace('#'. $to[0] .'{2,}#s', $to[0], $str);
$replacements =
array(
(int)$data['authorid'],
- serendipity_makeFilename($data['username']),
- serendipity_makeFilename($data['realname']),
- serendipity_makeFilename($data['email'])
+ serendipity_makeFilename($data['username'], true),
+ serendipity_makeFilename($data['realname'], true),
+ serendipity_makeFilename($data['email'], true)
);
return str_replace($authorKeys, $replacements, $format);
break;
$replacements =
array(
(int)$data['categoryid'],
- serendipity_makeFilename($data['category_name']),
- serendipity_makeFilename($data['category_description'])
+ serendipity_makeFilename($data['category_name'], true),
+ serendipity_makeFilename($data['category_description'], true)
);
return str_replace($categoryKeys, $replacements, $format);
break;
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);
+ 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') {