@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Zilvinas Vaira |
9 | 9 | * |
10 | 10 | */ |
11 | -class SilverbulletAjaxController extends AbstractController{ |
|
11 | +class SilverbulletAjaxController extends AbstractController { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param DefaultContext $context Requires default context object. |
23 | 23 | */ |
24 | - public function __construct($context){ |
|
24 | + public function __construct($context) { |
|
25 | 25 | $this->context = $context; |
26 | 26 | } |
27 | 27 | |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * @see \web\lib\admin\http\AbstractController::doCreateCommand() |
32 | 32 | */ |
33 | 33 | protected function doCreateCommand($commandToken) { |
34 | - if($commandToken == ValidateEmailAddress::COMMAND){ |
|
34 | + if ($commandToken == ValidateEmailAddress::COMMAND) { |
|
35 | 35 | return new ValidateEmailAddress($commandToken, $this->context); |
36 | - }elseif($commandToken == GetTokenEmailDetails::COMMAND) { |
|
36 | + }elseif ($commandToken == GetTokenEmailDetails::COMMAND) { |
|
37 | 37 | return new GetTokenEmailDetails($commandToken, $this->context); |
38 | - }else { |
|
38 | + } else { |
|
39 | 39 | return new DefaultCommand($commandToken); |
40 | 40 | } |
41 | 41 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * {@inheritDoc} |
46 | 46 | * @see \web\lib\admin\http\AbstractController::parseRequest() |
47 | 47 | */ |
48 | - public function parseRequest(){ |
|
48 | + public function parseRequest() { |
|
49 | 49 | $commandToken = ''; |
50 | - if(isset($_REQUEST[SilverbulletAjaxController::COMMAND])){ |
|
50 | + if (isset($_REQUEST[SilverbulletAjaxController::COMMAND])) { |
|
51 | 51 | $commandToken = $_REQUEST[SilverbulletAjaxController::COMMAND]; |
52 | 52 | } |
53 | 53 | $currentCommand = $this->createCommand($commandToken); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Zilvinas Vaira |
10 | 10 | * |
11 | 11 | */ |
12 | -class UpdateUserCommand extends AbstractInvokerCommand{ |
|
12 | +class UpdateUserCommand extends AbstractInvokerCommand { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Update command identifier. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $commandToken |
30 | 30 | * @param SilverbulletContext $context |
31 | 31 | */ |
32 | - public function __construct($commandToken, $context){ |
|
32 | + public function __construct($commandToken, $context) { |
|
33 | 33 | parent::__construct($commandToken, $context); |
34 | 34 | $this->context = $context; |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * {@inheritDoc} |
40 | 40 | * @see \web\lib\admin\http\AbstractCommand::execute() |
41 | 41 | */ |
42 | - public function execute(){ |
|
42 | + public function execute() { |
|
43 | 43 | $userIndex = $this->parseInt($_POST[self::COMMAND]); |
44 | 44 | $userIds = $this->parseArray($_POST[SaveUsersCommand::PARAM_ID]); |
45 | 45 | $userExpiries = $this->parseArray($_POST[SaveUsersCommand::PARAM_EXPIRY]); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $user->setExpiry($userExpiry); |
53 | 53 | $username = $user->getUsername(); |
54 | - if(empty($user->get(SilverbulletUser::EXPIRY))){ |
|
54 | + if (empty($user->get(SilverbulletUser::EXPIRY))) { |
|
55 | 55 | $this->storeErrorMessage(sprintf(_("Expiry date was incorrect for '%s'!"), $username)); |
56 | 56 | } |
57 | 57 | $user->save(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Zilvinas Vaira |
9 | 9 | * |
10 | 10 | */ |
11 | -class RevokeCertificateCommand extends AbstractInvokerCommand{ |
|
11 | +class RevokeCertificateCommand extends AbstractInvokerCommand { |
|
12 | 12 | |
13 | 13 | const COMMAND = 'revokecertificate'; |
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 | $profile = $this->context->getProfile(); |
38 | 38 | $certificateId = $this->parseInt($_POST[self::COMMAND]); |
39 | 39 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | * @param string $commandToken |
24 | 24 | * @return AbstractCommand |
25 | 25 | */ |
26 | - public function createCommand($commandToken){ |
|
27 | - if(!isset($this->commands[$commandToken]) || $this->commands[$commandToken] == null){ |
|
26 | + public function createCommand($commandToken) { |
|
27 | + if (!isset($this->commands[$commandToken]) || $this->commands[$commandToken] == null) { |
|
28 | 28 | $this->commands[$commandToken] = $this->doCreateCommand($commandToken); |
29 | 29 | } |
30 | 30 | return $this->commands[$commandToken]; |
@@ -7,14 +7,14 @@ |
||
7 | 7 | * @author Zilvinas Vaira |
8 | 8 | * |
9 | 9 | */ |
10 | -class DefaultCommand extends AbstractCommand{ |
|
10 | +class DefaultCommand extends AbstractCommand { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * |
14 | 14 | * {@inheritDoc} |
15 | 15 | * @see \web\lib\admin\http\AbstractCommand::execute() |
16 | 16 | */ |
17 | - public function execute(){ |
|
17 | + public function execute() { |
|
18 | 18 | |
19 | 19 | } |
20 | 20 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class TermsOfUseCommand extends AbstractInvokerCommand{ |
|
9 | +class TermsOfUseCommand extends AbstractInvokerCommand { |
|
10 | 10 | |
11 | 11 | const COMMAND = 'termsofuse'; |
12 | 12 | |
@@ -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,8 +33,8 @@ discard block |
||
33 | 33 | * {@inheritDoc} |
34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
35 | 35 | */ |
36 | - public function execute(){ |
|
37 | - if(isset($_POST[self::AGREEMENT])){ |
|
36 | + public function execute() { |
|
37 | + if (isset($_POST[self::AGREEMENT])) { |
|
38 | 38 | $this->context->signAgreement(); |
39 | 39 | } |
40 | 40 | $this->context->redirectAfterSubmit(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Zilvinas Vaira |
9 | 9 | * |
10 | 10 | */ |
11 | -class SaveUsersCommand extends AbstractInvokerCommand{ |
|
11 | +class SaveUsersCommand extends AbstractInvokerCommand { |
|
12 | 12 | |
13 | 13 | const COMMAND = 'saveusers'; |
14 | 14 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $commandToken |
30 | 30 | * @param SilverbulletContext $context |
31 | 31 | */ |
32 | - public function __construct($commandToken, $context){ |
|
32 | + public function __construct($commandToken, $context) { |
|
33 | 33 | parent::__construct($commandToken, $context); |
34 | 34 | $this->context = $context; |
35 | 35 | } |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * {@inheritDoc} |
40 | 40 | * @see \web\lib\admin\http\AbstractCommand::execute() |
41 | 41 | */ |
42 | - public function execute(){ |
|
43 | - if(isset($_POST[self::PARAM_ID]) && isset($_POST[self::PARAM_EXPIRY])){ |
|
42 | + public function execute() { |
|
43 | + if (isset($_POST[self::PARAM_ID]) && isset($_POST[self::PARAM_EXPIRY])) { |
|
44 | 44 | $userIds = $this->parseArray($_POST[self::PARAM_ID]); |
45 | 45 | foreach ($userIds as $key => $userId) { |
46 | 46 | $user = SilverbulletUser::prepare($userId); |
47 | 47 | $user->load(); |
48 | - if(isset($_POST[self::PARAM_ACKNOWLEDGE]) && $_POST[self::PARAM_ACKNOWLEDGE]=='true'){ |
|
48 | + if (isset($_POST[self::PARAM_ACKNOWLEDGE]) && $_POST[self::PARAM_ACKNOWLEDGE] == 'true') { |
|
49 | 49 | $user->makeAcknowledged(); |
50 | 50 | } |
51 | 51 | $user->save(); |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | use web\lib\admin\view\DefaultHtmlPage; |
4 | 4 | use web\lib\admin\view\InstitutionPageBuilder; |
5 | 5 | |
6 | -class MockValidateInstitutionPageBuilder extends InstitutionPageBuilder{ |
|
6 | +class MockValidateInstitutionPageBuilder extends InstitutionPageBuilder { |
|
7 | 7 | |
8 | - protected function validateInstitution(){ |
|
8 | + protected function validateInstitution() { |
|
9 | 9 | $this->institution = $this->valid_IdP($_GET['inst_id'], $_SESSION['user']); |
10 | 10 | } |
11 | 11 | |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | * @throws Exception |
17 | 17 | * @return mixed |
18 | 18 | */ |
19 | - private function valid_IdP($input, $owner){ |
|
20 | - if ($input == 1){ |
|
19 | + private function valid_IdP($input, $owner) { |
|
20 | + if ($input == 1) { |
|
21 | 21 | return new MockInstitution(); |
22 | - }else{ |
|
23 | - throw new Exception('IdP '.$input.' not found in database!'); |
|
22 | + } else { |
|
23 | + throw new Exception('IdP ' . $input . ' not found in database!'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | -class MockInstitution{ |
|
29 | +class MockInstitution { |
|
30 | 30 | public $name = "Test name"; |
31 | 31 | } |
32 | 32 | |
33 | -class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase{ |
|
33 | +class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase { |
|
34 | 34 | |
35 | 35 | protected function setUp() { |
36 | 36 | $_SESSION['user'] = "user"; |
37 | 37 | } |
38 | 38 | |
39 | - public function testConstructorSuccess(){ |
|
40 | - $_GET['inst_id']=1; |
|
39 | + public function testConstructorSuccess() { |
|
40 | + $_GET['inst_id'] = 1; |
|
41 | 41 | $builder = new MockValidateInstitutionPageBuilder(new DefaultHtmlPage("Testing Page")); |
42 | 42 | $this->assertTrue($builder->isReady()); |
43 | 43 | } |
44 | 44 | |
45 | - public function testConstructorFailure(){ |
|
46 | - $_GET['inst_id']=-1; |
|
45 | + public function testConstructorFailure() { |
|
46 | + $_GET['inst_id'] = -1; |
|
47 | 47 | $builder = new MockValidateInstitutionPageBuilder(new DefaultHtmlPage("Testing Page")); |
48 | 48 | $this->assertFalse($builder->isReady()); |
49 | 49 |
@@ -129,12 +129,12 @@ |
||
129 | 129 | */ |
130 | 130 | ?> |
131 | 131 | |
132 | -var win8 = new OS('<?php echo _("MS Windows")?>', '<?php echo _("10, 8, 7, Vista") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-win8-english-h234.png")?>",true); |
|
133 | -var mac = new OS('<?php echo _("Apple OS X")?>','10.7+',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-mac-english-h234.png")?>",true); |
|
134 | -var android = new OS('<?php echo _("Android")?>','<?php echo _("4.3+") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-android-english-h234.png")?>",false); |
|
135 | -var iphone = new OS('<?php echo _("Apple iOS devices")?>','<?php echo _("iPhone, iPad, iPod touch") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-iphone-english-h234.png")?>",true); |
|
136 | -var linux = new OS('<?php echo _("Linux")?>','<?php echo _("all major distributions") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-linux-english-h234.png")?>",false); |
|
137 | -var chromeos = new OS('<?php echo _("Chrome OS")?>','',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES","screenshots/sampleinstaller-chromeos-english-h234.png")?>",false); |
|
132 | +var win8 = new OS('<?php echo _("MS Windows")?>', '<?php echo _("10, 8, 7, Vista") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-win8-english-h234.png")?>",true); |
|
133 | +var mac = new OS('<?php echo _("Apple OS X")?>','10.7+',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-mac-english-h234.png")?>",true); |
|
134 | +var android = new OS('<?php echo _("Android")?>','<?php echo _("4.3+") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-android-english-h234.png")?>",false); |
|
135 | +var iphone = new OS('<?php echo _("Apple iOS devices")?>','<?php echo _("iPhone, iPad, iPod touch") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-iphone-english-h234.png")?>",true); |
|
136 | +var linux = new OS('<?php echo _("Linux")?>','<?php echo _("all major distributions") ?>',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-linux-english-h234.png")?>",false); |
|
137 | +var chromeos = new OS('<?php echo _("Chrome OS")?>','',"<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "screenshots/sampleinstaller-chromeos-english-h234.png")?>",false); |
|
138 | 138 | |
139 | 139 | |
140 | 140 |