* Fix explicit s-maxage=0 on raw pages; should help with proxy issues in
[lhc/web/wiklou.git] / includes / User.php
index d1861ac..2024364 100644 (file)
@@ -210,8 +210,22 @@ class User {
                        || $parsed->getNamespace()
                        || strcmp( $name, $parsed->getPrefixedText() ) )
                        return false;
-               else
-                       return true;
+               
+               // Check an additional blacklist of troublemaker characters.
+               // Should these be merged into the title char list?
+               $unicodeBlacklist = '/[' .
+                       '\x{0080}-\x{009f}' . # iso-8859-1 control chars
+                       '\x{00a0}' .          # non-breaking space
+                       '\x{2000}-\x{200f}' . # various whitespace
+                       '\x{2028}-\x{202f}' . # breaks and control chars
+                       '\x{3000}' .          # ideographic space
+                       '\x{e000}-\x{f8ff}' . # private use
+                       ']/u';
+               if( preg_match( $unicodeBlacklist, $name ) ) {
+                       return false;
+               }
+               
+               return true;
        }
 
        /**
@@ -796,6 +810,23 @@ class User {
                return (bool)$this->mNewtalk;
        }
 
+       /**
+        * Return the talk page(s) this user has new messages on.
+        */
+       function getNewMessageLinks() {
+       global  $wgDBname;
+               $talks = array();
+               if (!wfRunHooks('UserRetrieveNewTalks', array(&$this, &$talks)))
+                       return $talks;
+
+               if (!$this->getNewtalk())
+                       return array();
+               $up = $this->getUserPage();
+               $utp = $up->getTalkPage();
+               return array(array("wiki" => $wgDBname, "link" => $utp->getLocalURL()));
+       }
+
+               
        /**
         * Perform a user_newtalk check on current slaves; if the memcached data
         * is funky we don't want newtalk state to get stuck on save, as that's
@@ -1210,8 +1241,11 @@ class User {
        function clearNotification( &$title ) {
                global $wgUser, $wgUseEnotif;
 
+
                if ($title->getNamespace() == NS_USER_TALK &&
                        $title->getText() == $this->getName() ) {
+                       if (!wfRunHooks('UserClearNewTalkNotification', array(&$this)))
+                               return;
                        $this->setNewtalk( false );
                }