Fixed user pages + the new .xx page URL format
authorDan
Mon, 02 Jul 2007 15:17:54 -0400
changeset 38 ed06961e54dd
parent 37 7267c2a67a93
child 39 c83ff194977a
Fixed user pages + the new .xx page URL format
includes/clientside/static/faders.js
includes/functions.php
plugins/SpecialPageFuncs.php
--- a/includes/clientside/static/faders.js	Sun Jul 01 17:12:42 2007 -0400
+++ b/includes/clientside/static/faders.js	Mon Jul 02 15:17:54 2007 -0400
@@ -128,13 +128,19 @@
   
   this.clickHandler = function() { messagebox_click(this, mb_current_obj); };
   
-  if(type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION || type & MB_ICONLOCK)
+  if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) )
   {
     mydiv.style.paddingLeft = '50px';
     mydiv.style.width = '360px';
     mydiv.style.backgroundRepeat = 'no-repeat';
     mydiv.style.backgroundPosition = '8px 8px';
   }
+  else if ( type & MB_ICONLOCK )
+  {
+    mydiv.style.paddingLeft = '50px';
+    mydiv.style.width = '360px';
+    mydiv.style.backgroundRepeat = 'no-repeat';
+  }
   
   if(type & MB_ICONINFORMATION)
   {
--- a/includes/functions.php	Sun Jul 01 17:12:42 2007 -0400
+++ b/includes/functions.php	Mon Jul 02 15:17:54 2007 -0400
@@ -2197,9 +2197,18 @@
 
 function dirtify_page_id($page_id)
 {
+  global $db, $session, $paths, $template, $plugins; // Common objects
   // First, replace spaces with underscores  
   $page_id = str_replace(' ', '_', $page_id);
   
+  // Exception for userpages for IP addresses
+  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;
+  }
+  
   preg_match_all('/\.[A-Fa-f0-9][A-Fa-f0-9]/', $page_id, $matches);
   
   foreach ( $matches[0] as $id => $char )
@@ -2269,6 +2278,24 @@
   return "{$str1}{$needle}{$str2}";
 }
 
+/**
+ * Tells if a given IP address is valid.
+ * @param string suspected IP address
+ * @return bool true if valid, false otherwise
+ */
+ 
+function is_valid_ip($ip)
+{
+  // These came from phpBB3.
+  $ipv4 = '(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])';
+  $ipv6 = '(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){5}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:))';
+  
+  if ( preg_match("/^{$ipv4}$/", $ip) || preg_match("/^{$ipv6}$/", $ip) )
+    return true;
+  else
+    return false;
+}
+
 //die('<pre>Original:  01010101010100101010100101010101011010'."\nProcessed: ".uncompress_bitfield(compress_bitfield('01010101010100101010100101010101011010')).'</pre>');
 
 ?>
--- a/plugins/SpecialPageFuncs.php	Sun Jul 01 17:12:42 2007 -0400
+++ b/plugins/SpecialPageFuncs.php	Mon Jul 02 15:17:54 2007 -0400
@@ -295,7 +295,7 @@
     <table border="0" cellspacing="1" cellpadding="4">
       <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
       <tr><td colspan="2" class="row3"><p>This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source
-      CMS that everyone can use. Enano is copyright &copy; 2006 Dan Fuhry. For legal information, along with a list of libraries that Enano
+      CMS that everyone can use. Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano
       uses, please see <a href="http://enanocms.org/Legal_information">Legal Information</a>.</p>
       <p>The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
          distributed, and used to create derivative works. For more information about Free Software, check out the