(bug 43184) bogus script path in Special:Version
[lhc/web/wiklou.git] / includes / AuthPlugin.php
index 0cb25b9..2e42439 100644 (file)
@@ -1,21 +1,27 @@
 <?php
-# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
-# http://www.mediawiki.org/
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# http://www.gnu.org/copyleft/gpl.html
+/**
+ * Authentication plugin interface
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * http://www.mediawiki.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
 
 /**
  * Authentication plugin interface. Instantiate a subclass of AuthPlugin
  * someone logs in who can be authenticated externally.
  */
 class AuthPlugin {
+
+       /**
+        * @var string
+        */
+       protected $domain;
+
        /**
         * Check whether there exists a user account with the given name.
         * The name will be normalized to MediaWiki's requirements, so
@@ -61,7 +73,7 @@ class AuthPlugin {
         * Modify options in the login template.
         *
         * @param $template UserLoginTemplate object.
-        * @param $type String 'signup' or 'login'.
+        * @param $type String 'signup' or 'login'. Added in 1.16.
         */
        public function modifyUITemplate( &$template, &$type ) {
                # Override this!
@@ -77,6 +89,19 @@ class AuthPlugin {
                $this->domain = $domain;
        }
 
+       /**
+        * Get the user's domain
+        *
+        * @return string
+        */
+       public function getDomain() {
+               if ( isset( $this->domain ) ) {
+                       return $this->domain;
+               } else {
+                       return 'invaliddomain';
+               }
+       }
+
        /**
         * Check to see if the specific domain is a valid domain.
         *
@@ -97,6 +122,7 @@ class AuthPlugin {
         * forget the & on your function declaration.
         *
         * @param $user User object
+        * @return bool
         */
        public function updateUser( &$user ) {
                # Override this and do something
@@ -125,6 +151,8 @@ class AuthPlugin {
         * and use the same keys. 'Realname' 'Emailaddress' and 'Nickname'
         * all reference this.
         *
+        * @param $prop string
+        *
         * @return Boolean
         */
        public function allowPropChange( $prop = '' ) {
@@ -148,6 +176,15 @@ class AuthPlugin {
                return true;
        }
 
+       /**
+        * Should MediaWiki store passwords in its local database?
+        *
+        * @return bool
+        */
+       public function allowSetLocalPassword() {
+               return true;
+       }
+
        /**
         * Set the given password in the authentication database.
         * As a special case, the password may be set to null to request
@@ -239,6 +276,8 @@ class AuthPlugin {
        /**
         * If you want to munge the case of an account name before the final
         * check, now is your chance.
+        * @param $username string
+        * @return string
         */
        public function getCanonicalName( $username ) {
                return $username;
@@ -248,10 +287,21 @@ class AuthPlugin {
         * Get an instance of a User object
         *
         * @param $user User
+        *
+        * @return AuthPluginUser
         */
        public function getUserInstance( User &$user ) {
                return new AuthPluginUser( $user );
        }
+
+       /**
+        * Get a list of domains (in HTMLForm options format) used.
+        *
+        * @return array
+        */
+       public function domainList() {
+               return array();
+       }
 }
 
 class AuthPluginUser {