diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-01-11 20:07:42 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-01-11 20:07:42 +0000 |
commit | d1521b48e581dc42955ce9b5a685bd6747f76917 (patch) | |
tree | 739715d2894dcf3da9a450ad58d8871175a05886 | |
parent | 0d384c8ead658c95b32233f87d9b2308f3abf26b (diff) | |
download | brdo-d1521b48e581dc42955ce9b5a685bd6747f76917.tar.gz brdo-d1521b48e581dc42955ce9b5a685bd6747f76917.tar.bz2 |
- Rewrite old-style URLs. Based on patch by Gerhard.
-rw-r--r-- | includes/common.inc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index e67843333..0d828b73d 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -471,8 +471,28 @@ function filter($text) { return $text; } +function rewrite_old_urls($text) { + + /* + ** This is a *temporary* filter to rewrite old-style URLs to new-style + ** URLs (clean URLs). Currently, URLs are being rewritten dynamically + ** (ie. "on output"), however When these rewrite rules have been tested + ** enough, we will use them to permanently rewrite the links in node + ** and comment bodies. + */ + + // rewrite 'node.php?id=<number>[&cid=<number>]' + $text = eregi_replace("(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "?q=\\1/view/\\2/\\4", $text); + + return $text; +} + function check_output($text) { if (isset($text)) { + + // temporary: for development purpose + $text = rewrite_old_urls($text); + $text = stripslashes($text); if (strip_tags($text, "<a><i><b><u><tt><code><cite><strong><img>") == $text) { |