Skip to content

Commit c85797b

Browse files
committed
minor clean-ups
- use single quotes for strings that do not require interpolation - whitespace clean-up - lines <80 characters
1 parent e5e3a21 commit c85797b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

addTeamspaceCCIDUser.php

+16-13
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,41 @@
2323
class AddCCIDUser extends Maintenance {
2424

2525
public function __construct() {
26-
parent::__construct();
27-
$this->mDescription = "Create a new CCID user account for Teamspace.";
26+
parent::__construct();
27+
$this->mDescription = 'Create a new CCID user account for Teamspace.';
2828

29-
#$this->addArg( "global", "CCID global identifier of new user" );
30-
$this->addArg( "email", "CCID email of new user (will be used as user name as well)" );
31-
$this->addArg( "name", "Real name of user" );
29+
$this->addArg(
30+
'email',
31+
'CCID email of new user (will be used as the username as well)'
32+
);
33+
$this->addArg( 'name', 'Real name of user' );
3234
}
3335

3436
public function execute() {
3537
global $CASAuth;
3638

3739
if (! isset( $CASAuth )) {
38-
$this->error('$CASAuth not set in LocalSettings.php', true);
40+
$this->error( '$CASAuth not set in LocalSettings.php', true );
3941
}
4042

41-
$name = $global = $this->getArg( 1 );
4243
$casuid = $email = $this->getArg( 0 );
44+
$name = $global = $this->getArg( 1 );
4345
$ccid_name = ucfirst ( $email );
4446

4547
$u = User::newFromName( $ccid_name );
4648
// Create a new account if the user does not exists
4749
if ($u->getID() != 0) {
48-
$this->error("User already exists", true);
50+
$this->error( 'User already exists', true );
4951
exit(1);
5052
} else {
51-
//$nickname = $attr['nickname'];
5253
// Create the user
5354
$u->addToDatabase();
54-
$u->setRealName($name);
55-
$u->setEmail($casuid);
55+
$u->setRealName( $name );
56+
$u->setEmail( $casuid );
5657
$u->confirmEmail();
57-
$u->setPassword( md5($casuid.$CASAuth["PwdSecret"]) ); //PwdSecret is used to salt the casuid, which is then used to create an md5 hash which becomes the password
58+
//PwdSecret is used to salt the casuid, which is then used to
59+
// create an md5 hash which becomes the password
60+
$u->setPassword( md5($casuid.$CASAuth['PwdSecret']) );
5861
$u->setToken();
5962
$u->saveSettings();
6063
// Update user count
@@ -64,5 +67,5 @@ public function execute() {
6467
}
6568
}
6669

67-
$maintClass = "AddCCIDUser";
70+
$maintClass = 'AddCCIDUser';
6871
require_once RUN_MAINTENANCE_IF_MAIN;

0 commit comments

Comments
 (0)