Commit a7a323e7 authored by Dries's avatar Dries

- Made sure clean URLs are disabled by default.  Reported by Moshe.
parent 83f5d828
......@@ -483,23 +483,23 @@ function rewrite_old_urls($text) {
** and comment bodies.
*/
if (variable_get("clean_url", "1")) {
if (variable_get("clean_url", "0") == "0") {
// rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
$text = eregi_replace("(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\\1/view/\\2/\\4", $text);
$text = eregi_replace("(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "?q=\\1/view/\\2/\\4", $text);
// rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2/\\4/\\6" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2/\\4" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2/\\4/\\6" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2/\\4" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2" , $text);
}
else {
// rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
$text = eregi_replace("(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "?q=\\1/view/\\2/\\4", $text);
$text = eregi_replace("(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\\1/view/\\2/\\4", $text);
// rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2/\\4/\\6" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2/\\4" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "?q=\\2" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2/\\4/\\6" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2/\\4" , $text);
$text = ereg_replace("module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\\2" , $text);
}
return $text;
......@@ -783,39 +783,39 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $
function url($url = NULL, $query = NULL) {
global $base_url;
if (variable_get("clean_url", "1")) {
if (variable_get("clean_url", "0") == "0") {
if (isset($url)) {
if (isset($query)) {
return "$base_url/$url?$query";
return "?q=$url&amp;$query";
}
else {
return "$base_url/$url";
return "?q=$url";
}
}
else {
if (isset($query)) {
return "$base_url/?$query";
return "?$query";
}
else {
return "$base_url";
return "";
}
}
}
else {
if (isset($url)) {
if (isset($query)) {
return "?q=$url&amp;$query";
return "$base_url/$url?$query";
}
else {
return "?q=$url";
return "$base_url/$url";
}
}
else {
if (isset($query)) {
return "?$query";
return "$base_url/?$query";
}
else {
return "";
return "$base_url";
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment