@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author Zilvinas Vaira |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -class SendTokenByEmail extends AbstractInvokerCommand{ |
|
| 15 | +class SendTokenByEmail extends AbstractInvokerCommand { |
|
| 16 | 16 | |
| 17 | 17 | const COMMAND = "sendtokenbyemail"; |
| 18 | 18 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param string $commandToken |
| 40 | 40 | * @param SilverbulletContext $context |
| 41 | 41 | */ |
| 42 | - public function __construct($commandToken, $context){ |
|
| 42 | + public function __construct($commandToken, $context) { |
|
| 43 | 43 | parent::__construct($commandToken, $context); |
| 44 | 44 | $this->mail = OutsideComm::mailHandle(); |
| 45 | 45 | $this->detailsCommand = new GetTokenEmailDetails(GetTokenEmailDetails::COMMAND, $context); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @see \web\lib\admin\http\AbstractCommand::execute() |
| 53 | 53 | */ |
| 54 | 54 | public function execute() { |
| 55 | - if(isset($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) && isset($_POST[ValidateEmailAddress::PARAM_ADDRESS])){ |
|
| 55 | + if (isset($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) && isset($_POST[ValidateEmailAddress::PARAM_ADDRESS])) { |
|
| 56 | 56 | |
| 57 | 57 | $invitationToken = $this->parseString($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]); |
| 58 | 58 | $address = $this->parseString($_POST[ValidateEmailAddress::PARAM_ADDRESS]); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->mail->addStringAttachment($bytestream, "qr-code-invitation.png", "base64", "image/png"); |
| 65 | 65 | |
| 66 | 66 | $this->mail->addAddress($address); |
| 67 | - if($this->mail->send()) { |
|
| 67 | + if ($this->mail->send()) { |
|
| 68 | 68 | $this->storeInfoMessage(sprintf(_("Email message has been sent successfuly to '%s'!"), $address)); |
| 69 | 69 | } else { |
| 70 | 70 | $this->storeErrorMessage(sprintf(_("Email message could not be sent to '%s'. Mailer error: '%s'."), $address, $this->mail->ErrorInfo)); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * {@inheritDoc} |
| 16 | 16 | * @see \web\lib\admin\view\AbstractDialogBox::renderControls() |
| 17 | 17 | */ |
| 18 | - protected function renderControls(){ |
|
| 18 | + protected function renderControls() { |
|
| 19 | 19 | ?> |
| 20 | 20 | <div style="position: relative; padding-bottom: 10px; width: 450px;"> |
| 21 | 21 | <label>Enter user phone: +</label> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Zilvinas Vaira |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | -class RevokeInvitationCommand extends AbstractInvokerCommand{ |
|
| 11 | +class RevokeInvitationCommand extends AbstractInvokerCommand { |
|
| 12 | 12 | |
| 13 | 13 | const COMMAND = 'revokeinvitation'; |
| 14 | 14 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $commandToken |
| 24 | 24 | * @param SilverbulletContext $context |
| 25 | 25 | */ |
| 26 | - public function __construct($commandToken, $context){ |
|
| 26 | + public function __construct($commandToken, $context) { |
|
| 27 | 27 | parent::__construct($commandToken, $context); |
| 28 | 28 | $this->context = $context; |
| 29 | 29 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * {@inheritDoc} |
| 34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
| 35 | 35 | */ |
| 36 | - public function execute(){ |
|
| 36 | + public function execute() { |
|
| 37 | 37 | $invitationId = $this->parseInt($_POST[self::COMMAND]); |
| 38 | 38 | |
| 39 | 39 | $invitation = SilverbulletInvitation::prepare($invitationId); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Zilvinas Vaira |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | -class AddUsersCommand extends AbstractInvokerCommand{ |
|
| 11 | +class AddUsersCommand extends AbstractInvokerCommand { |
|
| 12 | 12 | |
| 13 | 13 | const COMMAND = 'newusers'; |
| 14 | 14 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $commandToken |
| 24 | 24 | * @param SilverbulletContext $context |
| 25 | 25 | */ |
| 26 | - public function __construct($commandToken, $context){ |
|
| 26 | + public function __construct($commandToken, $context) { |
|
| 27 | 27 | parent::__construct($commandToken, $context); |
| 28 | 28 | $this->context = $context; |
| 29 | 29 | } |
@@ -33,27 +33,27 @@ discard block |
||
| 33 | 33 | * {@inheritDoc} |
| 34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
| 35 | 35 | */ |
| 36 | - public function execute(){ |
|
| 36 | + public function execute() { |
|
| 37 | 37 | $parser = new CSVParser($_FILES[self::COMMAND], "\n", ','); |
| 38 | - if(!$parser->isValid()){ |
|
| 38 | + if (!$parser->isValid()) { |
|
| 39 | 39 | $this->storeErrorMessage(_('File either is empty or is not CSV file!')); |
| 40 | 40 | } |
| 41 | 41 | $userCount = 0; |
| 42 | 42 | $invitationsCount = 0; |
| 43 | - while($parser->hasMoreRows()){ |
|
| 43 | + while ($parser->hasMoreRows()) { |
|
| 44 | 44 | $row = $parser->nextRow(); |
| 45 | - if(isset($row[0]) && isset($row[1])){ |
|
| 45 | + if (isset($row[0]) && isset($row[1])) { |
|
| 46 | 46 | $user = $this->context->createUser($row[0], $row[1], $this); |
| 47 | 47 | $max = empty($row[2]) ? 1 : intval($row[2]); |
| 48 | - if(!empty($user->getIdentifier())){ |
|
| 48 | + if (!empty($user->getIdentifier())) { |
|
| 49 | 49 | $this->context->createInvitation($user, $this, $max); |
| 50 | 50 | $userCount++; |
| 51 | 51 | } |
| 52 | - }else{ |
|
| 52 | + } else { |
|
| 53 | 53 | $this->storeErrorMessage(sprintf(_('Username or expiry date missing for %s record!'), $userCount + 1)); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | - if($userCount>0){ |
|
| 56 | + if ($userCount > 0) { |
|
| 57 | 57 | $this->storeInfoMessage(sprintf(_('%s total users were imported and %s invitations created!'), $userCount, $invitationsCount)); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use web\lib\admin\domain\Attribute; |
| 6 | 6 | use web\lib\admin\domain\SilverbulletInvitation; |
| 7 | 7 | |
| 8 | -class SilverbulletUserTest extends PHPUnit_Framework_TestCase{ |
|
| 8 | +class SilverbulletUserTest extends PHPUnit_Framework_TestCase { |
|
| 9 | 9 | |
| 10 | 10 | private $username = 'testusername'; |
| 11 | 11 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $this->newUser->setExpiry('now'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function testNewUser(){ |
|
| 29 | + public function testNewUser() { |
|
| 30 | 30 | $this->newUser->save(); |
| 31 | 31 | $this->assertNotEmpty($this->newUser->getIdentifier()); |
| 32 | 32 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $list = SilverbulletUser::getList($this->profileId); |
| 51 | 51 | $found = false; |
| 52 | 52 | foreach ($list as $user) { |
| 53 | - if($user->getIdentifier() == $this->newUser->getIdentifier()){ |
|
| 53 | + if ($user->getIdentifier() == $this->newUser->getIdentifier()) { |
|
| 54 | 54 | $found = true; |
| 55 | 55 | break; |
| 56 | 56 | } |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | $this->assertTrue($result); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function testInactiveUser(){ |
|
| 64 | + public function testInactiveUser() { |
|
| 65 | 65 | $this->newUser->save(); |
| 66 | 66 | $this->assertFalse($this->newUser->hasCertificates()); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function testActiveUser(){ |
|
| 69 | + public function testActiveUser() { |
|
| 70 | 70 | $this->newUser->save(); |
| 71 | 71 | $invitation = new SilverbulletInvitation($this->newUser); |
| 72 | 72 | $invitation->setQuantity(2); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | $this->assertEquals(2, count($certificates)); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function testSetDeactivated(){ |
|
| 86 | + public function testSetDeactivated() { |
|
| 87 | 87 | $serial = '29837498273948'; |
| 88 | 88 | $cn = 'testCommonName'; |
| 89 | - $expiry = date('Y-m-d',strtotime("tomorrow")); |
|
| 89 | + $expiry = date('Y-m-d', strtotime("tomorrow")); |
|
| 90 | 90 | |
| 91 | 91 | //Testing new user deactivation |
| 92 | 92 | $this->newUser->save(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->assertEquals(SilverbulletUser::ACTIVE, $existingUser->get(SilverbulletUser::DEACTIVATION_STATUS)); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - protected function tearDown(){ |
|
| 133 | + protected function tearDown() { |
|
| 134 | 134 | $this->newUser->delete(); |
| 135 | 135 | $this->profile->delete(); |
| 136 | 136 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class SilverbulletController extends AbstractController{ |
|
| 9 | +class SilverbulletController extends AbstractController { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @param SilverbulletContext $context Requires silverbullet page context object |
| 21 | 21 | */ |
| 22 | - public function __construct($context){ |
|
| 22 | + public function __construct($context) { |
|
| 23 | 23 | $context->setController($this); |
| 24 | 24 | $this->context = $context; |
| 25 | 25 | } |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | * {@inheritDoc} |
| 30 | 30 | * @see \web\lib\admin\http\AbstractController::parseRequest() |
| 31 | 31 | */ |
| 32 | - public function parseRequest(){ |
|
| 32 | + public function parseRequest() { |
|
| 33 | 33 | $commandToken = ''; |
| 34 | - if(isset($_POST[SilverbulletController::COMMAND])){ |
|
| 34 | + if (isset($_POST[SilverbulletController::COMMAND])) { |
|
| 35 | 35 | $commandToken = $_POST[SilverbulletController::COMMAND]; |
| 36 | - if($commandToken == SaveUsersCommand::COMMAND){ |
|
| 37 | - if(isset($_POST[DeleteUserCommand::COMMAND])){ |
|
| 36 | + if ($commandToken == SaveUsersCommand::COMMAND) { |
|
| 37 | + if (isset($_POST[DeleteUserCommand::COMMAND])) { |
|
| 38 | 38 | $commandToken = DeleteUserCommand::COMMAND; |
| 39 | - }elseif(isset($_POST[AddInvitationCommand::COMMAND])){ |
|
| 39 | + }elseif (isset($_POST[AddInvitationCommand::COMMAND])) { |
|
| 40 | 40 | $commandToken = AddInvitationCommand::COMMAND; |
| 41 | - }elseif(isset($_POST[UpdateUserCommand::COMMAND])){ |
|
| 41 | + }elseif (isset($_POST[UpdateUserCommand::COMMAND])) { |
|
| 42 | 42 | $commandToken = UpdateUserCommand::COMMAND; |
| 43 | - }elseif (isset($_POST[RevokeCertificateCommand::COMMAND])){ |
|
| 43 | + }elseif (isset($_POST[RevokeCertificateCommand::COMMAND])) { |
|
| 44 | 44 | $commandToken = RevokeCertificateCommand::COMMAND; |
| 45 | - }elseif (isset($_POST[RevokeInvitationCommand::COMMAND])){ |
|
| 45 | + }elseif (isset($_POST[RevokeInvitationCommand::COMMAND])) { |
|
| 46 | 46 | $commandToken = RevokeInvitationCommand::COMMAND; |
| 47 | - }elseif (isset($_POST[SaveUsersCommand::COMMAND])){ |
|
| 47 | + }elseif (isset($_POST[SaveUsersCommand::COMMAND])) { |
|
| 48 | 48 | $commandToken = SaveUsersCommand::COMMAND; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -58,35 +58,35 @@ discard block |
||
| 58 | 58 | * {@inheritDoc} |
| 59 | 59 | * @see \web\lib\admin\http\AbstractController::doCreateCommand() |
| 60 | 60 | */ |
| 61 | - protected function doCreateCommand($commandToken){ |
|
| 62 | - if($this->context->isAgreementSigned()){ |
|
| 63 | - if($commandToken == AddUserCommand::COMMAND){ |
|
| 61 | + protected function doCreateCommand($commandToken) { |
|
| 62 | + if ($this->context->isAgreementSigned()) { |
|
| 63 | + if ($commandToken == AddUserCommand::COMMAND) { |
|
| 64 | 64 | return new AddUserCommand($commandToken, $this->context); |
| 65 | - }elseif ($commandToken == AddUsersCommand::COMMAND){ |
|
| 65 | + }elseif ($commandToken == AddUsersCommand::COMMAND) { |
|
| 66 | 66 | return new AddUsersCommand($commandToken, $this->context); |
| 67 | - }elseif ($commandToken == DeleteUserCommand::COMMAND){ |
|
| 67 | + }elseif ($commandToken == DeleteUserCommand::COMMAND) { |
|
| 68 | 68 | return new DeleteUserCommand($commandToken, $this->context); |
| 69 | - }elseif ($commandToken == AddInvitationCommand::COMMAND){ |
|
| 69 | + }elseif ($commandToken == AddInvitationCommand::COMMAND) { |
|
| 70 | 70 | return new AddInvitationCommand($commandToken, $this->context); |
| 71 | - }elseif ($commandToken == UpdateUserCommand::COMMAND){ |
|
| 71 | + }elseif ($commandToken == UpdateUserCommand::COMMAND) { |
|
| 72 | 72 | return new UpdateUserCommand($commandToken, $this->context); |
| 73 | - }elseif ($commandToken == RevokeCertificateCommand::COMMAND){ |
|
| 73 | + }elseif ($commandToken == RevokeCertificateCommand::COMMAND) { |
|
| 74 | 74 | return new RevokeCertificateCommand($commandToken, $this->context); |
| 75 | - }elseif ($commandToken == RevokeInvitationCommand::COMMAND){ |
|
| 75 | + }elseif ($commandToken == RevokeInvitationCommand::COMMAND) { |
|
| 76 | 76 | return new RevokeInvitationCommand($commandToken, $this->context); |
| 77 | - }elseif ($commandToken == SaveUsersCommand::COMMAND){ |
|
| 77 | + }elseif ($commandToken == SaveUsersCommand::COMMAND) { |
|
| 78 | 78 | return new SaveUsersCommand($commandToken, $this->context); |
| 79 | - }elseif ($commandToken == SendTokenByEmail::COMMAND){ |
|
| 79 | + }elseif ($commandToken == SendTokenByEmail::COMMAND) { |
|
| 80 | 80 | return new SendTokenByEmail($commandToken, $this->context); |
| 81 | - }elseif ($commandToken == SendTokenBySms::COMMAND){ |
|
| 81 | + }elseif ($commandToken == SendTokenBySms::COMMAND) { |
|
| 82 | 82 | return new SendTokenBySms($commandToken, $this->context); |
| 83 | - }else{ |
|
| 83 | + } else { |
|
| 84 | 84 | return new DefaultCommand($commandToken); |
| 85 | 85 | } |
| 86 | - }else{ |
|
| 87 | - if($commandToken == TermsOfUseCommand::COMMAND){ |
|
| 86 | + } else { |
|
| 87 | + if ($commandToken == TermsOfUseCommand::COMMAND) { |
|
| 88 | 88 | return new TermsOfUseCommand($commandToken, $this->context); |
| 89 | - }else{ |
|
| 89 | + } else { |
|
| 90 | 90 | return new DefaultCommand($commandToken); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @author Zilvinas Vaira |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -class SilverbulletContext extends DefaultContext implements MessageDistributor{ |
|
| 14 | +class SilverbulletContext extends DefaultContext implements MessageDistributor { |
|
| 15 | 15 | |
| 16 | 16 | const STATS_TOTAL = 'total'; |
| 17 | 17 | const STATS_ACTIVE = 'active'; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @param SilverbulletController $controller |
| 63 | 63 | */ |
| 64 | - public function setController($controller){ |
|
| 64 | + public function setController($controller) { |
|
| 65 | 65 | $this->controller = $controller; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return ProfileSilverbullet |
| 72 | 72 | */ |
| 73 | - public function getProfile(){ |
|
| 73 | + public function getProfile() { |
|
| 74 | 74 | return $this->profile; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return InstitutionPageBuilder |
| 81 | 81 | */ |
| 82 | - public function getBuilder(){ |
|
| 82 | + public function getBuilder() { |
|
| 83 | 83 | return $this->builder; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return boolean |
| 90 | 90 | */ |
| 91 | - public function isAgreementSigned(){ |
|
| 91 | + public function isAgreementSigned() { |
|
| 92 | 92 | $agreement_attributes = $this->profile->getAttributes("hiddenprofile:tou_accepted"); |
| 93 | 93 | return count($agreement_attributes) > 0; |
| 94 | 94 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Marks agreement as signed inside the database |
| 98 | 98 | */ |
| 99 | - public function signAgreement(){ |
|
| 100 | - $this->profile->addAttribute("hiddenprofile:tou_accepted",NULL,TRUE); |
|
| 99 | + public function signAgreement() { |
|
| 100 | + $this->profile->addAttribute("hiddenprofile:tou_accepted", NULL, TRUE); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | * @param AbstractInvokerCommand $command |
| 109 | 109 | * @return SilverbulletUser |
| 110 | 110 | */ |
| 111 | - public function createUser($username, $expiry, $command){ |
|
| 111 | + public function createUser($username, $expiry, $command) { |
|
| 112 | 112 | $user = new SilverbulletUser($this->profile->identifier, $username); |
| 113 | - if(empty($username)){ |
|
| 113 | + if (empty($username)) { |
|
| 114 | 114 | $command->storeErrorMessage(_('User name should not be empty!')); |
| 115 | - }elseif(empty($expiry)){ |
|
| 115 | + }elseif (empty($expiry)) { |
|
| 116 | 116 | $command->storeErrorMessage(_('No expiry date has been provided!')); |
| 117 | - }else{ |
|
| 117 | + } else { |
|
| 118 | 118 | $user->setExpiry($expiry); |
| 119 | 119 | $user->save(); |
| 120 | - if(empty($user->get(SilverbulletUser::EXPIRY))){ |
|
| 120 | + if (empty($user->get(SilverbulletUser::EXPIRY))) { |
|
| 121 | 121 | $command->storeErrorMessage(sprintf(_("Expiry date was incorect for '%s'!"), $username)); |
| 122 | - }elseif(empty($user->getIdentifier())){ |
|
| 122 | + }elseif (empty($user->getIdentifier())) { |
|
| 123 | 123 | $command->storeErrorMessage(sprintf(_("Username '%s' already exist!"), $username)); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | * @param AbstractInvokerCommand $command |
| 134 | 134 | * @return SilverbulletInvitation |
| 135 | 135 | */ |
| 136 | - public function createInvitation($user, $command, $quantity = 1){ |
|
| 136 | + public function createInvitation($user, $command, $quantity = 1) { |
|
| 137 | 137 | $invitation = new SilverbulletInvitation($user); |
| 138 | - if($quantity > 1){ |
|
| 138 | + if ($quantity > 1) { |
|
| 139 | 139 | $invitation->setQuantity($quantity); |
| 140 | 140 | } |
| 141 | 141 | $invitation->save(); |
| 142 | - if(empty($invitation->getIdentifier())){ |
|
| 142 | + if (empty($invitation->getIdentifier())) { |
|
| 143 | 143 | $command->storeErrorMessage(_('Could not create invitation!')); |
| 144 | 144 | } |
| 145 | 145 | return $invitation; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return SilverbulletUser |
| 152 | 152 | */ |
| 153 | - public function createUsers(){ |
|
| 153 | + public function createUsers() { |
|
| 154 | 154 | $this->users = SilverbulletUser::getList($this->profile->identifier); |
| 155 | 155 | return $this->users; |
| 156 | 156 | } |
@@ -160,16 +160,16 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return array |
| 162 | 162 | */ |
| 163 | - public function getUserStats(){ |
|
| 163 | + public function getUserStats() { |
|
| 164 | 164 | $silverbulletMaxUsers = $this->profile->getAttributes("internal:silverbullet_maxusers"); |
| 165 | 165 | $count = array(); |
| 166 | 166 | $count[self::STATS_TOTAL] = isset($silverbulletMaxUsers[0]['value']) ? $silverbulletMaxUsers[0]['value'] : -1; |
| 167 | 167 | $count[self::STATS_ACTIVE] = 0; |
| 168 | 168 | $count[self::STATS_PASSIVE] = 0; |
| 169 | 169 | foreach ($this->users as $user) { |
| 170 | - if($user->hasActiveCertificates()){ |
|
| 170 | + if ($user->hasActiveCertificates()) { |
|
| 171 | 171 | $count[self::STATS_ACTIVE]++; |
| 172 | - }else{ |
|
| 172 | + } else { |
|
| 173 | 173 | $count[self::STATS_PASSIVE]++; |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | /** |
| 180 | 180 | * Redirects page to itself in order to prevent acidental form resubmition |
| 181 | 181 | */ |
| 182 | - public function redirectAfterSubmit(){ |
|
| 183 | - if(isset($_SERVER['REQUEST_URI'])){ |
|
| 182 | + public function redirectAfterSubmit() { |
|
| 183 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
| 184 | 184 | $location = $this->addQuery($_SERVER['SCRIPT_NAME']); |
| 185 | - header('Location: ' . $location ); |
|
| 185 | + header('Location: ' . $location); |
|
| 186 | 186 | exit; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * @param string $url |
| 194 | 194 | * @return string |
| 195 | 195 | */ |
| 196 | - public function addQuery($url){ |
|
| 196 | + public function addQuery($url) { |
|
| 197 | 197 | $query = ''; |
| 198 | 198 | if (is_array($_GET) && count($_GET)) { |
| 199 | - foreach($_GET as $key => $val) { |
|
| 200 | - if(strpos($key , '/') === false){ |
|
| 199 | + foreach ($_GET as $key => $val) { |
|
| 200 | + if (strpos($key, '/') === false) { |
|
| 201 | 201 | if (empty($key) || empty($val)) { continue; } |
| 202 | 202 | $query .= ($query == '') ? '?' : "&"; |
| 203 | 203 | $query .= urlencode($key) . '=' . urlencode($val); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * {@inheritDoc} |
| 213 | 213 | * @see \web\lib\admin\http\MessageDistributor::addMessageInvoker() |
| 214 | 214 | */ |
| 215 | - public function addMessageInvoker($commandToken, $invoker){ |
|
| 215 | + public function addMessageInvoker($commandToken, $invoker) { |
|
| 216 | 216 | $this->invokers[$commandToken] = $invoker; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | * {@inheritDoc} |
| 222 | 222 | * @see \web\lib\admin\http\MessageDistributor::distributeMessages() |
| 223 | 223 | */ |
| 224 | - public function distributeMessages($commandToken, $receiver){ |
|
| 225 | - if($this->controller != null){ |
|
| 224 | + public function distributeMessages($commandToken, $receiver) { |
|
| 225 | + if ($this->controller != null) { |
|
| 226 | 226 | $this->controller->createCommand($commandToken); |
| 227 | - if(isset($this->invokers[$commandToken])){ |
|
| 227 | + if (isset($this->invokers[$commandToken])) { |
|
| 228 | 228 | $this->invokers[$commandToken]->publishMessages($receiver); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Zilvinas Vaira |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | -class AddInvitationCommand extends AbstractInvokerCommand{ |
|
| 11 | +class AddInvitationCommand extends AbstractInvokerCommand { |
|
| 12 | 12 | |
| 13 | 13 | const COMMAND = 'newinvitation'; |
| 14 | 14 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $commandToken |
| 24 | 24 | * @param SilverbulletContext $context |
| 25 | 25 | */ |
| 26 | - public function __construct($commandToken, $context){ |
|
| 26 | + public function __construct($commandToken, $context) { |
|
| 27 | 27 | parent::__construct($commandToken, $context); |
| 28 | 28 | $this->context = $context; |
| 29 | 29 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * {@inheritDoc} |
| 34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
| 35 | 35 | */ |
| 36 | - public function execute(){ |
|
| 36 | + public function execute() { |
|
| 37 | 37 | $userIndex = $this->parseInt($_POST[self::COMMAND]); |
| 38 | 38 | $userIds = $this->parseArray($_POST[SaveUsersCommand::PARAM_ID]); |
| 39 | 39 | $invitationsQuantities = $this->parseArray($_POST[SaveUsersCommand::PARAM_QUANTITY]); |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | $user = SilverbulletUser::prepare($userId); |
| 44 | 44 | $user->load(); |
| 45 | 45 | |
| 46 | - if($user->isExpired()){ |
|
| 46 | + if ($user->isExpired()) { |
|
| 47 | 47 | $this->storeErrorMessage(sprintf(_("User '%s' has expired. In order to generate credentials please extend the expiry date!"), $user->getUsername())); |
| 48 | - }else{ |
|
| 48 | + } else { |
|
| 49 | 49 | $this->context->createInvitation($user, $this, (int) $invitationsQuantity); |
| 50 | - if(!is_numeric($invitationsQuantity)){ |
|
| 50 | + if (!is_numeric($invitationsQuantity)) { |
|
| 51 | 51 | $this->storeErrorMessage(sprintf(_("Invitations quantity '%' provided for user '%s' was not numeric. Assumed quantity as '1' !"), $invitationsQuantity, $user->getUsername())); |
| 52 | 52 | } |
| 53 | - if($user->isDeactivated()){ |
|
| 53 | + if ($user->isDeactivated()) { |
|
| 54 | 54 | $user->setDeactivated(false, $this->context->getProfile()); |
| 55 | 55 | $user->save(); |
| 56 | 56 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function listIdPs() { |
| 143 | 143 | $instList = $this->orderIdentityProviders($this->country->identifier); |
| 144 | 144 | $out = ''; |
| 145 | - $out .= sprintf(_("Select your %s"), $this->nomenclature_inst ); |
|
| 145 | + $out .= sprintf(_("Select your %s"), $this->nomenclature_inst); |
|
| 146 | 146 | $out .= '<select name="idp" onchange="submit_form(this)">'; |
| 147 | 147 | if (!empty($instList)) { |
| 148 | 148 | if (!isset($this->idp)) { |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | $out .= '>' . $disp . '</option>'; |
| 239 | - $deviceRedirects .= 'redirects[' . $iterator . '] = ' . ( $oneDevice['redirect'] ? 1 : 0 ) . ';'; |
|
| 239 | + $deviceRedirects .= 'redirects[' . $iterator . '] = ' . ($oneDevice['redirect'] ? 1 : 0) . ';'; |
|
| 240 | 240 | $iterator++; |
| 241 | 241 | } |
| 242 | 242 | $out .= '</select>'; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | </script> |
| 431 | 431 | </head> |
| 432 | 432 | <body style=""> |
| 433 | - <?php print '<div id="motd">' . ( isset(CONFIG['APPEARANCE']['MOTD']) ? CONFIG['APPEARANCE']['MOTD'] : ' ' ) . '</div>'; ?> |
|
| 433 | + <?php print '<div id="motd">' . (isset(CONFIG['APPEARANCE']['MOTD']) ? CONFIG['APPEARANCE']['MOTD'] : ' ') . '</div>'; ?> |
|
| 434 | 434 | <form name="my_form" method="POST" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>" accept-charset='UTF-8'> |
| 435 | 435 | <img src="<?php echo $skinObject->findResourceUrl("IMAGES", "consortium_logo.png"); ?>" style="width: 20%; padding-right:20px; padding-top:0px; float:right" alt="logo" /> |
| 436 | 436 | <?php |