Passed
Push — master ( a7425d...dd80fa )
by Tomasz
03:35
created
tests/unit/web/lib/admin/http/MockSendTokenByEmail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 use web\lib\admin\http\SilverbulletContext;
5 5
 use web\lib\admin\http\GetTokenEmailDetails;
6 6
 
7
-class MockSendTokenByEmail extends SendTokenByEmail{
7
+class MockSendTokenByEmail extends SendTokenByEmail {
8 8
     
9 9
     /**
10 10
      * 
11 11
      * @param string $commandToken
12 12
      * @param SilverbulletContext $context
13 13
      */
14
-    public function __construct($commandToken, $context){
14
+    public function __construct($commandToken, $context) {
15 15
         $this->session = $context->getSession();
16 16
         $this->mail = new MockPHPMailer();
17 17
         $this->detailsCommand = new GetTokenEmailDetails(GetTokenEmailDetails::COMMAND, $context);
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * 
23 23
      * @return \PHPMailer\PHPMailer\PHPMailer
24 24
      */
25
-    public function getMailer(){
25
+    public function getMailer() {
26 26
         return $this->mail;
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
web/lib/admin/http/UpdateUserCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
web/lib/admin/http/RevokeCertificateCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         
Please login to merge, or discard this patch.
web/lib/admin/http/AbstractController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
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];
Please login to merge, or discard this patch.
web/lib/admin/http/DefaultCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
web/lib/admin/http/TermsOfUseCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
web/lib/admin/http/SaveUsersCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
web/lib/admin/http/SilverbulletContext.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
         $user = new SilverbulletUser($this->profile->identifier, $username);
93 93
         if(empty($username)){
94 94
             $command->storeErrorMessage(_('User name should not be empty!'));
95
-        }elseif(empty($expiry)){
95
+        } elseif(empty($expiry)){
96 96
             $command->storeErrorMessage(_('No expiry date has been provided!'));
97
-        }else{
97
+        } else{
98 98
             $user->setExpiry($expiry);
99 99
             $user->save();
100 100
             if(empty($user->get(SilverbulletUser::EXPIRY))){
101 101
                 $command->storeErrorMessage(sprintf(_("Expiry date was incorect for '%s'!"), $username));
102
-            }elseif(empty($user->getIdentifier())){
102
+            } elseif(empty($user->getIdentifier())){
103 103
                 $command->storeErrorMessage(sprintf(_("Username '%s' already exist!"), $username));
104 104
             }
105 105
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         foreach ($this->users as $user) {
147 147
             if($user->hasActiveCertificates()){
148 148
                 $count[self::STATS_ACTIVE]++;
149
-            }else{
149
+            } else{
150 150
                 $count[self::STATS_PASSIVE]++;
151 151
             }
152 152
         }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
web/skins/eduroam2016/user/js/roll.php 2 patches
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,13 +68,12 @@
 block discarded – undo
68 68
 
69 69
 <?php
70 70
 /**
71
-  * The OS object holds operating system descriptions
72
-  * @param name is the main title
73
-  * @param subtitle - the subtitle
74
-  * @param path - the path to the scriin-dump image
75
-  * @param signed - if true show information that the module is signed
76
-    
77
-*/
71
+ * The OS object holds operating system descriptions
72
+ * @param name is the main title
73
+ * @param subtitle - the subtitle
74
+ * @param path - the path to the scriin-dump image
75
+ * @param signed - if true show information that the module is signed
76
+ */
78 77
 ?>
79 78
 
80 79
 function OS(name, subtitle, path, signed) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.