@@ -13,13 +13,13 @@ |
||
| 13 | 13 | |
| 14 | 14 | protected $action = ''; |
| 15 | 15 | |
| 16 | - protected $params = array (); |
|
| 16 | + protected $params = array(); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * |
| 20 | 20 | * @param string $action |
| 21 | 21 | */ |
| 22 | - public function __construct($action){ |
|
| 22 | + public function __construct($action) { |
|
| 23 | 23 | $this->action = $action; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class YesNoDialogBox extends AbstractTextDialogBox{ |
|
| 9 | +class YesNoDialogBox extends AbstractTextDialogBox { |
|
| 10 | 10 | |
| 11 | 11 | const NO = 0; |
| 12 | 12 | const YES = 1; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param string $action |
| 26 | 26 | * @param string $text |
| 27 | 27 | */ |
| 28 | - public function __construct($id, $action, $text){ |
|
| 28 | + public function __construct($id, $action, $text) { |
|
| 29 | 29 | parent::__construct($action, $text); |
| 30 | 30 | $this->id = $id; |
| 31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param string $name |
| 36 | 36 | * @param string $value |
| 37 | 37 | */ |
| 38 | - public function setYesControl($name, $value){ |
|
| 38 | + public function setYesControl($name, $value) { |
|
| 39 | 39 | $this->controls[self::YES]['name'] = $name; |
| 40 | 40 | $this->controls[self::YES]['value'] = $value; |
| 41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $name |
| 46 | 46 | * @param string $value |
| 47 | 47 | */ |
| 48 | - public function setNoControl($name, $value){ |
|
| 48 | + public function setNoControl($name, $value) { |
|
| 49 | 49 | $this->controls[self::NO]['name'] = $name; |
| 50 | 50 | $this->controls[self::NO]['value'] = $value; |
| 51 | 51 | } |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | * {@inheritDoc} |
| 56 | 56 | * @see \web\lib\admin\view\AbstractDialogBox::renderControls() |
| 57 | 57 | */ |
| 58 | - protected function renderControls(){ |
|
| 58 | + protected function renderControls() { |
|
| 59 | 59 | ?> |
| 60 | 60 | <button type="submit" name="<?php echo $this->controls[self::YES]['name']; ?>" value="<?php echo $this->controls[self::YES]['value']; ?>"><?php echo _('Yes'); ?></button> |
| 61 | - <?php if($this->controls[self::NO]['name'] == ''){ ?> |
|
| 61 | + <?php if ($this->controls[self::NO]['name'] == '') { ?> |
|
| 62 | 62 | <button class="<?php echo $this->id . '-close'; ?>" type="reset"><?php echo _('No'); ?></button> |
| 63 | - <?php }else{ ?> |
|
| 63 | + <?php } else { ?> |
|
| 64 | 64 | <button type="submit" name="<?php echo $this->controls[self::NO]['name']; ?>" value="<?php echo $this->controls[self::NO]['value']; ?>"><?php echo _('No'); ?></button> |
| 65 | 65 | <?php } |
| 66 | 66 | } |
@@ -172,9 +172,9 @@ |
||
| 172 | 172 | $totalFailures = 0; |
| 173 | 173 | foreach ($decoded_response['messages'] as $message) { |
| 174 | 174 | if ($message['status'] == 0) { |
| 175 | - $loggerInstance->debug(2, $message['message-id']. ": Success"); |
|
| 175 | + $loggerInstance->debug(2, $message['message-id'] . ": Success"); |
|
| 176 | 176 | } else { |
| 177 | - $loggerInstance->debug(2, $message['message-id']. ": Failed (failure code = ".$message['status'].")"); |
|
| 177 | + $loggerInstance->debug(2, $message['message-id'] . ": Failed (failure code = " . $message['status'] . ")"); |
|
| 178 | 178 | $totalFailures++; |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * {@inheritDoc} |
| 17 | 17 | * @see \web\lib\admin\view\AbstractDialogBox::renderControls() |
| 18 | 18 | */ |
| 19 | - protected function renderControls(){ |
|
| 19 | + protected function renderControls() { |
|
| 20 | 20 | ?> |
| 21 | 21 | <div style="position: relative; padding-bottom: 10px; width: 450px;"> |
| 22 | 22 | <label>Send email using client aplication:</label> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @author Zilvinas Vaira |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -class SendTokenBySms extends AbstractInvokerCommand{ |
|
| 13 | +class SendTokenBySms extends AbstractInvokerCommand { |
|
| 14 | 14 | |
| 15 | 15 | const COMMAND = "sendtokenbysms"; |
| 16 | 16 | const PARAM_PHONE = "phone"; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param string $commandToken |
| 39 | 39 | * @param SilverbulletContext $context |
| 40 | 40 | */ |
| 41 | - public function __construct($commandToken, $context){ |
|
| 41 | + public function __construct($commandToken, $context) { |
|
| 42 | 42 | parent::__construct($commandToken, $context); |
| 43 | 43 | $this->detailsCommand = new GetTokenEmailDetails(GetTokenEmailDetails::COMMAND, $context); |
| 44 | 44 | $this->context = $context; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param string $phone |
| 50 | 50 | * @param string $content |
| 51 | 51 | */ |
| 52 | - private function sendSMS($phone, $content){ |
|
| 52 | + private function sendSMS($phone, $content) { |
|
| 53 | 53 | $error = ""; |
| 54 | 54 | $result = -1; |
| 55 | 55 | try { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @see \web\lib\admin\http\AbstractCommand::execute() |
| 80 | 80 | */ |
| 81 | 81 | public function execute() { |
| 82 | - if(isset($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) && isset($_POST[SendTokenBySms::PARAM_PHONE])){ |
|
| 82 | + if (isset($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) && isset($_POST[SendTokenBySms::PARAM_PHONE])) { |
|
| 83 | 83 | |
| 84 | 84 | $invitationToken = $this->parseString($_POST[GetTokenEmailDetails::PARAM_TOKENLINK]); |
| 85 | 85 | $phone = $this->parseString($_POST[SendTokenBySms::PARAM_PHONE]); |
@@ -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 | } |