$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'];
* 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;
}
*/
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':
* @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
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(
$url); // Kill possible looped repitions and bad characters which could occur
+ if ($strict) {
+ $url = preg_replace('@(//+), '/', $url);
+ }
+
return $url;
}
$propbag->add('description', PLUGIN_TEMPLATEDROPDOWN_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Evan Nemerson');
- $propbag->add('version', '1.0');
+ $propbag->add('version', '1.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
$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();">';
foreach (serendipity_fetchTemplates() as $template) {
$templateInfo = serendipity_fetchTemplateInfo($template);
- echo '<option value="' . $template . '" ' . (serendipity_get_config_var('template', 'default') == $template ? 'selected="selected"' : '') . '>' . $templateInfo['name'] . '</option>';
+ echo '<option value="' . $template . '" ' . (serendipity_get_config_var('template', 'default') == $template ? 'selected="selected"' : '') . '>' . substr($templateInfo['name'], 0, 25) . '</option>';
}
echo '</select>';