Allow *single* dots in page names

This commit is contained in:
Starbeamrainbowlabs 2015-10-22 08:54:59 +01:00
parent 35a1161be4
commit 093960133b
4 changed files with 11 additions and 3 deletions

View File

@ -497,7 +497,9 @@ function check_subpage_parents($pagename)
*/
function makepathsafe($string)
{
return preg_replace("/[^0-9a-zA-Z\_\-\ \/]/i", "", $string);
$string = preg_replace("/[^0-9a-zA-Z\_\-\ \/\.]/i", "", $string);
$string = preg_replace("/\.+/", ".", $string);
return $string;
}
/*
@ -1345,6 +1347,8 @@ register_module([
// Save the pageindex
file_put_contents("pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
header("location: ?action=view&page=$new_filename");
break;
}
});

View File

@ -213,7 +213,9 @@ function check_subpage_parents($pagename)
*/
function makepathsafe($string)
{
return preg_replace("/[^0-9a-zA-Z\_\-\ \/]/i", "", $string);
$string = preg_replace("/[^0-9a-zA-Z\_\-\ \/\.]/i", "", $string);
$string = preg_replace("/\.+/", ".", $string);
return $string;
}
/*

View File

@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.",
"id": "feature-upload",
"lastupdate": 1445500053,
"lastupdate": 1445500347,
"optional": false
},
{

View File

@ -126,6 +126,8 @@ register_module([
// Save the pageindex
file_put_contents("pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
header("location: ?action=view&page=$new_filename");
break;
}
});