Fixed: $paths->page_id not set when the page doesn't exist; finally fixed garbled page names for IP addresses
--- a/ajax.php Tue Dec 18 23:47:33 2007 -0500
+++ b/ajax.php Wed Dec 19 17:15:48 2007 -0500
@@ -104,6 +104,10 @@
{
echo $src;
}
+ else if ( $src !== false )
+ {
+ echo '';
+ }
else
{
echo 'err_access_denied';
--- a/includes/functions.php Tue Dec 18 23:47:33 2007 -0500
+++ b/includes/functions.php Wed Dec 19 17:15:48 2007 -0500
@@ -2418,6 +2418,20 @@
function sanitize_page_id($page_id)
{
+ global $db, $session, $paths, $template, $plugins; // Common objects
+
+ if ( isset($paths->nslist['User']) )
+ {
+ if ( preg_match('/^' . preg_quote($paths->nslist['User']) . '/', $page_id) )
+ {
+ $ip = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $page_id);
+ if ( is_valid_ip($ip) )
+ {
+ return $page_id;
+ }
+ }
+ }
+
// Remove character escapes
$page_id = dirtify_page_id($page_id);
@@ -2448,7 +2462,7 @@
else
$page_id_cleaned .= $pid_dirty[$id];
}
-
+
// global $mime_types;
// $exts = array_keys($mime_types);
@@ -2472,17 +2486,9 @@
$page_id = str_replace(' ', '_', $page_id);
// Exception for userpages for IP addresses
- if ( isset($paths->nslist['User']) )
+ if ( is_valid_ip($page_id) )
{
- if ( preg_match('/^' . preg_quote($paths->nslist['User']) . '/', $page_id) )
- {
- $ip = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $page_id);
- if ( is_valid_ip($ip) )
- {
- die('valid IP');
- return $page_id;
- }
- }
+ return $page_id;
}
preg_match_all('/\.[A-Fa-f0-9][A-Fa-f0-9]/', $page_id, $matches);
@@ -2495,7 +2501,7 @@
$char = chr($char);
$page_id = str_replace($matches[0][$id], $char, $page_id);
}
-
+
return $page_id;
}
--- a/includes/pageprocess.php Tue Dec 18 23:47:33 2007 -0500
+++ b/includes/pageprocess.php Wed Dec 19 17:15:48 2007 -0500
@@ -330,6 +330,10 @@
{
return false;
}
+ if ( !$this->page_exists )
+ {
+ return '';
+ }
return $this->fetch_text();
}
--- a/includes/paths.php Tue Dec 18 23:47:33 2007 -0500
+++ b/includes/paths.php Wed Dec 19 17:15:48 2007 -0500
@@ -342,7 +342,7 @@
$pid_cleaned = sanitize_page_id($this->page);
if ( $pid_cleaned != $this->page )
{
- redirect($pid_cleaned, 'Sanitizer message', 'page id sanitized', 0);
+ redirect(makeUrl($pid_cleaned), 'Sanitizer message', 'page id sanitized', 0);
}
if ( !is_array($this->cpage) )
@@ -376,6 +376,7 @@
}
}
$this->namespace = $this->cpage['namespace'];
+ $this->page_id =& $this->cpage['urlname_nons'];
if($this->namespace=='System')
{
@@ -1009,5 +1010,5 @@
}
}
-
+
?>