From d1521b48e581dc42955ce9b5a685bd6747f76917 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 11 Jan 2003 20:07:42 +0000 Subject: - Rewrite old-style URLs. Based on patch by Gerhard. --- includes/common.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'includes/common.inc') 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=[&cid=]' + $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, "") == $text) { -- cgit v1.2.3