Fix some permalink situations
This commit is contained in:
@ -3,6 +3,10 @@
|
||||
Version 1.1-beta2 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Change permalinks to allow "%" in URLS. Fix templatedropdown
|
||||
plugin to remove double "//". Fix bad htmlspecialchars of the
|
||||
RDF ident link.
|
||||
|
||||
* Allow to apply current permissions of a directory to all sub-
|
||||
directories (Matthew Groeninger)
|
||||
|
||||
|
@ -953,9 +953,10 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
|
||||
$entry['html_title']= $entry['title'];
|
||||
$entry['title'] = htmlspecialchars($entry['title']);
|
||||
|
||||
$entry['title_rdf'] = preg_replace('@-{2,}@', '-', $entry['title']);
|
||||
$entry['title_rdf'] = preg_replace('@-{2,}@', '-', $entry['html_title']);
|
||||
$entry['rdf_ident'] = serendipity_archiveURL($entry['id'], $entry['title_rdf'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
|
||||
$entry['link_rdf'] = serendipity_rewriteURL(PATH_FEEDS . '/ei_'. $entry['id'] .'.rdf');
|
||||
$entry['title_rdf'] = htmlspecialchars($entry['title_rdf']);
|
||||
|
||||
$entry['link_allow_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=enable&serendipity[entry]=' . $entry['id'];
|
||||
$entry['link_deny_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=disable&serendipity[entry]=' . $entry['id'];
|
||||
|
@ -247,10 +247,11 @@ function serendipity_initPermalinks() {
|
||||
* If you add new patterns, remember to add the new rules to the *.tpl files and
|
||||
* function serendipity_installFiles().
|
||||
*/
|
||||
@define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-');
|
||||
@define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
|
||||
@define('PAT_FEED', '@/(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)@');
|
||||
@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
|
||||
@define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-%');
|
||||
@define('PAT_FILENAME_MATCH', '[' . PAT_FILENAME . ']+');
|
||||
@define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
|
||||
@define('PAT_FEED', '@/(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)@');
|
||||
@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -558,13 +559,13 @@ function serendipity_makePermalink($format, $data, $type = 'entry') {
|
||||
*/
|
||||
function serendipity_makePermalinkRegex($format, $type = 'entry') {
|
||||
static $entryKeys = array('%id%', '%title%', '%day%', '%month%', '%year%');
|
||||
static $entryRegexValues = array('([0-9]+)', '[0-9a-z\.\_!;,\+\-]+', '[0-9]{1,2}', '[0-9]{1,2}', '[0-9]{4}');
|
||||
static $entryRegexValues = array('([0-9]+)', PAT_FILENAME_MATCH, '[0-9]{1,2}', '[0-9]{1,2}', '[0-9]{4}');
|
||||
|
||||
static $authorKeys = array('%id%', '%username%', '%realname%', '%email%');
|
||||
static $authorRegexValues = array('([0-9]+)', '[0-9a-z\.\_!;,\+\-]+', '[0-9a-z\.\_!;,\+\-]+', '[0-9a-z\.\_!;,\+\-]+');
|
||||
static $authorRegexValues = array('([0-9]+)', PAT_FILENAME_MATCH, PAT_FILENAME_MATCH, PAT_FILENAME_MATCH);
|
||||
|
||||
static $categoryKeys = array('%id%', '%name%', '%description%');
|
||||
static $categoryRegexValues = array('([0-9;]+)', '[0-9a-z\.\_!;,\+\-]+', '[0-9a-z\.\_!;,\+\-]+');
|
||||
static $categoryRegexValues = array('([0-9;]+)', PAT_FILENAME_MATCH, PAT_FILENAME_MATCH);
|
||||
|
||||
switch($type) {
|
||||
case 'entry':
|
||||
@ -692,7 +693,7 @@ function serendipity_archiveDateUrl($range, $summary=false, $key='baseURL') {
|
||||
* @access public
|
||||
* @return string the current URL
|
||||
*/
|
||||
function serendipity_currentURL() {
|
||||
function serendipity_currentURL($strict = false) {
|
||||
global $serendipity;
|
||||
|
||||
// All that URL getting humpty-dumpty is necessary to allow a user to change the template in the
|
||||
@ -704,7 +705,7 @@ function serendipity_currentURL() {
|
||||
if (!empty($uri['query'])) {
|
||||
$qst = '&' . str_replace('&', '&', $uri['query']);
|
||||
}
|
||||
$uri['path'] = preg_replace('@^' . preg_quote($serendipity['serendipityHTTPPath']) . '@i', '', $uri['path']);
|
||||
$uri['path'] = preg_replace('@^' . preg_quote($serendipity['serendipityHTTPPath']) . '@i', ($strict ? '/' : ''), $uri['path']);
|
||||
$uri['path'] = preg_replace('@^(&)?' . preg_quote($serendipity['indexFile']) . '(&)@i', '', $uri['path']);
|
||||
$url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . $uri['path'] . $qst;
|
||||
$url = str_replace(
|
||||
@ -727,6 +728,10 @@ function serendipity_currentURL() {
|
||||
|
||||
$url); // Kill possible looped repitions and bad characters which could occur
|
||||
|
||||
if ($strict) {
|
||||
$url = preg_replace('@(//+), '/', $url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class serendipity_plugin_templatedropdown extends serendipity_plugin {
|
||||
|
||||
$title = $this->get_config('title', $this->title);
|
||||
|
||||
$url = serendipity_currentURL();
|
||||
$url = serendipity_currentURL(true);
|
||||
|
||||
echo '<form id="theme_chooser" action="' . $url . '" method="post">';
|
||||
echo '<select name="user_template" onchange="document.getElementById(\'theme_chooser\').submit();">';
|
||||
|
Reference in New Issue
Block a user