Skip to content

Commit

Permalink
MDL-52285 auth: use __construct() for constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Dec 10, 2015
1 parent 32fada5 commit 4a89e83
Show file tree
Hide file tree
Showing 22 changed files with 181 additions and 35 deletions.
12 changes: 11 additions & 1 deletion auth/cas/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@ class auth_plugin_cas extends auth_plugin_ldap {
/**
* Constructor.
*/
function auth_plugin_cas() {
public function __construct() {
$this->authtype = 'cas';
$this->roleauth = 'auth_cas';
$this->errorlogtag = '[AUTH CAS] ';
$this->init_plugin($this->authtype);
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_cas() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

function prevent_local_passwords() {
return true;
}
Expand Down
12 changes: 11 additions & 1 deletion auth/email/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,21 @@ class auth_plugin_email extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_email() {
public function __construct() {
$this->authtype = 'email';
$this->config = get_config('auth/email');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_email() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/fc/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@ class auth_plugin_fc extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_fc() {
public function __construct() {
$this->authtype = 'fc';
$this->config = get_config('auth/fc');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_fc() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
2 changes: 1 addition & 1 deletion auth/fc/fcFPP.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class fcFPP
var $_debug = FALSE; // set to true to see some debug info

// class constructor
function fcFPP($host="localhost", $port="3333")
public function __construct($host="localhost", $port="3333")
{
$this->_hostname = $host;
$this->_port = $port;
Expand Down
12 changes: 11 additions & 1 deletion auth/imap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ class auth_plugin_imap extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_imap() {
public function __construct() {
$this->authtype = 'imap';
$this->config = get_config('auth/imap');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_imap() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,23 @@ function init_plugin($authtype) {
/**
* Constructor with initialisation.
*/
function auth_plugin_ldap() {
public function __construct() {
$this->authtype = 'ldap';
$this->roleauth = 'auth_ldap';
$this->errorlogtag = '[AUTH LDAP] ';
$this->init_plugin($this->authtype);
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_ldap() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/manual/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ class auth_plugin_manual extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_manual() {
public function __construct() {
$this->authtype = 'manual';
$config = get_config(self::COMPONENT_NAME);
$legacyconfig = get_config(self::LEGACY_COMPONENT_NAME);
$this->config = (object)array_merge((array)$legacyconfig, (array)$config);
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_manual() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist. (Non-mnet accounts only!)
Expand Down
12 changes: 11 additions & 1 deletion auth/mnet/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@ class auth_plugin_mnet extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_mnet() {
public function __construct() {
$this->authtype = 'mnet';
$this->config = get_config('auth_mnet');
$this->mnet = get_mnet_environment();
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_mnet() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* This function is normally used to determine if the username and password
* are correct for local logins. Always returns false, as local users do not
Expand Down
12 changes: 11 additions & 1 deletion auth/nntp/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ class auth_plugin_nntp extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_nntp() {
public function __construct() {
$this->authtype = 'nntp';
$this->config = get_config('auth/nntp');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_nntp() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/nologin/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@ class auth_plugin_nologin extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_nologin() {
public function __construct() {
$this->authtype = 'nologin';
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_nologin() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Do not allow any login.
*
Expand Down
12 changes: 11 additions & 1 deletion auth/none/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,21 @@ class auth_plugin_none extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_none() {
public function __construct() {
$this->authtype = 'none';
$this->config = get_config('auth/none');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_none() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work or don't exist and false
* if the user exists and the password is wrong.
Expand Down
12 changes: 11 additions & 1 deletion auth/pam/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,22 @@ class auth_plugin_pam extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_pam() {
public function __construct() {
$this->authtype = 'pam';
$this->config = get_config('auth/pam');
$this->errormessage = '';
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_pam() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/pop3/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ class auth_plugin_pop3 extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_pop3() {
public function __construct() {
$this->authtype = 'pop3';
$this->config = get_config('auth/pop3');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_pop3() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/radius/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@ class auth_plugin_radius extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_radius() {
public function __construct() {
$this->authtype = 'radius';
$this->config = get_config('auth/radius');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_radius() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/shibboleth/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@ class auth_plugin_shibboleth extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_shibboleth() {
public function __construct() {
$this->authtype = 'shibboleth';
$this->config = get_config('auth/shibboleth');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_shibboleth() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 11 additions & 1 deletion auth/webservice/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ class auth_plugin_webservice extends auth_plugin_base {
/**
* Constructor.
*/
function auth_plugin_webservice() {
public function __construct() {
$this->authtype = 'webservice';
$this->config = get_config('auth/webservice');
}

/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function auth_plugin_webservice() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}

/**
* Returns true if the username and password work and false if they are
* wrong or don't exist.
Expand Down
12 changes: 6 additions & 6 deletions lib/pear/Crypt/CHAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class Crypt_CHAP extends PEAR
* Generates a random challenge
* @return void
*/
function Crypt_CHAP()
public function __construct()
{
$this->PEAR();
parent::__construct();
$this->generateChallenge();
}

Expand Down Expand Up @@ -167,9 +167,9 @@ class Crypt_CHAP_MSv1 extends Crypt_CHAP
* Loads the hash extension
* @return void
*/
function Crypt_CHAP_MSv1()
public function __construct()
{
$this->Crypt_CHAP();
parent::__construct();
$this->loadExtension('hash');
}

Expand Down Expand Up @@ -415,9 +415,9 @@ class Crypt_CHAP_MSv2 extends Crypt_CHAP_MSv1
* Generates the 16 Bytes peer and authentication challenge
* @return void
*/
function Crypt_CHAP_MSv2()
public function __construct()
{
$this->Crypt_CHAP_MSv1();
parent::__construct();
$this->generateChallenge('peerChallenge', 16);
$this->generateChallenge('authChallenge', 16);
}
Expand Down
Loading

0 comments on commit 4a89e83

Please sign in to comment.