×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    MediaWiki/valid user

    (Redirected from Mediawiki/valid user)

    <HighlightSyntax> /**

            * Is the input a valid username?
            *
            * Checks if the input is a valid username, we don't want an empty string,
            * an IP address, anything that containins slashes (would mess up subpages),
            * is longer than the maximum allowed username size or doesn't begin with
            * a capital letter.
            *
            * @param string $name
            * @return bool
            * @static
            */
           static function isValidUserName( $name ) {
                   global $wgContLang, $wgMaxNameChars;
    
                   if ( $name == 
                   || User::isIP( $name )
                   || strpos( $name, '/' ) !== false
                   || strlen( $name ) > $wgMaxNameChars
                   || $name != $wgContLang->ucfirst( $name ) )
                           return false;
    
                   // Ensure that the name can't be misresolved as a different title,
                   // such as with extra namespace keys at the start.
                   $parsed = Title::newFromText( $name );
                   if( is_null( $parsed )
                           || $parsed->getNamespace()
                           || strcmp( $name, $parsed->getPrefixedText() ) )
                           return false;
    
                   // 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;
           }
    


    </HighlightSyntax>

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.