@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace web\lib\admin\view; |
3 | 3 | |
4 | -class TitledBlockDecorator extends PageElementDecorator{ |
|
4 | +class TitledBlockDecorator extends PageElementDecorator { |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @param string $class |
16 | 16 | * @param string $title |
17 | 17 | */ |
18 | - public function __construct($element, $title, $class = ""){ |
|
18 | + public function __construct($element, $title, $class = "") { |
|
19 | 19 | parent::__construct($element, $class); |
20 | 20 | $this->title = $title; |
21 | 21 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | <button type="submit" name="<?php echo $this->controls[self::YES]['name']; ?>" value="<?php echo $this->controls[self::YES]['value']; ?>"><?php echo _('Yes'); ?></button> |
41 | 41 | <?php if($this->controls[self::NO]['name'] == ''){ ?> |
42 | 42 | <button class="<?php echo $this->id . '-close'; ?>" type="reset"><?php echo _('No'); ?></button> |
43 | - <?php }else{ ?> |
|
43 | + <?php } else{ ?> |
|
44 | 44 | <button type="submit" name="<?php echo $this->controls[self::NO]['name']; ?>" value="<?php echo $this->controls[self::NO]['value']; ?>"><?php echo _('No'); ?></button> |
45 | 45 | <?php } |
46 | 46 | } |
@@ -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 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use web\lib\admin\view\html\Attribute; |
5 | 5 | |
6 | -abstract class PageElementDecorator implements PageElementInterface{ |
|
6 | +abstract class PageElementDecorator implements PageElementInterface { |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | /** |
31 | 31 | * |
32 | - * @return number |
|
32 | + * @return integer |
|
33 | 33 | */ |
34 | 34 | public function size(){ |
35 | 35 | return count($this->rows); |
@@ -53,7 +53,6 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * |
56 | - * @param array $row |
|
57 | 56 | */ |
58 | 57 | public function addRowArray($cells){ |
59 | 58 | $this->addRow(new Row($cells)); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Zilvinas Vaira |
6 | 6 | * |
7 | 7 | */ |
8 | -class Table extends Tag{ |
|
8 | +class Table extends Tag { |
|
9 | 9 | |
10 | 10 | const TITLED_CELL_CLASS = 'sb-titled-cell'; |
11 | 11 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param array $rows |
26 | 26 | */ |
27 | - public function __construct($rows = array()){ |
|
27 | + public function __construct($rows = array()) { |
|
28 | 28 | parent::__construct('table'); |
29 | 29 | $this->setRows($rows); |
30 | 30 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return number |
35 | 35 | */ |
36 | - public function size(){ |
|
36 | + public function size() { |
|
37 | 37 | return count($this->rows); |
38 | 38 | } |
39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param int $row |
43 | 43 | * @param string $column |
44 | 44 | */ |
45 | - private function createRow($row, $column){ |
|
46 | - if(!in_array($column, $this->columns)){ |
|
45 | + private function createRow($row, $column) { |
|
46 | + if (!in_array($column, $this->columns)) { |
|
47 | 47 | $this->columns [] = $column; |
48 | 48 | } |
49 | - if(!isset($this->rows[$row])){ |
|
49 | + if (!isset($this->rows[$row])) { |
|
50 | 50 | $this->rows [$row] = new Row(); |
51 | 51 | } |
52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $column |
58 | 58 | * @param UnaryTag $element |
59 | 59 | */ |
60 | - public function addToCell($row, $column, $element){ |
|
60 | + public function addToCell($row, $column, $element) { |
|
61 | 61 | $this->createRow($row, $column); |
62 | 62 | $this->rows[$row]->addToCell($column, $element); |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $column |
69 | 69 | * @return \web\lib\admin\view\html\CompositeTag |
70 | 70 | */ |
71 | - public function getCell($row, $column){ |
|
71 | + public function getCell($row, $column) { |
|
72 | 72 | $this->createRow($row, $column); |
73 | 73 | return $this->rows[$row]->getCell($column); |
74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param array $row |
79 | 79 | */ |
80 | - public function addRowArray($cells){ |
|
80 | + public function addRowArray($cells) { |
|
81 | 81 | $this->addRow(new Row($cells)); |
82 | 82 | } |
83 | 83 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param Row $row |
87 | 87 | */ |
88 | - public function addRow($row){ |
|
89 | - if(count($row->size())>0){ |
|
88 | + public function addRow($row) { |
|
89 | + if (count($row->size()) > 0) { |
|
90 | 90 | $this->rows [] = $row; |
91 | 91 | $this->setColumns($row); |
92 | 92 | } |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param array $rows |
98 | 98 | */ |
99 | - public function setRows($rows){ |
|
100 | - if(count($rows)>0){ |
|
99 | + public function setRows($rows) { |
|
100 | + if (count($rows) > 0) { |
|
101 | 101 | foreach ($rows as $cells) { |
102 | 102 | $this->addRowArray($cells); |
103 | 103 | } |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param Row $row |
110 | 110 | */ |
111 | - private function setColumns($row){ |
|
111 | + private function setColumns($row) { |
|
112 | 112 | $cells = $row->getCells(); |
113 | 113 | foreach ($cells as $key => $value) { |
114 | - if(!in_array($key, $this->columns)){ |
|
114 | + if (!in_array($key, $this->columns)) { |
|
115 | 115 | $this->columns [] = $key; |
116 | 116 | } |
117 | 117 | } |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return string |
123 | 123 | */ |
124 | - protected function composeInnerString(){ |
|
124 | + protected function composeInnerString() { |
|
125 | 125 | $innerString = ""; |
126 | 126 | foreach ($this->rows as $row) { |
127 | 127 | $row->setColumns($this->columns); |
128 | - $row->setTab("\t".$this->tab); |
|
128 | + $row->setTab("\t" . $this->tab); |
|
129 | 129 | $innerString .= $row; |
130 | 130 | } |
131 | 131 | return $innerString; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | private function valid_IdP($input, $owner){ |
17 | 17 | if ($input == 1){ |
18 | 18 | return new MockInstitution(); |
19 | - }else{ |
|
19 | + } else{ |
|
20 | 20 | throw new Exception('IdP '.$input.' not found in database!'); |
21 | 21 | } |
22 | 22 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param unknown $input |
16 | 16 | * @param unknown $owner |
17 | 17 | * @throws Exception |
18 | - * @return mixed |
|
18 | + * @return MockInstitution |
|
19 | 19 | */ |
20 | 20 | private function valid_IdP($input, $owner){ |
21 | 21 | if ($input == 1){ |
@@ -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 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @author Zilvinas Vaira |
8 | 8 | * |
9 | 9 | */ |
10 | -class Attribute implements HtmlElementInterface{ |
|
10 | +class Attribute implements HtmlElementInterface { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * @param string $name |
27 | 27 | * @param string $value |
28 | 28 | */ |
29 | - public function __construct($name, $value){ |
|
29 | + public function __construct($name, $value) { |
|
30 | 30 | $this->name = str_replace('"', '', $name); |
31 | 31 | $this->value = str_replace('"', '', $value); |
32 | 32 | } |
33 | 33 | |
34 | - public function __toString(){ |
|
35 | - if(!empty($this->name) && $this->value!=''){ |
|
34 | + public function __toString() { |
|
35 | + if (!empty($this->name) && $this->value != '') { |
|
36 | 36 | return ' ' . $this->name . '="' . $this->value . '"'; |
37 | - }else{ |
|
37 | + } else { |
|
38 | 38 | return ''; |
39 | 39 | } |
40 | 40 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function __toString(){ |
35 | 35 | if(!empty($this->name) && $this->value!=''){ |
36 | 36 | return ' ' . $this->name . '="' . $this->value . '"'; |
37 | - }else{ |
|
37 | + } else{ |
|
38 | 38 | return ''; |
39 | 39 | } |
40 | 40 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $tokenExpiry = date('Y-m-d H:i:s', strtotime($date)); |
103 | 103 | if($tokenExpiry > $this->defaultUserExpiry){ |
104 | 104 | $this->set(self::EXPIRY, $tokenExpiry); |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $this->clear(); |
107 | 107 | } |
108 | 108 | } |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $days = $this->getAcknowledgeDays(); |
125 | 125 | if($days <= $max * 0.2 && $days > $max * 0.1){ |
126 | 126 | return self::LEVEL_YELLOW; |
127 | - }elseif ($days <= $max * 0.1){ |
|
127 | + } elseif ($days <= $max * 0.1){ |
|
128 | 128 | return self::LEVEL_RED; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | return self::LEVEL_GREEN; |
131 | 131 | } |
132 | 132 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | foreach ($this->certificates as $certificate) { |
213 | 213 | $certificate->revoke($profile); |
214 | 214 | } |
215 | - }else{ |
|
215 | + } else{ |
|
216 | 216 | $this->set(self::DEACTIVATION_TIME, '0000-00-00 00:00:00'); |
217 | 217 | } |
218 | 218 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class SilverbulletUser extends PersistentEntity{ |
|
9 | +class SilverbulletUser extends PersistentEntity { |
|
10 | 10 | |
11 | 11 | const LEVEL_GREEN = 0; |
12 | 12 | const LEVEL_YELLOW = 1; |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | * @param int $profileId |
90 | 90 | * @param string $username |
91 | 91 | */ |
92 | - public function __construct($profileId, $username){ |
|
92 | + public function __construct($profileId, $username) { |
|
93 | 93 | parent::__construct(self::TABLE, self::TYPE_INST); |
94 | 94 | $this->setAttributeType(self::PROFILEID, Attribute::TYPE_INTEGER); |
95 | 95 | |
96 | 96 | $this->set(self::PROFILEID, $profileId); |
97 | 97 | $this->set(self::USERNAME, $username); |
98 | 98 | //$this->set(self::EXPIRY, 'NOW() + INTERVAL 1 WEEK'); |
99 | - $this->defaultUserExpiry = date('Y-m-d H:i:s',strtotime("today")); |
|
99 | + $this->defaultUserExpiry = date('Y-m-d H:i:s', strtotime("today")); |
|
100 | 100 | //$this->set(self::EXPIRY, $this->defaultUserExpiry); |
101 | 101 | } |
102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * {@inheritDoc} |
106 | 106 | * @see \web\lib\admin\domain\PersistentInterface::validate() |
107 | 107 | */ |
108 | - public function validate(){ |
|
108 | + public function validate() { |
|
109 | 109 | return ( |
110 | 110 | !empty($this->get(self::PROFILEID)) |
111 | 111 | ); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param string $date Takes any string value that can passed to strtotime() function. |
118 | 118 | */ |
119 | - public function setExpiry($date){ |
|
119 | + public function setExpiry($date) { |
|
120 | 120 | $tokenExpiry = date('Y-m-d H:i:s', strtotime($date)); |
121 | - if($tokenExpiry > $this->defaultUserExpiry){ |
|
121 | + if ($tokenExpiry > $this->defaultUserExpiry) { |
|
122 | 122 | $this->set(self::EXPIRY, $tokenExpiry); |
123 | - }else{ |
|
123 | + } else { |
|
124 | 124 | $this->clear(); |
125 | 125 | } |
126 | 126 | } |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * |
130 | 130 | */ |
131 | - public function makeAcknowledged(){ |
|
132 | - $this->set(self::LAST_ACKNOWLEDGE, date('Y-m-d H:i:s',strtotime("now"))); |
|
131 | + public function makeAcknowledged() { |
|
132 | + $this->set(self::LAST_ACKNOWLEDGE, date('Y-m-d H:i:s', strtotime("now"))); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return int One of the following constants LEVEL_GREEN, LEVEL_YELLOW, LEVEL_RED. |
139 | 139 | */ |
140 | - public function getAcknowledgeLevel(){ |
|
140 | + public function getAcknowledgeLevel() { |
|
141 | 141 | $max = CONFIG_CONFASSISTANT['SILVERBULLET']['gracetime'] ?? SilverbulletUser::MAX_ACKNOWLEDGE; |
142 | 142 | $days = $this->getAcknowledgeDays(); |
143 | - if($days <= $max * 0.2 && $days > $max * 0.1){ |
|
143 | + if ($days <= $max * 0.2 && $days > $max * 0.1) { |
|
144 | 144 | return self::LEVEL_YELLOW; |
145 | - }elseif ($days <= $max * 0.1){ |
|
145 | + }elseif ($days <= $max * 0.1) { |
|
146 | 146 | return self::LEVEL_RED; |
147 | - }else{ |
|
147 | + } else { |
|
148 | 148 | return self::LEVEL_GREEN; |
149 | 149 | } |
150 | 150 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return number Number of days from 0 to maximum period. |
156 | 156 | */ |
157 | - public function getAcknowledgeDays(){ |
|
157 | + public function getAcknowledgeDays() { |
|
158 | 158 | $max = CONFIG_CONFASSISTANT['SILVERBULLET']['gracetime'] ?? SilverbulletUser::MAX_ACKNOWLEDGE; |
159 | 159 | $lastAcknowledge = strtotime($this->get(self::LAST_ACKNOWLEDGE)); |
160 | 160 | $now = strtotime('now'); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | return $days > 0 ? $days : 0; |
163 | 163 | } |
164 | 164 | |
165 | - public function getProfileId(){ |
|
165 | + public function getProfileId() { |
|
166 | 166 | return $this->get(self::PROFILEID); |
167 | 167 | } |
168 | 168 | |
169 | - public function getUsername(){ |
|
169 | + public function getUsername() { |
|
170 | 170 | return $this->get(self::USERNAME); |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return boolean |
176 | 176 | */ |
177 | - public function isExpired(){ |
|
177 | + public function isExpired() { |
|
178 | 178 | $expiryTime = strtotime($this->get(self::EXPIRY)); |
179 | 179 | $currentTime = time(); |
180 | 180 | return $currentTime > $expiryTime; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return string |
186 | 186 | */ |
187 | - public function getExpiry(){ |
|
187 | + public function getExpiry() { |
|
188 | 188 | return date('Y-m-d', strtotime($this->get(self::EXPIRY))); |
189 | 189 | } |
190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return \web\lib\admin\domain\SilverbulletCertificate |
194 | 194 | */ |
195 | - public function getCertificates(){ |
|
195 | + public function getCertificates() { |
|
196 | 196 | return $this->certificates; |
197 | 197 | } |
198 | 198 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return \web\lib\admin\domain\SilverbulletInvitation |
202 | 202 | */ |
203 | - public function getInvitations(){ |
|
203 | + public function getInvitations() { |
|
204 | 204 | return $this->invitations; |
205 | 205 | } |
206 | 206 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function hasCertificates(){ |
|
211 | + public function hasCertificates() { |
|
212 | 212 | return count($this->certificates) > 0; |
213 | 213 | } |
214 | 214 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return boolean |
218 | 218 | */ |
219 | - public function hasActiveCertificates(){ |
|
219 | + public function hasActiveCertificates() { |
|
220 | 220 | $count = 0; |
221 | 221 | foreach ($this->certificates as $certificate) { |
222 | - if(!$certificate->isExpired() && !$certificate->isRevoked()){ |
|
222 | + if (!$certificate->isExpired() && !$certificate->isRevoked()) { |
|
223 | 223 | $count++; |
224 | 224 | } |
225 | 225 | } |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @param boolean $isDeactivated |
233 | 233 | */ |
234 | - public function setDeactivated($isDeactivated, $profile){ |
|
234 | + public function setDeactivated($isDeactivated, $profile) { |
|
235 | 235 | $this->set(self::DEACTIVATION_STATUS, $isDeactivated ? self::INACTIVE : self::ACTIVE); |
236 | - if($isDeactivated){ |
|
236 | + if ($isDeactivated) { |
|
237 | 237 | $this->set(self::DEACTIVATION_TIME, date('Y-m-d H:i:s', strtotime("now"))); |
238 | 238 | foreach ($this->certificates as $certificate) { |
239 | 239 | $certificate->revoke($profile); |
240 | 240 | } |
241 | - }else{ |
|
241 | + } else { |
|
242 | 242 | $this->set(self::DEACTIVATION_TIME, '0000-00-00 00:00:00'); |
243 | 243 | } |
244 | 244 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return boolean |
249 | 249 | */ |
250 | - public function isDeactivated(){ |
|
250 | + public function isDeactivated() { |
|
251 | 251 | return $this->get(self::DEACTIVATION_STATUS) == self::INACTIVE; |
252 | 252 | } |
253 | 253 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * {@inheritDoc} |
257 | 257 | * @see \web\lib\admin\domain\PersistentInterface::load() |
258 | 258 | */ |
259 | - public function load($searchAttribute = null){ |
|
259 | + public function load($searchAttribute = null) { |
|
260 | 260 | $state = parent::load(); |
261 | 261 | $this->certificates = SilverbulletCertificate::getList($this, $searchAttribute); |
262 | 262 | $this->invitations = SilverbulletInvitation::getList($this); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * {@inheritDoc} |
269 | 269 | * @see \web\lib\admin\domain\PersistentInterface::delete() |
270 | 270 | */ |
271 | - public function delete(){ |
|
271 | + public function delete() { |
|
272 | 272 | $state = parent::delete(); |
273 | 273 | foreach ($this->certificates as $certificate) { |
274 | 274 | $certificate->delete(); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param integer $userId |
285 | 285 | * @return \web\lib\admin\domain\SilverbulletUser |
286 | 286 | */ |
287 | - public static function prepare($userId){ |
|
287 | + public static function prepare($userId) { |
|
288 | 288 | $instance = new SilverbulletUser(null, ''); |
289 | 289 | $instance->set(self::ID, $userId); |
290 | 290 | return $instance; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case "boolean": |
125 | - $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>"; |
|
125 | + $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off")) . "</strong></td></tr>"; |
|
126 | 126 | break; |
127 | 127 | default: |
128 | 128 | $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>"; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']); |
193 | 193 | $details['name'] = preg_replace('/\//', "", $details['name']); |
194 | - $certstatus = ( $details['root'] == 1 ? "R" : "I"); |
|
194 | + $certstatus = ($details['root'] == 1 ? "R" : "I"); |
|
195 | 195 | if ($details['ca'] == 0 && $details['root'] != 1) { |
196 | 196 | return "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . _("This is a <strong>SERVER</strong> certificate!") . "<br/>" . $details['name'] . "</div>"; |
197 | 197 | } |
@@ -120,6 +120,9 @@ discard block |
||
120 | 120 | return $find[0]; |
121 | 121 | } |
122 | 122 | |
123 | + /** |
|
124 | + * @param string $input |
|
125 | + */ |
|
123 | 126 | public function tooltip($input) { |
124 | 127 | $descriptions = []; |
125 | 128 | if (count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0) { |
@@ -256,6 +259,10 @@ discard block |
||
256 | 259 | return $number . " B"; |
257 | 260 | } |
258 | 261 | |
262 | + /** |
|
263 | + * @param string $ref |
|
264 | + * @param boolean $checkpublic |
|
265 | + */ |
|
259 | 266 | public static function getBlobFromDB($ref, $checkpublic) { |
260 | 267 | $validator = new \web\lib\common\InputValidation(); |
261 | 268 | $reference = $validator->databaseReference($ref); |
@@ -402,7 +409,7 @@ discard block |
||
402 | 409 | * @param string $text the text to display |
403 | 410 | * @param string $caption the caption to display |
404 | 411 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
405 | - * @return type |
|
412 | + * @return string |
|
406 | 413 | */ |
407 | 414 | public function boxOkay(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
408 | 415 | return $this->boxFlexible(\core\common\Entity::L_OK, $text, $caption, $omittabletags); |
@@ -414,7 +421,7 @@ discard block |
||
414 | 421 | * @param string $text the text to display |
415 | 422 | * @param string $caption the caption to display |
416 | 423 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
417 | - * @return type |
|
424 | + * @return string |
|
418 | 425 | */ |
419 | 426 | public function boxRemark(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
420 | 427 | return $this->boxFlexible(\core\common\Entity::L_REMARK, $text, $caption, $omittabletags); |
@@ -426,7 +433,7 @@ discard block |
||
426 | 433 | * @param string $text the text to display |
427 | 434 | * @param string $caption the caption to display |
428 | 435 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
429 | - * @return type |
|
436 | + * @return string |
|
430 | 437 | */ |
431 | 438 | public function boxWarning(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
432 | 439 | return $this->boxFlexible(\core\common\Entity::L_WARN, $text, $caption, $omittabletags); |
@@ -438,7 +445,7 @@ discard block |
||
438 | 445 | * @param string $text the text to display |
439 | 446 | * @param string $caption the caption to display |
440 | 447 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
441 | - * @return type |
|
448 | + * @return string |
|
442 | 449 | */ |
443 | 450 | public function boxError(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
444 | 451 | return $this->boxFlexible(\core\common\Entity::L_ERROR, $text, $caption, $omittabletags); |
@@ -97,14 +97,14 @@ |
||
97 | 97 | case "SUCCESS": |
98 | 98 | $cryptText = ""; |
99 | 99 | switch ($_GET['transportsecurity']) { |
100 | - case "ENCRYPTED": |
|
101 | - $cryptText = _("and <b>encrypted</b> to the mail domain"); |
|
102 | - break; |
|
103 | - case "CLEAR": |
|
104 | - $cryptText = _("but <b>in clear text</b> to the mail domain"); |
|
105 | - break; |
|
106 | - default: |
|
107 | - throw new Exception("Error: unknown encryption status of invitation!?!"); |
|
100 | + case "ENCRYPTED": |
|
101 | + $cryptText = _("and <b>encrypted</b> to the mail domain"); |
|
102 | + break; |
|
103 | + case "CLEAR": |
|
104 | + $cryptText = _("but <b>in clear text</b> to the mail domain"); |
|
105 | + break; |
|
106 | + default: |
|
107 | + throw new Exception("Error: unknown encryption status of invitation!?!"); |
|
108 | 108 | } |
109 | 109 | echo $uiElements->boxRemark(sprintf(_("The invitation email was sent successfully %s."), $cryptText), _("The invitation email was sent.")); |
110 | 110 | break; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $ownermgmt = new \core\UserManagement(); |
79 | 79 | $ownermgmt->addAdminToIdp($my_inst, $_SESSION['user']); |
80 | 80 | } else { |
81 | - echo "Fatal Error: you wanted to take control over an ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution'].", but are not a ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation']." operator!"; |
|
81 | + echo "Fatal Error: you wanted to take control over an " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution'] . ", but are not a " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation'] . " operator!"; |
|
82 | 82 | exit(1); |
83 | 83 | } |
84 | 84 | } |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | |
122 | 122 | if ($isFedAdmin) { |
123 | 123 | echo "<div class='ca-summary' style='position:relative;'><table>"; |
124 | - echo $uiElements->boxRemark(sprintf(_("You are the %s administrator of this %s. You can invite new administrators, who can in turn appoint further administrators on their own."),$uiElements->nomenclature_fed, $uiElements->nomenclature_inst), sprintf(_("%s Administrator"),$uiElements->nomenclature_fed)); |
|
124 | + echo $uiElements->boxRemark(sprintf(_("You are the %s administrator of this %s. You can invite new administrators, who can in turn appoint further administrators on their own."), $uiElements->nomenclature_fed, $uiElements->nomenclature_inst), sprintf(_("%s Administrator"), $uiElements->nomenclature_fed)); |
|
125 | 125 | echo "</table></div>"; |
126 | 126 | } |
127 | 127 | |
128 | 128 | if (!$isFedAdmin && $is_admin_with_blessing) { |
129 | 129 | echo "<div class='ca-summary' style='position:relative;'><table>"; |
130 | - echo $uiElements->boxRemark(sprintf(_("You are an administrator of this %s, and were directly appointed by the %s administrator. You can appoint further administrators, but these can't in turn appoint any more administrators."),$uiElements->nomenclature_inst ,$uiElements->nomenclature_fed), _("Directly Appointed IdP Administrator")); |
|
130 | + echo $uiElements->boxRemark(sprintf(_("You are an administrator of this %s, and were directly appointed by the %s administrator. You can appoint further administrators, but these can't in turn appoint any more administrators."), $uiElements->nomenclature_inst, $uiElements->nomenclature_fed), _("Directly Appointed IdP Administrator")); |
|
131 | 131 | echo "</table></div>"; |
132 | 132 | } |
133 | 133 | ?> |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | echo "</td> |
157 | 157 | <td> |
158 | - <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ( $oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "" ) . " accept-charset='UTF-8'> |
|
158 | + <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ($oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "") . " accept-charset='UTF-8'> |
|
159 | 159 | <input type='hidden' name='admin_id' value='" . $oneowner['ID'] . "'></input> |
160 | 160 | <button type='submit' name='submitbutton' class='delete' value='" . web\lib\common\FormElements::BUTTON_DELETE . "'>" . _("Delete Administrator") . "</button> |
161 | 161 | </form> |