@@ -76,9 +76,6 @@ |
||
76 | 76 | * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods |
77 | 77 | * available for the particular device. |
78 | 78 | * {@source} |
79 | - * @param string $device a pointer to a device module, which must |
|
80 | - * be an index of one of the devices defined in the {@link Devices} |
|
81 | - * array in {@link devices.php}. |
|
82 | 79 | * @final not to be redefined |
83 | 80 | */ |
84 | 81 | final public function __construct() { |
@@ -70,51 +70,51 @@ discard block |
||
70 | 70 | * @package ModuleWriting |
71 | 71 | */ |
72 | 72 | class Device_TestModule extends DeviceConfig { |
73 | - /** |
|
74 | - * Constructs a Device object. |
|
75 | - * |
|
76 | - * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods |
|
77 | - * available for the particular device. |
|
78 | - * {@source} |
|
79 | - * @param string $device a pointer to a device module, which must |
|
80 | - * be an index of one of the devices defined in the {@link Devices} |
|
81 | - * array in {@link devices.php}. |
|
82 | - * @final not to be redefined |
|
83 | - */ |
|
73 | + /** |
|
74 | + * Constructs a Device object. |
|
75 | + * |
|
76 | + * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods |
|
77 | + * available for the particular device. |
|
78 | + * {@source} |
|
79 | + * @param string $device a pointer to a device module, which must |
|
80 | + * be an index of one of the devices defined in the {@link Devices} |
|
81 | + * array in {@link devices.php}. |
|
82 | + * @final not to be redefined |
|
83 | + */ |
|
84 | 84 | final public function __construct() { |
85 | - $this->supportedEapMethods = EAP::listKnownEAPTypes(); |
|
86 | - debug(4,"This device supports the following EAP methods: "); |
|
87 | - debug(4,$this->supportedEapMethods); |
|
85 | + $this->supportedEapMethods = EAP::listKnownEAPTypes(); |
|
86 | + debug(4,"This device supports the following EAP methods: "); |
|
87 | + debug(4,$this->supportedEapMethods); |
|
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer |
|
92 | - * |
|
93 | - * {@source} |
|
94 | - * @return string installer path name |
|
95 | - */ |
|
96 | - public function writeInstaller() { |
|
90 | + /** |
|
91 | + * prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer |
|
92 | + * |
|
93 | + * {@source} |
|
94 | + * @return string installer path name |
|
95 | + */ |
|
96 | + public function writeInstaller() { |
|
97 | 97 | debug(4,"Test Module Installer start\n"); |
98 | - // create certificate files and save their names in $CA_files arrary |
|
99 | - $CA_files = $this->saveCertificateFiles('der'); |
|
98 | + // create certificate files and save their names in $CA_files arrary |
|
99 | + $CA_files = $this->saveCertificateFiles('der'); |
|
100 | 100 | |
101 | 101 | // copy a fixed file from the module Files directory |
102 | - if(! $this->copyFile('Module.howto')) |
|
103 | - debug(2, "copying of Module.howto failed\n"); |
|
102 | + if(! $this->copyFile('Module.howto')) |
|
103 | + debug(2, "copying of Module.howto failed\n"); |
|
104 | 104 | |
105 | 105 | // copy a fixed file from the module Files directory and saveunde a different name |
106 | - if( ! $this->copyFile('test_file','copied_test_file')) |
|
107 | - debug(2, "copying of Module.howto to copied_test_file failed\n"); |
|
108 | - $this->dumpAttibutes('profile_attributes'); |
|
109 | - $installer_path = $this->zipInstaller($this->attributes); |
|
110 | - return($installer_path); |
|
111 | - } |
|
106 | + if( ! $this->copyFile('test_file','copied_test_file')) |
|
107 | + debug(2, "copying of Module.howto to copied_test_file failed\n"); |
|
108 | + $this->dumpAttibutes('profile_attributes'); |
|
109 | + $installer_path = $this->zipInstaller($this->attributes); |
|
110 | + return($installer_path); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * prepare module desctiption and usage information |
|
115 | - * {@source} |
|
116 | - * @return string HTML text to be displayed in the information window |
|
117 | - */ |
|
113 | + /** |
|
114 | + * prepare module desctiption and usage information |
|
115 | + * {@source} |
|
116 | + * @return string HTML text to be displayed in the information window |
|
117 | + */ |
|
118 | 118 | public function writeDeviceInfo() { |
119 | 119 | $ssid_ct=count($this->attributes['internal:SSID']); |
120 | 120 | $out = "<p>"; |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | /** |
127 | - * zip files and return the archive name |
|
128 | - * |
|
129 | - * inline{@source} |
|
130 | - * return string |
|
131 | - */ |
|
132 | - private function zipInstaller($attr) { |
|
127 | + * zip files and return the archive name |
|
128 | + * |
|
129 | + * inline{@source} |
|
130 | + * return string |
|
131 | + */ |
|
132 | + private function zipInstaller($attr) { |
|
133 | 133 | $e = $this->installerBasename.'.zip'; |
134 | 134 | $o = system('zip -q '.$e.' *'); |
135 | 135 | return $e; |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @final not to be redefined |
83 | 83 | */ |
84 | 84 | final public function __construct() { |
85 | - $this->supportedEapMethods = EAP::listKnownEAPTypes(); |
|
86 | - debug(4,"This device supports the following EAP methods: "); |
|
87 | - debug(4,$this->supportedEapMethods); |
|
85 | + $this->supportedEapMethods = EAP::listKnownEAPTypes(); |
|
86 | + debug(4, "This device supports the following EAP methods: "); |
|
87 | + debug(4, $this->supportedEapMethods); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | * @return string installer path name |
95 | 95 | */ |
96 | 96 | public function writeInstaller() { |
97 | -debug(4,"Test Module Installer start\n"); |
|
97 | +debug(4, "Test Module Installer start\n"); |
|
98 | 98 | // create certificate files and save their names in $CA_files arrary |
99 | 99 | $CA_files = $this->saveCertificateFiles('der'); |
100 | 100 | |
101 | 101 | // copy a fixed file from the module Files directory |
102 | - if(! $this->copyFile('Module.howto')) |
|
102 | + if (!$this->copyFile('Module.howto')) |
|
103 | 103 | debug(2, "copying of Module.howto failed\n"); |
104 | 104 | |
105 | 105 | // copy a fixed file from the module Files directory and saveunde a different name |
106 | - if( ! $this->copyFile('test_file','copied_test_file')) |
|
106 | + if (!$this->copyFile('test_file', 'copied_test_file')) |
|
107 | 107 | debug(2, "copying of Module.howto to copied_test_file failed\n"); |
108 | 108 | $this->dumpAttibutes('profile_attributes'); |
109 | - $installer_path = $this->zipInstaller($this->attributes); |
|
109 | + $installer_path = $this->zipInstaller($this->attributes); |
|
110 | 110 | return($installer_path); |
111 | 111 | } |
112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return string HTML text to be displayed in the information window |
117 | 117 | */ |
118 | 118 | public function writeDeviceInfo() { |
119 | - $ssid_ct=count($this->attributes['internal:SSID']); |
|
119 | + $ssid_ct = count($this->attributes['internal:SSID']); |
|
120 | 120 | $out = "<p>"; |
121 | 121 | $out .= _("This installer is an example only. It produces a zip file containig the IdP certificates, info and logo files (if such have been defined by the IdP administrator) and a dump of all available attributes."); |
122 | 122 | return $out; |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * return string |
131 | 131 | */ |
132 | 132 | private function zipInstaller($attr) { |
133 | - $e = $this->installerBasename.'.zip'; |
|
134 | - $o = system('zip -q '.$e.' *'); |
|
133 | + $e = $this->installerBasename . '.zip'; |
|
134 | + $o = system('zip -q ' . $e . ' *'); |
|
135 | 135 | return $e; |
136 | 136 | } |
137 | 137 |
@@ -99,12 +99,14 @@ |
||
99 | 99 | $CA_files = $this->saveCertificateFiles('der'); |
100 | 100 | |
101 | 101 | // copy a fixed file from the module Files directory |
102 | - if(! $this->copyFile('Module.howto')) |
|
103 | - debug(2, "copying of Module.howto failed\n"); |
|
102 | + if(! $this->copyFile('Module.howto')) { |
|
103 | + debug(2, "copying of Module.howto failed\n"); |
|
104 | + } |
|
104 | 105 | |
105 | 106 | // copy a fixed file from the module Files directory and saveunde a different name |
106 | - if( ! $this->copyFile('test_file','copied_test_file')) |
|
107 | - debug(2, "copying of Module.howto to copied_test_file failed\n"); |
|
107 | + if( ! $this->copyFile('test_file','copied_test_file')) { |
|
108 | + debug(2, "copying of Module.howto to copied_test_file failed\n"); |
|
109 | + } |
|
108 | 110 | $this->dumpAttibutes('profile_attributes'); |
109 | 111 | $installer_path = $this->zipInstaller($this->attributes); |
110 | 112 | return($installer_path); |
@@ -69,11 +69,19 @@ discard block |
||
69 | 69 | public function areAttributes() { |
70 | 70 | return empty($this->attributes)?0:1; |
71 | 71 | } |
72 | + |
|
73 | + /** |
|
74 | + * @param string $attribute |
|
75 | + */ |
|
72 | 76 | public function setAttribute($attribute,$value) { |
73 | 77 | if( ! isset($this->attributes)) |
74 | 78 | $this->attributes = []; |
75 | 79 | $this->attributes[$attribute] = $value; |
76 | 80 | } |
81 | + |
|
82 | + /** |
|
83 | + * @param string $property |
|
84 | + */ |
|
77 | 85 | public function setProperty($property,$value) { |
78 | 86 | $this->$property = $value; |
79 | 87 | } |
@@ -255,6 +263,10 @@ discard block |
||
255 | 263 | } |
256 | 264 | } |
257 | 265 | |
266 | +/** |
|
267 | + * @param SimpleXMLElement $node |
|
268 | + * @param EAPIdentityProvider $object |
|
269 | + */ |
|
258 | 270 | function marshalObject($node, $object) { |
259 | 271 | |
260 | 272 | $name = get_class($object); |
@@ -20,100 +20,100 @@ discard block |
||
20 | 20 | * base class extended by every element |
21 | 21 | */ |
22 | 22 | class XMLElement { |
23 | - private $attributes; |
|
24 | - private $value; |
|
23 | + private $attributes; |
|
24 | + private $value; |
|
25 | 25 | |
26 | - protected function getObjectVars($obj) { |
|
27 | - return get_object_vars($obj); |
|
28 | - } |
|
26 | + protected function getObjectVars($obj) { |
|
27 | + return get_object_vars($obj); |
|
28 | + } |
|
29 | 29 | /** |
30 | - * @var array $AuthMethodElements is used to limit |
|
31 | - * XML elements present within ServerSideCredentials and |
|
32 | - * ClientSideCredentials to ones which are relevant |
|
33 | - * for a given EAP method. |
|
34 | - * @var array of XLM element names which are allowed |
|
35 | - * EAP method names are defined in core/EAP.php |
|
36 | - */ |
|
37 | - public static $AuthMethodElements = [ |
|
38 | - 'server' => [ |
|
30 | + * @var array $AuthMethodElements is used to limit |
|
31 | + * XML elements present within ServerSideCredentials and |
|
32 | + * ClientSideCredentials to ones which are relevant |
|
33 | + * for a given EAP method. |
|
34 | + * @var array of XLM element names which are allowed |
|
35 | + * EAP method names are defined in core/EAP.php |
|
36 | + */ |
|
37 | + public static $AuthMethodElements = [ |
|
38 | + 'server' => [ |
|
39 | 39 | TLS => ['CA', 'ServerID'], |
40 | 40 | FAST => ['CA','ServerID'], |
41 | 41 | PEAP => ['CA','ServerID'], |
42 | 42 | TTLS => ['CA','ServerID'], |
43 | 43 | PWD => [], |
44 | - ], |
|
45 | - 'client' => [ |
|
46 | - TLS => ['UserName','Password','ClientCertificate'], |
|
47 | - MSCHAP2 => ['UserName','Password','OuterIdentity'], |
|
48 | - GTC => ['UserName','OneTimeToken'], |
|
49 | - NE_PAP => ['UserName','Password','OuterIdentity'], |
|
50 | - ] |
|
51 | - ]; |
|
44 | + ], |
|
45 | + 'client' => [ |
|
46 | + TLS => ['UserName','Password','ClientCertificate'], |
|
47 | + MSCHAP2 => ['UserName','Password','OuterIdentity'], |
|
48 | + GTC => ['UserName','OneTimeToken'], |
|
49 | + NE_PAP => ['UserName','Password','OuterIdentity'], |
|
50 | + ] |
|
51 | + ]; |
|
52 | 52 | |
53 | - public function __construct() { |
|
53 | + public function __construct() { |
|
54 | 54 | $this->attributes = []; |
55 | 55 | $this->value = []; |
56 | - } |
|
57 | - public function setAttributes($attributes) { |
|
56 | + } |
|
57 | + public function setAttributes($attributes) { |
|
58 | 58 | $this->attributes = $attributes; |
59 | - } |
|
60 | - public function getAttributes() { |
|
59 | + } |
|
60 | + public function getAttributes() { |
|
61 | 61 | return $this->attributes; |
62 | - } |
|
63 | - public function setValue($value) { |
|
62 | + } |
|
63 | + public function setValue($value) { |
|
64 | 64 | $this->value = $value; |
65 | - } |
|
66 | - public function getValue() { |
|
65 | + } |
|
66 | + public function getValue() { |
|
67 | 67 | return $this->value; |
68 | - } |
|
69 | - public function areAttributes() { |
|
68 | + } |
|
69 | + public function areAttributes() { |
|
70 | 70 | return empty($this->attributes)?0:1; |
71 | - } |
|
72 | - public function setAttribute($attribute,$value) { |
|
71 | + } |
|
72 | + public function setAttribute($attribute,$value) { |
|
73 | 73 | if( ! isset($this->attributes)) |
74 | - $this->attributes = []; |
|
74 | + $this->attributes = []; |
|
75 | 75 | $this->attributes[$attribute] = $value; |
76 | - } |
|
77 | - public function setProperty($property,$value) { |
|
76 | + } |
|
77 | + public function setProperty($property,$value) { |
|
78 | 78 | $this->$property = $value; |
79 | - } |
|
80 | - public function getAll() { |
|
79 | + } |
|
80 | + public function getAll() { |
|
81 | 81 | $elems = get_object_vars($this); |
82 | 82 | $objvars = []; |
83 | 83 | foreach ($elems as $key=>$val) |
84 | - if ( ($key!='attributes') && ($key!='value') ) |
|
84 | + if ( ($key!='attributes') && ($key!='value') ) |
|
85 | 85 | $objvars[$key] = $val; |
86 | 86 | return $objvars; |
87 | - } |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | class EAPIdentityProvider extends XMLElement { |
90 | - protected $ValidUntil; |
|
91 | - protected $AuthenticationMethods; |
|
92 | - protected $ProviderInfo; |
|
93 | - protected $VendorSpecific; |
|
90 | + protected $ValidUntil; |
|
91 | + protected $AuthenticationMethods; |
|
92 | + protected $ProviderInfo; |
|
93 | + protected $VendorSpecific; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | class AuthenticationMethods extends XMLElement { |
97 | - protected $AuthenticationMethod; |
|
97 | + protected $AuthenticationMethod; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | class AuthenticationMethod extends XMLElement { |
101 | - protected $EAPMethod; |
|
102 | - protected $ServerSideCredential; |
|
103 | - protected $ClientSideCredential; |
|
104 | - protected $InnerAuthenticationMethod; |
|
101 | + protected $EAPMethod; |
|
102 | + protected $ServerSideCredential; |
|
103 | + protected $ClientSideCredential; |
|
104 | + protected $InnerAuthenticationMethod; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | class EAPMethod extends XMLElement { |
108 | - protected $Type; |
|
109 | - protected $TypeSpecific; |
|
110 | - protected $VendorSpecific; |
|
108 | + protected $Type; |
|
109 | + protected $TypeSpecific; |
|
110 | + protected $VendorSpecific; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | class NonEAPAuthMethod extends XMLElement { |
114 | - protected $Type; |
|
115 | - protected $TypeSpecific; |
|
116 | - protected $VendorSpecific; |
|
114 | + protected $Type; |
|
115 | + protected $TypeSpecific; |
|
116 | + protected $VendorSpecific; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | class Type extends XMLElement { |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | class ServerSideCredential extends XMLElement { |
129 | - protected $CA; // multi |
|
130 | - protected $ServerID; //multi |
|
131 | - public function getAll() { |
|
129 | + protected $CA; // multi |
|
130 | + protected $ServerID; //multi |
|
131 | + public function getAll() { |
|
132 | 132 | if(isset(XMLElement::$AuthMethodElements['server'][$this->EAPType]) && XMLElement::$AuthMethodElements['server'][$this->EAPType]) { |
133 | 133 | $E = XMLElement::$AuthMethodElements['server'][$this->EAPType]; |
134 | 134 | $out = get_object_vars($this); |
135 | 135 | $OUT = []; |
136 | 136 | foreach ($out as $o => $v) { |
137 | - if(in_array($o, $E)) |
|
138 | - $OUT[$o] = $v; |
|
137 | + if(in_array($o, $E)) |
|
138 | + $OUT[$o] = $v; |
|
139 | 139 | } |
140 | 140 | return($OUT); |
141 | - } |
|
142 | - } |
|
141 | + } |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | class ServerID extends XMLElement { |
146 | 146 | } |
147 | 147 | |
148 | 148 | class ClientSideCredential extends XMLElement { |
149 | - protected $OuterIdentity; |
|
150 | - protected $UserName; |
|
151 | - protected $Password; |
|
152 | - protected $ClientCertificate; |
|
153 | - protected $Passphrase; |
|
154 | - protected $PAC; |
|
155 | - protected $ProvisionPAC; |
|
156 | - public function getAll() { |
|
149 | + protected $OuterIdentity; |
|
150 | + protected $UserName; |
|
151 | + protected $Password; |
|
152 | + protected $ClientCertificate; |
|
153 | + protected $Passphrase; |
|
154 | + protected $PAC; |
|
155 | + protected $ProvisionPAC; |
|
156 | + public function getAll() { |
|
157 | 157 | if(isset(XMLElement::$AuthMethodElements['client'][$this->EAPType]) && XMLElement::$AuthMethodElements['client'][$this->EAPType]) { |
158 | 158 | $E = XMLElement::$AuthMethodElements['client'][$this->EAPType]; |
159 | 159 | $out = get_object_vars($this); |
@@ -161,31 +161,31 @@ discard block |
||
161 | 161 | debug(4,"EEE:".$this->EAPType.":\n"); |
162 | 162 | debug(4,$E); |
163 | 163 | foreach ($out as $o => $v) { |
164 | - if(in_array($o, $E)) |
|
165 | - $OUT[$o] = $v; |
|
164 | + if(in_array($o, $E)) |
|
165 | + $OUT[$o] = $v; |
|
166 | 166 | } |
167 | 167 | return($OUT); |
168 | 168 | } |
169 | - } |
|
169 | + } |
|
170 | 170 | } |
171 | 171 | class ClientCertificate extends XMLElement { |
172 | 172 | } |
173 | 173 | class CA extends XMLElement { |
174 | 174 | } |
175 | 175 | class InnerAuthenticationMethod extends XMLElement { |
176 | - protected $EAPMethod; |
|
177 | - protected $NonEAPAuthMethod; |
|
178 | - protected $ServerSideCredential; |
|
179 | - protected $ClientSideCredential; |
|
176 | + protected $EAPMethod; |
|
177 | + protected $NonEAPAuthMethod; |
|
178 | + protected $ServerSideCredential; |
|
179 | + protected $ClientSideCredential; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | class ProviderInfo extends XMLElement { |
183 | - protected $DisplayName; |
|
184 | - protected $Description; |
|
185 | - protected $ProviderLocation; |
|
186 | - protected $ProviderLogo; |
|
187 | - protected $TermsOfUse; |
|
188 | - protected $Helpdesk; |
|
183 | + protected $DisplayName; |
|
184 | + protected $Description; |
|
185 | + protected $ProviderLocation; |
|
186 | + protected $ProviderLogo; |
|
187 | + protected $TermsOfUse; |
|
188 | + protected $Helpdesk; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | class DisplayName extends XMLElement { |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | class ProviderLocation extends XMLElement { |
198 | - protected $Longitude; |
|
199 | - protected $Latitude; |
|
198 | + protected $Longitude; |
|
199 | + protected $Latitude; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | class ProviderLogo extends XMLElement { |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | class Helpdesk extends XMLElement { |
209 | - protected $EmailAddress; |
|
210 | - protected $WebAddress; |
|
211 | - protected $Phone; |
|
209 | + protected $EmailAddress; |
|
210 | + protected $WebAddress; |
|
211 | + protected $Phone; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | class EmailAddress extends XMLElement { |
@@ -242,61 +242,61 @@ discard block |
||
242 | 242 | |
243 | 243 | */ |
244 | 244 | function SimpleXMLElement_append($key, $value) { |
245 | - if (trim((string) $value) == '') { |
|
245 | + if (trim((string) $value) == '') { |
|
246 | 246 | $element = $key->addChild($value->getName()); |
247 | 247 | foreach ($value->attributes() as $attKey => $attValue) { |
248 | - $element->addAttribute($attKey, $attValue); |
|
248 | + $element->addAttribute($attKey, $attValue); |
|
249 | 249 | } |
250 | 250 | foreach ($value->children() as $child) { |
251 | - SimpleXMLElement_append($element, $child); |
|
251 | + SimpleXMLElement_append($element, $child); |
|
252 | 252 | } |
253 | - } else { |
|
253 | + } else { |
|
254 | 254 | $element = $key->addChild($value->getName(), trim((string) $value)); |
255 | - } |
|
255 | + } |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | function marshalObject($node, $object) { |
259 | 259 | |
260 | - $name = get_class($object); |
|
261 | - $name = preg_replace("/_/", "-", $name); |
|
262 | - if ($object->getValue()) $val = $object->getValue(); |
|
263 | - else $val = ''; |
|
264 | - $simplexmlelement = ''; |
|
265 | - if ($val instanceof SimpleXMLElement) { |
|
260 | + $name = get_class($object); |
|
261 | + $name = preg_replace("/_/", "-", $name); |
|
262 | + if ($object->getValue()) $val = $object->getValue(); |
|
263 | + else $val = ''; |
|
264 | + $simplexmlelement = ''; |
|
265 | + if ($val instanceof SimpleXMLElement) { |
|
266 | 266 | $simplexmlelement = $val; |
267 | 267 | $val = ''; |
268 | - } |
|
269 | - if ($val) { |
|
268 | + } |
|
269 | + if ($val) { |
|
270 | 270 | if(getType($val) == 'string') |
271 | - $val = preg_replace('/&/','&',$val); |
|
271 | + $val = preg_replace('/&/','&',$val); |
|
272 | 272 | $node = $node->addChild($name, $val); |
273 | - } |
|
274 | - else |
|
273 | + } |
|
274 | + else |
|
275 | 275 | $node = $node->addChild($name); |
276 | - if ($object->areAttributes()) { |
|
276 | + if ($object->areAttributes()) { |
|
277 | 277 | $attrs = $object->getAttributes(); |
278 | 278 | foreach ($attrs as $attrt=>$attrv) |
279 | - $node->addAttribute($attrt, $attrv); |
|
280 | - } |
|
281 | - if ($simplexmlelement == '') { |
|
279 | + $node->addAttribute($attrt, $attrv); |
|
280 | + } |
|
281 | + if ($simplexmlelement == '') { |
|
282 | 282 | $fields = $object->getAll(); |
283 | 283 | if (!empty($fields)) { |
284 | - foreach ($fields as $name=>$value) { |
|
284 | + foreach ($fields as $name=>$value) { |
|
285 | 285 | if (getType($value)=='string' || getType($value)=='integer' || getType($value)=='double') { |
286 | - $node->addChild($name, $value); |
|
286 | + $node->addChild($name, $value); |
|
287 | 287 | } else { |
288 | - if (getType($value)=='array') { |
|
288 | + if (getType($value)=='array') { |
|
289 | 289 | foreach ($value as $v) |
290 | - if (is_object($v)) |
|
290 | + if (is_object($v)) |
|
291 | 291 | marshalObject($node, $v); |
292 | - } else if (getType($value)=='object') { |
|
292 | + } else if (getType($value)=='object') { |
|
293 | 293 | marshalObject($node, $value); |
294 | - } |
|
294 | + } |
|
295 | + } |
|
295 | 296 | } |
296 | - } |
|
297 | 297 | } |
298 | - } else { |
|
298 | + } else { |
|
299 | 299 | SimpleXMLElement_append($node, $simplexmlelement); |
300 | - } |
|
300 | + } |
|
301 | 301 | } |
302 | 302 |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * @var array of XLM element names which are allowed |
35 | 35 | * EAP method names are defined in core/EAP.php |
36 | 36 | */ |
37 | - public static $AuthMethodElements = [ |
|
37 | + public static $AuthMethodElements = [ |
|
38 | 38 | 'server' => [ |
39 | 39 | TLS => ['CA', 'ServerID'], |
40 | - FAST => ['CA','ServerID'], |
|
41 | - PEAP => ['CA','ServerID'], |
|
42 | - TTLS => ['CA','ServerID'], |
|
40 | + FAST => ['CA', 'ServerID'], |
|
41 | + PEAP => ['CA', 'ServerID'], |
|
42 | + TTLS => ['CA', 'ServerID'], |
|
43 | 43 | PWD => [], |
44 | 44 | ], |
45 | 45 | 'client' => [ |
46 | - TLS => ['UserName','Password','ClientCertificate'], |
|
47 | - MSCHAP2 => ['UserName','Password','OuterIdentity'], |
|
48 | - GTC => ['UserName','OneTimeToken'], |
|
49 | - NE_PAP => ['UserName','Password','OuterIdentity'], |
|
46 | + TLS => ['UserName', 'Password', 'ClientCertificate'], |
|
47 | + MSCHAP2 => ['UserName', 'Password', 'OuterIdentity'], |
|
48 | + GTC => ['UserName', 'OneTimeToken'], |
|
49 | + NE_PAP => ['UserName', 'Password', 'OuterIdentity'], |
|
50 | 50 | ] |
51 | 51 | ]; |
52 | 52 | |
@@ -67,21 +67,21 @@ discard block |
||
67 | 67 | return $this->value; |
68 | 68 | } |
69 | 69 | public function areAttributes() { |
70 | - return empty($this->attributes)?0:1; |
|
70 | + return empty($this->attributes) ? 0 : 1; |
|
71 | 71 | } |
72 | - public function setAttribute($attribute,$value) { |
|
73 | - if( ! isset($this->attributes)) |
|
72 | + public function setAttribute($attribute, $value) { |
|
73 | + if (!isset($this->attributes)) |
|
74 | 74 | $this->attributes = []; |
75 | 75 | $this->attributes[$attribute] = $value; |
76 | 76 | } |
77 | - public function setProperty($property,$value) { |
|
77 | + public function setProperty($property, $value) { |
|
78 | 78 | $this->$property = $value; |
79 | 79 | } |
80 | 80 | public function getAll() { |
81 | 81 | $elems = get_object_vars($this); |
82 | 82 | $objvars = []; |
83 | 83 | foreach ($elems as $key=>$val) |
84 | - if ( ($key!='attributes') && ($key!='value') ) |
|
84 | + if (($key != 'attributes') && ($key != 'value')) |
|
85 | 85 | $objvars[$key] = $val; |
86 | 86 | return $objvars; |
87 | 87 | } |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | protected $CA; // multi |
130 | 130 | protected $ServerID; //multi |
131 | 131 | public function getAll() { |
132 | - if(isset(XMLElement::$AuthMethodElements['server'][$this->EAPType]) && XMLElement::$AuthMethodElements['server'][$this->EAPType]) { |
|
132 | + if (isset(XMLElement::$AuthMethodElements['server'][$this->EAPType]) && XMLElement::$AuthMethodElements['server'][$this->EAPType]) { |
|
133 | 133 | $E = XMLElement::$AuthMethodElements['server'][$this->EAPType]; |
134 | 134 | $out = get_object_vars($this); |
135 | 135 | $OUT = []; |
136 | 136 | foreach ($out as $o => $v) { |
137 | - if(in_array($o, $E)) |
|
137 | + if (in_array($o, $E)) |
|
138 | 138 | $OUT[$o] = $v; |
139 | 139 | } |
140 | 140 | return($OUT); |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | protected $PAC; |
155 | 155 | protected $ProvisionPAC; |
156 | 156 | public function getAll() { |
157 | - if(isset(XMLElement::$AuthMethodElements['client'][$this->EAPType]) && XMLElement::$AuthMethodElements['client'][$this->EAPType]) { |
|
157 | + if (isset(XMLElement::$AuthMethodElements['client'][$this->EAPType]) && XMLElement::$AuthMethodElements['client'][$this->EAPType]) { |
|
158 | 158 | $E = XMLElement::$AuthMethodElements['client'][$this->EAPType]; |
159 | 159 | $out = get_object_vars($this); |
160 | 160 | $OUT = []; |
161 | -debug(4,"EEE:".$this->EAPType.":\n"); |
|
162 | -debug(4,$E); |
|
161 | +debug(4, "EEE:" . $this->EAPType . ":\n"); |
|
162 | +debug(4, $E); |
|
163 | 163 | foreach ($out as $o => $v) { |
164 | - if(in_array($o, $E)) |
|
164 | + if (in_array($o, $E)) |
|
165 | 165 | $OUT[$o] = $v; |
166 | 166 | } |
167 | 167 | return($OUT); |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $val = ''; |
268 | 268 | } |
269 | 269 | if ($val) { |
270 | - if(getType($val) == 'string') |
|
271 | - $val = preg_replace('/&/','&',$val); |
|
270 | + if (getType($val) == 'string') |
|
271 | + $val = preg_replace('/&/', '&', $val); |
|
272 | 272 | $node = $node->addChild($name, $val); |
273 | 273 | } |
274 | 274 | else |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | $fields = $object->getAll(); |
283 | 283 | if (!empty($fields)) { |
284 | 284 | foreach ($fields as $name=>$value) { |
285 | - if (getType($value)=='string' || getType($value)=='integer' || getType($value)=='double') { |
|
285 | + if (getType($value) == 'string' || getType($value) == 'integer' || getType($value) == 'double') { |
|
286 | 286 | $node->addChild($name, $value); |
287 | 287 | } else { |
288 | - if (getType($value)=='array') { |
|
288 | + if (getType($value) == 'array') { |
|
289 | 289 | foreach ($value as $v) |
290 | 290 | if (is_object($v)) |
291 | 291 | marshalObject($node, $v); |
292 | - } else if (getType($value)=='object') { |
|
292 | + } else if (getType($value) == 'object') { |
|
293 | 293 | marshalObject($node, $value); |
294 | 294 | } |
295 | 295 | } |
@@ -70,8 +70,9 @@ discard block |
||
70 | 70 | return empty($this->attributes)?0:1; |
71 | 71 | } |
72 | 72 | public function setAttribute($attribute,$value) { |
73 | - if( ! isset($this->attributes)) |
|
74 | - $this->attributes = []; |
|
73 | + if( ! isset($this->attributes)) { |
|
74 | + $this->attributes = []; |
|
75 | + } |
|
75 | 76 | $this->attributes[$attribute] = $value; |
76 | 77 | } |
77 | 78 | public function setProperty($property,$value) { |
@@ -80,9 +81,10 @@ discard block |
||
80 | 81 | public function getAll() { |
81 | 82 | $elems = get_object_vars($this); |
82 | 83 | $objvars = []; |
83 | - foreach ($elems as $key=>$val) |
|
84 | - if ( ($key!='attributes') && ($key!='value') ) |
|
84 | + foreach ($elems as $key=>$val) { |
|
85 | + if ( ($key!='attributes') && ($key!='value') ) |
|
85 | 86 | $objvars[$key] = $val; |
87 | + } |
|
86 | 88 | return $objvars; |
87 | 89 | } |
88 | 90 | } |
@@ -134,8 +136,9 @@ discard block |
||
134 | 136 | $out = get_object_vars($this); |
135 | 137 | $OUT = []; |
136 | 138 | foreach ($out as $o => $v) { |
137 | - if(in_array($o, $E)) |
|
138 | - $OUT[$o] = $v; |
|
139 | + if(in_array($o, $E)) { |
|
140 | + $OUT[$o] = $v; |
|
141 | + } |
|
139 | 142 | } |
140 | 143 | return($OUT); |
141 | 144 | } |
@@ -161,8 +164,9 @@ discard block |
||
161 | 164 | debug(4,"EEE:".$this->EAPType.":\n"); |
162 | 165 | debug(4,$E); |
163 | 166 | foreach ($out as $o => $v) { |
164 | - if(in_array($o, $E)) |
|
165 | - $OUT[$o] = $v; |
|
167 | + if(in_array($o, $E)) { |
|
168 | + $OUT[$o] = $v; |
|
169 | + } |
|
166 | 170 | } |
167 | 171 | return($OUT); |
168 | 172 | } |
@@ -259,24 +263,29 @@ discard block |
||
259 | 263 | |
260 | 264 | $name = get_class($object); |
261 | 265 | $name = preg_replace("/_/", "-", $name); |
262 | - if ($object->getValue()) $val = $object->getValue(); |
|
263 | - else $val = ''; |
|
266 | + if ($object->getValue()) { |
|
267 | + $val = $object->getValue(); |
|
268 | + } else { |
|
269 | + $val = ''; |
|
270 | + } |
|
264 | 271 | $simplexmlelement = ''; |
265 | 272 | if ($val instanceof SimpleXMLElement) { |
266 | 273 | $simplexmlelement = $val; |
267 | 274 | $val = ''; |
268 | 275 | } |
269 | 276 | if ($val) { |
270 | - if(getType($val) == 'string') |
|
271 | - $val = preg_replace('/&/','&',$val); |
|
277 | + if(getType($val) == 'string') { |
|
278 | + $val = preg_replace('/&/','&',$val); |
|
279 | + } |
|
272 | 280 | $node = $node->addChild($name, $val); |
273 | - } |
|
274 | - else |
|
275 | - $node = $node->addChild($name); |
|
281 | + } else { |
|
282 | + $node = $node->addChild($name); |
|
283 | + } |
|
276 | 284 | if ($object->areAttributes()) { |
277 | 285 | $attrs = $object->getAttributes(); |
278 | - foreach ($attrs as $attrt=>$attrv) |
|
279 | - $node->addAttribute($attrt, $attrv); |
|
286 | + foreach ($attrs as $attrt=>$attrv) { |
|
287 | + $node->addAttribute($attrt, $attrv); |
|
288 | + } |
|
280 | 289 | } |
281 | 290 | if ($simplexmlelement == '') { |
282 | 291 | $fields = $object->getAll(); |
@@ -286,9 +295,10 @@ discard block |
||
286 | 295 | $node->addChild($name, $value); |
287 | 296 | } else { |
288 | 297 | if (getType($value)=='array') { |
289 | - foreach ($value as $v) |
|
290 | - if (is_object($v)) |
|
298 | + foreach ($value as $v) { |
|
299 | + if (is_object($v)) |
|
291 | 300 | marshalObject($node, $v); |
301 | + } |
|
292 | 302 | } else if (getType($value)=='object') { |
293 | 303 | marshalObject($node, $value); |
294 | 304 | } |
@@ -129,6 +129,9 @@ |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | +/** |
|
133 | + * @param string $attr_name |
|
134 | + */ |
|
132 | 135 | private function getSimpleMLAttribute($attr_name) { |
133 | 136 | if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
134 | 137 | $a = $this->attributes[$attr_name]; |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | require_once('XML.inc.php'); |
23 | 23 | |
24 | 24 | /** |
25 | - * This class implements full functionality of the generic XML device |
|
26 | - * the only fuction of the extenstions of this class is to specify |
|
27 | - * supported EAP methods. |
|
28 | - * Instead of specifying supported EAPS an extension can set $all_eaps to true |
|
29 | - * this will cause the installer to configure all EAP methods supported by |
|
30 | - * the current profile and declared by the given device. |
|
31 | - */ |
|
25 | + * This class implements full functionality of the generic XML device |
|
26 | + * the only fuction of the extenstions of this class is to specify |
|
27 | + * supported EAP methods. |
|
28 | + * Instead of specifying supported EAPS an extension can set $all_eaps to true |
|
29 | + * this will cause the installer to configure all EAP methods supported by |
|
30 | + * the current profile and declared by the given device. |
|
31 | + */ |
|
32 | 32 | abstract class Device_XML extends DeviceConfig { |
33 | 33 | |
34 | 34 | /** |
@@ -62,29 +62,29 @@ discard block |
||
62 | 62 | //lang attribute |
63 | 63 | $authmethods = []; |
64 | 64 | if($this->all_eaps) { |
65 | - $EAPs = []; |
|
66 | - foreach ($attr['all_eaps'] as $eap) { |
|
67 | - if(in_array($eap, $this->supportedEapMethods)) |
|
65 | + $EAPs = []; |
|
66 | + foreach ($attr['all_eaps'] as $eap) { |
|
67 | + if(in_array($eap, $this->supportedEapMethods)) |
|
68 | 68 | $EAPs[] = $eap; |
69 | - } |
|
69 | + } |
|
70 | 70 | } else |
71 | - $EAPs = [ $this->selected_eap]; |
|
71 | + $EAPs = [ $this->selected_eap]; |
|
72 | 72 | |
73 | 73 | foreach ($EAPs as $eap) { |
74 | - $authmethods[] = $this->getAuthMethod($eap); |
|
74 | + $authmethods[] = $this->getAuthMethod($eap); |
|
75 | 75 | } |
76 | 76 | $authenticationmethods = new AuthenticationMethods(); |
77 | 77 | $authenticationmethods->setProperty('AuthenticationMethods',$authmethods); |
78 | 78 | $eap_idp->setProperty('AuthenticationMethods',$authenticationmethods); |
79 | 79 | if(empty($attr['internal:realm'][0])) { |
80 | - $eap_idp->setAttribute('ID','undefined'); |
|
81 | - $eap_idp->setAttribute('namespace','urn:undefined'); |
|
80 | + $eap_idp->setAttribute('ID','undefined'); |
|
81 | + $eap_idp->setAttribute('namespace','urn:undefined'); |
|
82 | 82 | } else { |
83 | - $eap_idp->setAttribute('ID',$attr['internal:realm'][0]); |
|
84 | - $eap_idp->setAttribute('namespace',$NAMESPACE); |
|
83 | + $eap_idp->setAttribute('ID',$attr['internal:realm'][0]); |
|
84 | + $eap_idp->setAttribute('namespace',$NAMESPACE); |
|
85 | 85 | } |
86 | 86 | if($this->lang_scope === 'single') |
87 | - $eap_idp->setAttribute('lang',$this->lang_index); |
|
87 | + $eap_idp->setAttribute('lang',$this->lang_index); |
|
88 | 88 | $eap_idp->setAttribute('version','1'); |
89 | 89 | |
90 | 90 | |
@@ -105,235 +105,235 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | private $AttributeNames = [ |
108 | - 'support:email' => 'EmailAddress', |
|
109 | - 'support:url' => 'WebAddress', |
|
110 | - 'support:phone' => 'Phone', |
|
111 | - 'profile:description' => 'Description', |
|
112 | - 'support:info_file' => 'TermsOfUse', |
|
113 | - 'general:logo_file' => 'ProviderLogo', |
|
108 | + 'support:email' => 'EmailAddress', |
|
109 | + 'support:url' => 'WebAddress', |
|
110 | + 'support:phone' => 'Phone', |
|
111 | + 'profile:description' => 'Description', |
|
112 | + 'support:info_file' => 'TermsOfUse', |
|
113 | + 'general:logo_file' => 'ProviderLogo', |
|
114 | 114 | ]; |
115 | 115 | |
116 | 116 | private function getSimpleAttribute($attr_name) { |
117 | - if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
118 | - $a = $this->attributes[$attr_name]; |
|
119 | - if(! isset($this->AttributeNames[$attr_name])) { |
|
120 | - debug(4,"Missing class definition for $attr_name\n"); |
|
121 | - return; |
|
122 | - } |
|
123 | - $class_name = $this->AttributeNames[$attr_name]; |
|
124 | - $obj = new $class_name(); |
|
125 | - $obj->setValue($a[0]); |
|
126 | - return($obj); |
|
127 | - } else |
|
128 | - return ''; |
|
117 | + if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
118 | + $a = $this->attributes[$attr_name]; |
|
119 | + if(! isset($this->AttributeNames[$attr_name])) { |
|
120 | + debug(4,"Missing class definition for $attr_name\n"); |
|
121 | + return; |
|
122 | + } |
|
123 | + $class_name = $this->AttributeNames[$attr_name]; |
|
124 | + $obj = new $class_name(); |
|
125 | + $obj->setValue($a[0]); |
|
126 | + return($obj); |
|
127 | + } else |
|
128 | + return ''; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | private function getSimpleMLAttribute($attr_name) { |
133 | - if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
134 | - $a = $this->attributes[$attr_name]; |
|
135 | - if(! isset($this->AttributeNames[$attr_name])) { |
|
136 | - debug(4,"Missing class definition for $attr_name\n"); |
|
137 | - return; |
|
138 | - } |
|
139 | - $class_name = $this->AttributeNames[$attr_name]; |
|
140 | - $objs = []; |
|
141 | - if($this->lang_scope === 'global') { |
|
142 | - foreach( $a['langs'] as $l => $v ) { |
|
133 | + if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
134 | + $a = $this->attributes[$attr_name]; |
|
135 | + if(! isset($this->AttributeNames[$attr_name])) { |
|
136 | + debug(4,"Missing class definition for $attr_name\n"); |
|
137 | + return; |
|
138 | + } |
|
139 | + $class_name = $this->AttributeNames[$attr_name]; |
|
140 | + $objs = []; |
|
141 | + if($this->lang_scope === 'global') { |
|
142 | + foreach( $a['langs'] as $l => $v ) { |
|
143 | 143 | $l = ( $l === 'C' ? 'any' : $l ); |
144 | 144 | $obj = new $class_name(); |
145 | 145 | $obj->setValue($v); |
146 | 146 | $obj->setAttributes(['lang' => $l]); |
147 | 147 | $objs[] = $obj; |
148 | - } |
|
149 | - } else { |
|
150 | - $obj = new $class_name(); |
|
151 | - $obj->setValue($a[0]); |
|
152 | - $objs[] = $obj; |
|
153 | - } |
|
154 | - |
|
155 | - return($objs); |
|
156 | - } else |
|
157 | - return ''; |
|
148 | + } |
|
149 | + } else { |
|
150 | + $obj = new $class_name(); |
|
151 | + $obj->setValue($a[0]); |
|
152 | + $objs[] = $obj; |
|
153 | + } |
|
154 | + |
|
155 | + return($objs); |
|
156 | + } else |
|
157 | + return ''; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getDisplayName() { |
161 | - $attr = $this->attributes; |
|
162 | - $objs = []; |
|
163 | - if($this->lang_scope === 'global') { |
|
164 | - $I = $attr['general:instname']['langs']; |
|
165 | - if($attr['internal:profile_count'][0] > 1) |
|
161 | + $attr = $this->attributes; |
|
162 | + $objs = []; |
|
163 | + if($this->lang_scope === 'global') { |
|
164 | + $I = $attr['general:instname']['langs']; |
|
165 | + if($attr['internal:profile_count'][0] > 1) |
|
166 | 166 | $P = $attr['profile:name']['langs']; |
167 | - foreach( $I as $l => $v ) { |
|
167 | + foreach( $I as $l => $v ) { |
|
168 | 168 | $l = ( $l === 'C' ? 'any' : $l ); |
169 | 169 | $displayname = new DisplayName(); |
170 | 170 | if(isset($P)) { |
171 | - $p = isset($P[$l]) ? $P[$l] : $P['C']; |
|
172 | - $v .= ' - '. $p; |
|
171 | + $p = isset($P[$l]) ? $P[$l] : $P['C']; |
|
172 | + $v .= ' - '. $p; |
|
173 | 173 | } |
174 | 174 | $displayname->setValue($v); |
175 | 175 | $displayname->setAttributes(['lang' => $l]); |
176 | 176 | $objs[] = $displayname; |
177 | - } |
|
178 | - } else { |
|
179 | - $displayname = new DisplayName(); |
|
180 | - $v = $attr['general:instname'][0]; |
|
181 | - if($attr['internal:profile_count'][0] > 1) |
|
182 | - $v .= ' - '.$attr['profile:name'][0]; |
|
183 | - $displayname->setValue($v); |
|
184 | - $objs[] = $displayname; |
|
185 | - } |
|
186 | - return $objs; |
|
177 | + } |
|
178 | + } else { |
|
179 | + $displayname = new DisplayName(); |
|
180 | + $v = $attr['general:instname'][0]; |
|
181 | + if($attr['internal:profile_count'][0] > 1) |
|
182 | + $v .= ' - '.$attr['profile:name'][0]; |
|
183 | + $displayname->setValue($v); |
|
184 | + $objs[] = $displayname; |
|
185 | + } |
|
186 | + return $objs; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | private function getProviderLogo() { |
190 | - $attr = $this->attributes; |
|
191 | - if(isset($attr['general:logo_file'][0])){ |
|
192 | - $logo_string = base64_encode($attr['general:logo_file'][0]); |
|
193 | - $logo_mime = 'image/'.$attr['internal:logo_file'][0]['mime']; |
|
194 | - $providerlogo = new ProviderLogo(); |
|
195 | - $providerlogo->setAttributes(['mime'=>$logo_mime, 'encoding'=>'base64']); |
|
196 | - $providerlogo->setValue($logo_string); |
|
197 | - return $providerlogo; |
|
198 | - } |
|
190 | + $attr = $this->attributes; |
|
191 | + if(isset($attr['general:logo_file'][0])){ |
|
192 | + $logo_string = base64_encode($attr['general:logo_file'][0]); |
|
193 | + $logo_mime = 'image/'.$attr['internal:logo_file'][0]['mime']; |
|
194 | + $providerlogo = new ProviderLogo(); |
|
195 | + $providerlogo->setAttributes(['mime'=>$logo_mime, 'encoding'=>'base64']); |
|
196 | + $providerlogo->setValue($logo_string); |
|
197 | + return $providerlogo; |
|
198 | + } |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | private function getProviderInfo() { |
202 | - $providerinfo = new ProviderInfo(); |
|
203 | - $providerinfo->setProperty('DisplayName',$this->getDisplayName()); |
|
204 | - $providerinfo->setProperty('Description',$this->getSimpleMLAttribute('profile:description')); |
|
205 | - $providerinfo->setProperty('ProviderLocation',$this->getProvideLocation()); |
|
206 | - $providerinfo->setProperty('ProviderLogo',$this->getProviderLogo()); |
|
207 | - $providerinfo->setProperty('TermsOfUse',$this->getSimpleMLAttribute('support:info_file')); |
|
208 | - $providerinfo->setProperty('Helpdesk',$this->getHelpdesk()); |
|
209 | - return $providerinfo; |
|
202 | + $providerinfo = new ProviderInfo(); |
|
203 | + $providerinfo->setProperty('DisplayName',$this->getDisplayName()); |
|
204 | + $providerinfo->setProperty('Description',$this->getSimpleMLAttribute('profile:description')); |
|
205 | + $providerinfo->setProperty('ProviderLocation',$this->getProvideLocation()); |
|
206 | + $providerinfo->setProperty('ProviderLogo',$this->getProviderLogo()); |
|
207 | + $providerinfo->setProperty('TermsOfUse',$this->getSimpleMLAttribute('support:info_file')); |
|
208 | + $providerinfo->setProperty('Helpdesk',$this->getHelpdesk()); |
|
209 | + return $providerinfo; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | private function getProvideLocation() { |
213 | - $attr = $this->attributes; |
|
214 | - if(isset($attr['general:geo_coordinates'])){ |
|
215 | - $at = $attr['general:geo_coordinates']; |
|
216 | - if (count($at) > 1) { |
|
217 | - $at1 = []; |
|
218 | - foreach ($at as $a) { |
|
219 | - $providerlocation = new ProviderLocation(); |
|
220 | - $b = unserialize($a); |
|
221 | - $providerlocation->setProperty('Longitude',$b['lon']); |
|
222 | - $providerlocation->setProperty('Latitude',$b['lat']); |
|
223 | - $at1[] = $providerlocation; |
|
224 | - } |
|
225 | - } |
|
226 | - else { |
|
227 | - $providerlocation = new ProviderLocation(); |
|
228 | - $b = unserialize($at[0]); |
|
229 | - $providerlocation->setProperty('Longitude',$b['lon']); |
|
230 | - $providerlocation->setProperty('Latitude',$b['lat']); |
|
231 | - $at1 = $providerlocation; |
|
232 | - } |
|
233 | - return$at1; |
|
213 | + $attr = $this->attributes; |
|
214 | + if(isset($attr['general:geo_coordinates'])){ |
|
215 | + $at = $attr['general:geo_coordinates']; |
|
216 | + if (count($at) > 1) { |
|
217 | + $at1 = []; |
|
218 | + foreach ($at as $a) { |
|
219 | + $providerlocation = new ProviderLocation(); |
|
220 | + $b = unserialize($a); |
|
221 | + $providerlocation->setProperty('Longitude',$b['lon']); |
|
222 | + $providerlocation->setProperty('Latitude',$b['lat']); |
|
223 | + $at1[] = $providerlocation; |
|
224 | + } |
|
225 | + } |
|
226 | + else { |
|
227 | + $providerlocation = new ProviderLocation(); |
|
228 | + $b = unserialize($at[0]); |
|
229 | + $providerlocation->setProperty('Longitude',$b['lon']); |
|
230 | + $providerlocation->setProperty('Latitude',$b['lat']); |
|
231 | + $at1 = $providerlocation; |
|
232 | + } |
|
233 | + return$at1; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | 237 | private function getHelpdesk() { |
238 | - $helpdesk = new Helpdesk(); |
|
239 | - $helpdesk->setProperty('EmailAddress',$this->getSimpleMLAttribute('support:email')); |
|
240 | - $helpdesk->setProperty('WebAddress',$this->getSimpleMLAttribute('support:url')); |
|
241 | - $helpdesk->setProperty('Phone',$this->getSimpleMLAttribute('support:phone')); |
|
242 | - return $helpdesk; |
|
238 | + $helpdesk = new Helpdesk(); |
|
239 | + $helpdesk->setProperty('EmailAddress',$this->getSimpleMLAttribute('support:email')); |
|
240 | + $helpdesk->setProperty('WebAddress',$this->getSimpleMLAttribute('support:url')); |
|
241 | + $helpdesk->setProperty('Phone',$this->getSimpleMLAttribute('support:phone')); |
|
242 | + return $helpdesk; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | private function getCompatibleUses() { |
246 | - $SSIDs = $this->attributes['internal:SSID']; |
|
247 | - $compatibleuses = new CompatibleUses(); |
|
248 | - $ieee80211s = []; |
|
249 | - foreach ($SSIDs as $ssid => $ciph) { |
|
250 | - $ieee80211 = new IEEE80211(); |
|
251 | - $ieee80211->setProperty('SSID',$ssid); |
|
252 | - $ieee80211->setProperty('MinRSNProto', $ciph == 'AES' ? 'CCMP' : 'TKIP'); |
|
253 | - $ieee80211s[] = $ieee80211; |
|
254 | - } |
|
255 | - $compatibleuses->setProperty('IEEE80211',$ieee80211s); |
|
246 | + $SSIDs = $this->attributes['internal:SSID']; |
|
247 | + $compatibleuses = new CompatibleUses(); |
|
248 | + $ieee80211s = []; |
|
249 | + foreach ($SSIDs as $ssid => $ciph) { |
|
250 | + $ieee80211 = new IEEE80211(); |
|
251 | + $ieee80211->setProperty('SSID',$ssid); |
|
252 | + $ieee80211->setProperty('MinRSNProto', $ciph == 'AES' ? 'CCMP' : 'TKIP'); |
|
253 | + $ieee80211s[] = $ieee80211; |
|
254 | + } |
|
255 | + $compatibleuses->setProperty('IEEE80211',$ieee80211s); |
|
256 | 256 | // TODO IEEE8023, ABFAB |
257 | - return($compatibleuses); |
|
257 | + return($compatibleuses); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | private function getAuthenticationMethodParams($eap) { |
261 | - $inner = EAP::innerAuth($eap); |
|
262 | - $outer_id = $eap["OUTER"]; |
|
263 | - |
|
264 | - if(isset($inner["METHOD"]) && $inner["METHOD"]) { |
|
265 | - $innerauthmethod = new InnerAuthenticationMethod(); |
|
266 | - $class_name = $inner["EAP"] ? 'EAPMethod' : 'NonEAPAuthMethod'; |
|
267 | - $eapmethod = new $class_name(); |
|
268 | - $eaptype = new Type(); |
|
269 | - $eaptype->setValue($inner['METHOD']); |
|
270 | - $eapmethod->setProperty('Type',$eaptype); |
|
271 | - $innerauthmethod->setProperty($class_name,$eapmethod); |
|
272 | - return ['inner_method'=>$innerauthmethod,'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']]; |
|
273 | - } else |
|
274 | - return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
261 | + $inner = EAP::innerAuth($eap); |
|
262 | + $outer_id = $eap["OUTER"]; |
|
263 | + |
|
264 | + if(isset($inner["METHOD"]) && $inner["METHOD"]) { |
|
265 | + $innerauthmethod = new InnerAuthenticationMethod(); |
|
266 | + $class_name = $inner["EAP"] ? 'EAPMethod' : 'NonEAPAuthMethod'; |
|
267 | + $eapmethod = new $class_name(); |
|
268 | + $eaptype = new Type(); |
|
269 | + $eaptype->setValue($inner['METHOD']); |
|
270 | + $eapmethod->setProperty('Type',$eaptype); |
|
271 | + $innerauthmethod->setProperty($class_name,$eapmethod); |
|
272 | + return ['inner_method'=>$innerauthmethod,'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']]; |
|
273 | + } else |
|
274 | + return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | private function getAuthMethod($eap) { |
278 | - $attr = $this->attributes; |
|
279 | - $eapParams = $this->getAuthenticationMethodParams($eap); |
|
280 | - $authmethod = new AuthenticationMethod(); |
|
281 | - $eapmethod = new EAPMethod(); |
|
282 | - $eaptype = new Type(); |
|
283 | - $eaptype->setValue($eapParams['methodID']); |
|
284 | - $eapmethod->setProperty('Type',$eaptype); |
|
285 | - if(isset($this->VendorSpecific)) { |
|
286 | - $vendorspecifics = []; |
|
287 | - foreach($this->VendorSpecific as $vs) { |
|
278 | + $attr = $this->attributes; |
|
279 | + $eapParams = $this->getAuthenticationMethodParams($eap); |
|
280 | + $authmethod = new AuthenticationMethod(); |
|
281 | + $eapmethod = new EAPMethod(); |
|
282 | + $eaptype = new Type(); |
|
283 | + $eaptype->setValue($eapParams['methodID']); |
|
284 | + $eapmethod->setProperty('Type',$eaptype); |
|
285 | + if(isset($this->VendorSpecific)) { |
|
286 | + $vendorspecifics = []; |
|
287 | + foreach($this->VendorSpecific as $vs) { |
|
288 | 288 | $vendorspecific = new VendorSpecific(); |
289 | 289 | $vs['value']->addAttribute('xsi:noNamespaceSchemaLocation',"xxx.xsd"); |
290 | 290 | $vendorspecific->setValue($vs['value']); |
291 | 291 | $vendorspecific->setAttributes(['vendor'=>$vs['vendor']]); |
292 | 292 | $vendorspecifics[] = $vendorspecific; |
293 | - } |
|
294 | - $eapmethod->setProperty('VendorSpecific',$vendorspecifics); |
|
295 | - } |
|
296 | - $authmethod->setProperty('EAPMethod',$eapmethod); |
|
293 | + } |
|
294 | + $eapmethod->setProperty('VendorSpecific',$vendorspecifics); |
|
295 | + } |
|
296 | + $authmethod->setProperty('EAPMethod',$eapmethod); |
|
297 | 297 | |
298 | 298 | // ServerSideCredentials |
299 | - $serversidecredential = new ServerSideCredential(); |
|
299 | + $serversidecredential = new ServerSideCredential(); |
|
300 | 300 | |
301 | 301 | // Certificates and server names |
302 | 302 | |
303 | - $CAs = []; |
|
304 | - $cas = $attr['internal:CAs'][0]; |
|
305 | - foreach ($cas as $ca) { |
|
306 | - $CA = new CA(); |
|
307 | - $CA->setValue(base64_encode($ca['der'])); |
|
308 | - $CA->setAttributes(['format'=>'X.509', 'encoding'=>'base64']); |
|
309 | - $CAs[] = $CA; |
|
310 | - } |
|
311 | - |
|
312 | - $serverids = []; |
|
313 | - $servers = $attr['eap:server_name']; |
|
314 | - foreach ($servers as $server) { |
|
315 | - $serverid = new ServerID(); |
|
316 | - $serverid->setValue($server); |
|
317 | - $serverids[] = $serverid; |
|
318 | - } |
|
319 | - |
|
320 | - $serversidecredential->setProperty('EAPType',$eaptype->getValue()); |
|
321 | - $serversidecredential->setProperty('CA',$CAs); |
|
322 | - $serversidecredential->setProperty('ServerID',$serverids); |
|
323 | - $authmethod->setProperty('ServerSideCredential',$serversidecredential); |
|
303 | + $CAs = []; |
|
304 | + $cas = $attr['internal:CAs'][0]; |
|
305 | + foreach ($cas as $ca) { |
|
306 | + $CA = new CA(); |
|
307 | + $CA->setValue(base64_encode($ca['der'])); |
|
308 | + $CA->setAttributes(['format'=>'X.509', 'encoding'=>'base64']); |
|
309 | + $CAs[] = $CA; |
|
310 | + } |
|
311 | + |
|
312 | + $serverids = []; |
|
313 | + $servers = $attr['eap:server_name']; |
|
314 | + foreach ($servers as $server) { |
|
315 | + $serverid = new ServerID(); |
|
316 | + $serverid->setValue($server); |
|
317 | + $serverids[] = $serverid; |
|
318 | + } |
|
319 | + |
|
320 | + $serversidecredential->setProperty('EAPType',$eaptype->getValue()); |
|
321 | + $serversidecredential->setProperty('CA',$CAs); |
|
322 | + $serversidecredential->setProperty('ServerID',$serverids); |
|
323 | + $authmethod->setProperty('ServerSideCredential',$serversidecredential); |
|
324 | 324 | |
325 | 325 | // ClientSideCredentials |
326 | 326 | |
327 | - $clientsidecredential = new ClientSideCredential(); |
|
327 | + $clientsidecredential = new ClientSideCredential(); |
|
328 | 328 | |
329 | 329 | // OuterIdentity |
330 | - if($attr['internal:use_anon_outer'] [0]) |
|
331 | - $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]); |
|
332 | - $clientsidecredential->setProperty('EAPType',$eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']); |
|
333 | - $authmethod->setProperty('ClientSideCredential',$clientsidecredential); |
|
334 | - if($eapParams['inner_method']) |
|
335 | - $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']); |
|
336 | - return $authmethod; |
|
330 | + if($attr['internal:use_anon_outer'] [0]) |
|
331 | + $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]); |
|
332 | + $clientsidecredential->setProperty('EAPType',$eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']); |
|
333 | + $authmethod->setProperty('ClientSideCredential',$clientsidecredential); |
|
334 | + if($eapParams['inner_method']) |
|
335 | + $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']); |
|
336 | + return $authmethod; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | public $VendorSpecific; |
42 | 42 | |
43 | 43 | public function writeDeviceInfo() { |
44 | - $ssid_ct=count($this->attributes['internal:SSID']); |
|
44 | + $ssid_ct = count($this->attributes['internal:SSID']); |
|
45 | 45 | $out = "<p>"; |
46 | - $out .= sprintf(_("This is a generic configuration file in the IETF <a href='%s'>EAP Metadata -00</a> XML format."),"https://tools.ietf.org/html/draft-winter-opsawg-eap-metadata-00"); |
|
46 | + $out .= sprintf(_("This is a generic configuration file in the IETF <a href='%s'>EAP Metadata -00</a> XML format."), "https://tools.ietf.org/html/draft-winter-opsawg-eap-metadata-00"); |
|
47 | 47 | return $out; |
48 | 48 | } |
49 | 49 | |
@@ -54,38 +54,38 @@ discard block |
||
54 | 54 | $eap_idp = new EAPIdentityProvider(); |
55 | 55 | // $eap_idp->setProperty('ValidUntil',$this->getValidUntil()); |
56 | 56 | // ProviderInfo-> |
57 | - $eap_idp->setProperty('ProviderInfo',$this->getProviderInfo()); |
|
57 | + $eap_idp->setProperty('ProviderInfo', $this->getProviderInfo()); |
|
58 | 58 | // TODO $eap_idp->setProperty('VendorSpecific',$this->getVendorSpecific()); |
59 | 59 | //AuthenticationMethods |
60 | 60 | // TODO |
61 | 61 | //ID attribute |
62 | 62 | //lang attribute |
63 | 63 | $authmethods = []; |
64 | - if($this->all_eaps) { |
|
64 | + if ($this->all_eaps) { |
|
65 | 65 | $EAPs = []; |
66 | 66 | foreach ($attr['all_eaps'] as $eap) { |
67 | - if(in_array($eap, $this->supportedEapMethods)) |
|
67 | + if (in_array($eap, $this->supportedEapMethods)) |
|
68 | 68 | $EAPs[] = $eap; |
69 | 69 | } |
70 | 70 | } else |
71 | - $EAPs = [ $this->selected_eap]; |
|
71 | + $EAPs = [$this->selected_eap]; |
|
72 | 72 | |
73 | 73 | foreach ($EAPs as $eap) { |
74 | 74 | $authmethods[] = $this->getAuthMethod($eap); |
75 | 75 | } |
76 | 76 | $authenticationmethods = new AuthenticationMethods(); |
77 | - $authenticationmethods->setProperty('AuthenticationMethods',$authmethods); |
|
78 | - $eap_idp->setProperty('AuthenticationMethods',$authenticationmethods); |
|
79 | - if(empty($attr['internal:realm'][0])) { |
|
80 | - $eap_idp->setAttribute('ID','undefined'); |
|
81 | - $eap_idp->setAttribute('namespace','urn:undefined'); |
|
77 | + $authenticationmethods->setProperty('AuthenticationMethods', $authmethods); |
|
78 | + $eap_idp->setProperty('AuthenticationMethods', $authenticationmethods); |
|
79 | + if (empty($attr['internal:realm'][0])) { |
|
80 | + $eap_idp->setAttribute('ID', 'undefined'); |
|
81 | + $eap_idp->setAttribute('namespace', 'urn:undefined'); |
|
82 | 82 | } else { |
83 | - $eap_idp->setAttribute('ID',$attr['internal:realm'][0]); |
|
84 | - $eap_idp->setAttribute('namespace',$NAMESPACE); |
|
83 | + $eap_idp->setAttribute('ID', $attr['internal:realm'][0]); |
|
84 | + $eap_idp->setAttribute('namespace', $NAMESPACE); |
|
85 | 85 | } |
86 | - if($this->lang_scope === 'single') |
|
87 | - $eap_idp->setAttribute('lang',$this->lang_index); |
|
88 | - $eap_idp->setAttribute('version','1'); |
|
86 | + if ($this->lang_scope === 'single') |
|
87 | + $eap_idp->setAttribute('lang', $this->lang_index); |
|
88 | + $eap_idp->setAttribute('version', '1'); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | // EAPIdentityProvider end |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | $rootname = 'EAPIdentityProviderList'; |
96 | 96 | $root = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\" ?><{$rootname} xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"eap-metadata.xsd\"></{$rootname}>"); |
97 | 97 | |
98 | - marshalObject($root,$eap_idp); |
|
98 | + marshalObject($root, $eap_idp); |
|
99 | 99 | $dom = dom_import_simplexml($root)->ownerDocument; |
100 | - $res = $dom->schemaValidate(CAT::$root .'/devices/xml/eap-metadata.xsd'); |
|
101 | - $f = fopen($this->installerBasename.'.eap-config',"w"); |
|
102 | - fwrite($f,$dom->saveXML()); |
|
100 | + $res = $dom->schemaValidate(CAT::$root . '/devices/xml/eap-metadata.xsd'); |
|
101 | + $f = fopen($this->installerBasename . '.eap-config', "w"); |
|
102 | + fwrite($f, $dom->saveXML()); |
|
103 | 103 | fclose($f); |
104 | - return($this->installerBasename.'.eap-config'); |
|
104 | + return($this->installerBasename . '.eap-config'); |
|
105 | 105 | } |
106 | 106 | |
107 | -private $AttributeNames = [ |
|
107 | +private $AttributeNames = [ |
|
108 | 108 | 'support:email' => 'EmailAddress', |
109 | 109 | 'support:url' => 'WebAddress', |
110 | 110 | 'support:phone' => 'Phone', |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | ]; |
115 | 115 | |
116 | 116 | private function getSimpleAttribute($attr_name) { |
117 | - if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
117 | + if (isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
118 | 118 | $a = $this->attributes[$attr_name]; |
119 | - if(! isset($this->AttributeNames[$attr_name])) { |
|
120 | - debug(4,"Missing class definition for $attr_name\n"); |
|
119 | + if (!isset($this->AttributeNames[$attr_name])) { |
|
120 | + debug(4, "Missing class definition for $attr_name\n"); |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | $class_name = $this->AttributeNames[$attr_name]; |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | private function getSimpleMLAttribute($attr_name) { |
133 | - if(isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
133 | + if (isset($this->attributes[$attr_name][0]) && $this->attributes[$attr_name][0]) { |
|
134 | 134 | $a = $this->attributes[$attr_name]; |
135 | - if(! isset($this->AttributeNames[$attr_name])) { |
|
136 | - debug(4,"Missing class definition for $attr_name\n"); |
|
135 | + if (!isset($this->AttributeNames[$attr_name])) { |
|
136 | + debug(4, "Missing class definition for $attr_name\n"); |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | $class_name = $this->AttributeNames[$attr_name]; |
140 | 140 | $objs = []; |
141 | - if($this->lang_scope === 'global') { |
|
142 | - foreach( $a['langs'] as $l => $v ) { |
|
143 | - $l = ( $l === 'C' ? 'any' : $l ); |
|
141 | + if ($this->lang_scope === 'global') { |
|
142 | + foreach ($a['langs'] as $l => $v) { |
|
143 | + $l = ($l === 'C' ? 'any' : $l); |
|
144 | 144 | $obj = new $class_name(); |
145 | 145 | $obj->setValue($v); |
146 | 146 | $obj->setAttributes(['lang' => $l]); |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | private function getDisplayName() { |
161 | 161 | $attr = $this->attributes; |
162 | 162 | $objs = []; |
163 | - if($this->lang_scope === 'global') { |
|
163 | + if ($this->lang_scope === 'global') { |
|
164 | 164 | $I = $attr['general:instname']['langs']; |
165 | - if($attr['internal:profile_count'][0] > 1) |
|
165 | + if ($attr['internal:profile_count'][0] > 1) |
|
166 | 166 | $P = $attr['profile:name']['langs']; |
167 | - foreach( $I as $l => $v ) { |
|
168 | - $l = ( $l === 'C' ? 'any' : $l ); |
|
167 | + foreach ($I as $l => $v) { |
|
168 | + $l = ($l === 'C' ? 'any' : $l); |
|
169 | 169 | $displayname = new DisplayName(); |
170 | - if(isset($P)) { |
|
170 | + if (isset($P)) { |
|
171 | 171 | $p = isset($P[$l]) ? $P[$l] : $P['C']; |
172 | - $v .= ' - '. $p; |
|
172 | + $v .= ' - ' . $p; |
|
173 | 173 | } |
174 | 174 | $displayname->setValue($v); |
175 | 175 | $displayname->setAttributes(['lang' => $l]); |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | } else { |
179 | 179 | $displayname = new DisplayName(); |
180 | 180 | $v = $attr['general:instname'][0]; |
181 | - if($attr['internal:profile_count'][0] > 1) |
|
182 | - $v .= ' - '.$attr['profile:name'][0]; |
|
181 | + if ($attr['internal:profile_count'][0] > 1) |
|
182 | + $v .= ' - ' . $attr['profile:name'][0]; |
|
183 | 183 | $displayname->setValue($v); |
184 | 184 | $objs[] = $displayname; |
185 | 185 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | |
189 | 189 | private function getProviderLogo() { |
190 | 190 | $attr = $this->attributes; |
191 | - if(isset($attr['general:logo_file'][0])){ |
|
191 | + if (isset($attr['general:logo_file'][0])) { |
|
192 | 192 | $logo_string = base64_encode($attr['general:logo_file'][0]); |
193 | - $logo_mime = 'image/'.$attr['internal:logo_file'][0]['mime']; |
|
193 | + $logo_mime = 'image/' . $attr['internal:logo_file'][0]['mime']; |
|
194 | 194 | $providerlogo = new ProviderLogo(); |
195 | 195 | $providerlogo->setAttributes(['mime'=>$logo_mime, 'encoding'=>'base64']); |
196 | 196 | $providerlogo->setValue($logo_string); |
@@ -200,34 +200,34 @@ discard block |
||
200 | 200 | |
201 | 201 | private function getProviderInfo() { |
202 | 202 | $providerinfo = new ProviderInfo(); |
203 | - $providerinfo->setProperty('DisplayName',$this->getDisplayName()); |
|
204 | - $providerinfo->setProperty('Description',$this->getSimpleMLAttribute('profile:description')); |
|
205 | - $providerinfo->setProperty('ProviderLocation',$this->getProvideLocation()); |
|
206 | - $providerinfo->setProperty('ProviderLogo',$this->getProviderLogo()); |
|
207 | - $providerinfo->setProperty('TermsOfUse',$this->getSimpleMLAttribute('support:info_file')); |
|
208 | - $providerinfo->setProperty('Helpdesk',$this->getHelpdesk()); |
|
203 | + $providerinfo->setProperty('DisplayName', $this->getDisplayName()); |
|
204 | + $providerinfo->setProperty('Description', $this->getSimpleMLAttribute('profile:description')); |
|
205 | + $providerinfo->setProperty('ProviderLocation', $this->getProvideLocation()); |
|
206 | + $providerinfo->setProperty('ProviderLogo', $this->getProviderLogo()); |
|
207 | + $providerinfo->setProperty('TermsOfUse', $this->getSimpleMLAttribute('support:info_file')); |
|
208 | + $providerinfo->setProperty('Helpdesk', $this->getHelpdesk()); |
|
209 | 209 | return $providerinfo; |
210 | 210 | } |
211 | 211 | |
212 | 212 | private function getProvideLocation() { |
213 | 213 | $attr = $this->attributes; |
214 | - if(isset($attr['general:geo_coordinates'])){ |
|
214 | + if (isset($attr['general:geo_coordinates'])) { |
|
215 | 215 | $at = $attr['general:geo_coordinates']; |
216 | 216 | if (count($at) > 1) { |
217 | 217 | $at1 = []; |
218 | 218 | foreach ($at as $a) { |
219 | 219 | $providerlocation = new ProviderLocation(); |
220 | 220 | $b = unserialize($a); |
221 | - $providerlocation->setProperty('Longitude',$b['lon']); |
|
222 | - $providerlocation->setProperty('Latitude',$b['lat']); |
|
221 | + $providerlocation->setProperty('Longitude', $b['lon']); |
|
222 | + $providerlocation->setProperty('Latitude', $b['lat']); |
|
223 | 223 | $at1[] = $providerlocation; |
224 | 224 | } |
225 | 225 | } |
226 | 226 | else { |
227 | 227 | $providerlocation = new ProviderLocation(); |
228 | 228 | $b = unserialize($at[0]); |
229 | - $providerlocation->setProperty('Longitude',$b['lon']); |
|
230 | - $providerlocation->setProperty('Latitude',$b['lat']); |
|
229 | + $providerlocation->setProperty('Longitude', $b['lon']); |
|
230 | + $providerlocation->setProperty('Latitude', $b['lat']); |
|
231 | 231 | $at1 = $providerlocation; |
232 | 232 | } |
233 | 233 | return$at1; |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | |
237 | 237 | private function getHelpdesk() { |
238 | 238 | $helpdesk = new Helpdesk(); |
239 | - $helpdesk->setProperty('EmailAddress',$this->getSimpleMLAttribute('support:email')); |
|
240 | - $helpdesk->setProperty('WebAddress',$this->getSimpleMLAttribute('support:url')); |
|
241 | - $helpdesk->setProperty('Phone',$this->getSimpleMLAttribute('support:phone')); |
|
239 | + $helpdesk->setProperty('EmailAddress', $this->getSimpleMLAttribute('support:email')); |
|
240 | + $helpdesk->setProperty('WebAddress', $this->getSimpleMLAttribute('support:url')); |
|
241 | + $helpdesk->setProperty('Phone', $this->getSimpleMLAttribute('support:phone')); |
|
242 | 242 | return $helpdesk; |
243 | 243 | } |
244 | 244 | |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | $ieee80211s = []; |
249 | 249 | foreach ($SSIDs as $ssid => $ciph) { |
250 | 250 | $ieee80211 = new IEEE80211(); |
251 | - $ieee80211->setProperty('SSID',$ssid); |
|
251 | + $ieee80211->setProperty('SSID', $ssid); |
|
252 | 252 | $ieee80211->setProperty('MinRSNProto', $ciph == 'AES' ? 'CCMP' : 'TKIP'); |
253 | 253 | $ieee80211s[] = $ieee80211; |
254 | 254 | } |
255 | - $compatibleuses->setProperty('IEEE80211',$ieee80211s); |
|
255 | + $compatibleuses->setProperty('IEEE80211', $ieee80211s); |
|
256 | 256 | // TODO IEEE8023, ABFAB |
257 | 257 | return($compatibleuses); |
258 | 258 | } |
@@ -261,17 +261,17 @@ discard block |
||
261 | 261 | $inner = EAP::innerAuth($eap); |
262 | 262 | $outer_id = $eap["OUTER"]; |
263 | 263 | |
264 | - if(isset($inner["METHOD"]) && $inner["METHOD"]) { |
|
264 | + if (isset($inner["METHOD"]) && $inner["METHOD"]) { |
|
265 | 265 | $innerauthmethod = new InnerAuthenticationMethod(); |
266 | 266 | $class_name = $inner["EAP"] ? 'EAPMethod' : 'NonEAPAuthMethod'; |
267 | 267 | $eapmethod = new $class_name(); |
268 | 268 | $eaptype = new Type(); |
269 | 269 | $eaptype->setValue($inner['METHOD']); |
270 | - $eapmethod->setProperty('Type',$eaptype); |
|
271 | - $innerauthmethod->setProperty($class_name,$eapmethod); |
|
272 | - return ['inner_method'=>$innerauthmethod,'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']]; |
|
270 | + $eapmethod->setProperty('Type', $eaptype); |
|
271 | + $innerauthmethod->setProperty($class_name, $eapmethod); |
|
272 | + return ['inner_method'=>$innerauthmethod, 'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']]; |
|
273 | 273 | } else |
274 | - return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
274 | + return ['inner_method'=>0, 'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | private function getAuthMethod($eap) { |
@@ -281,19 +281,19 @@ discard block |
||
281 | 281 | $eapmethod = new EAPMethod(); |
282 | 282 | $eaptype = new Type(); |
283 | 283 | $eaptype->setValue($eapParams['methodID']); |
284 | - $eapmethod->setProperty('Type',$eaptype); |
|
285 | - if(isset($this->VendorSpecific)) { |
|
284 | + $eapmethod->setProperty('Type', $eaptype); |
|
285 | + if (isset($this->VendorSpecific)) { |
|
286 | 286 | $vendorspecifics = []; |
287 | - foreach($this->VendorSpecific as $vs) { |
|
287 | + foreach ($this->VendorSpecific as $vs) { |
|
288 | 288 | $vendorspecific = new VendorSpecific(); |
289 | - $vs['value']->addAttribute('xsi:noNamespaceSchemaLocation',"xxx.xsd"); |
|
289 | + $vs['value']->addAttribute('xsi:noNamespaceSchemaLocation', "xxx.xsd"); |
|
290 | 290 | $vendorspecific->setValue($vs['value']); |
291 | 291 | $vendorspecific->setAttributes(['vendor'=>$vs['vendor']]); |
292 | 292 | $vendorspecifics[] = $vendorspecific; |
293 | 293 | } |
294 | - $eapmethod->setProperty('VendorSpecific',$vendorspecifics); |
|
294 | + $eapmethod->setProperty('VendorSpecific', $vendorspecifics); |
|
295 | 295 | } |
296 | - $authmethod->setProperty('EAPMethod',$eapmethod); |
|
296 | + $authmethod->setProperty('EAPMethod', $eapmethod); |
|
297 | 297 | |
298 | 298 | // ServerSideCredentials |
299 | 299 | $serversidecredential = new ServerSideCredential(); |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | $serverids[] = $serverid; |
318 | 318 | } |
319 | 319 | |
320 | - $serversidecredential->setProperty('EAPType',$eaptype->getValue()); |
|
321 | - $serversidecredential->setProperty('CA',$CAs); |
|
322 | - $serversidecredential->setProperty('ServerID',$serverids); |
|
323 | - $authmethod->setProperty('ServerSideCredential',$serversidecredential); |
|
320 | + $serversidecredential->setProperty('EAPType', $eaptype->getValue()); |
|
321 | + $serversidecredential->setProperty('CA', $CAs); |
|
322 | + $serversidecredential->setProperty('ServerID', $serverids); |
|
323 | + $authmethod->setProperty('ServerSideCredential', $serversidecredential); |
|
324 | 324 | |
325 | 325 | // ClientSideCredentials |
326 | 326 | |
327 | 327 | $clientsidecredential = new ClientSideCredential(); |
328 | 328 | |
329 | 329 | // OuterIdentity |
330 | - if($attr['internal:use_anon_outer'] [0]) |
|
331 | - $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]); |
|
332 | - $clientsidecredential->setProperty('EAPType',$eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']); |
|
333 | - $authmethod->setProperty('ClientSideCredential',$clientsidecredential); |
|
334 | - if($eapParams['inner_method']) |
|
335 | - $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']); |
|
330 | + if ($attr['internal:use_anon_outer'] [0]) |
|
331 | + $clientsidecredential->setProperty('OuterIdentity', $attr['internal:anon_local_value'][0] . '@' . $attr['internal:realm'][0]); |
|
332 | + $clientsidecredential->setProperty('EAPType', $eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']); |
|
333 | + $authmethod->setProperty('ClientSideCredential', $clientsidecredential); |
|
334 | + if ($eapParams['inner_method']) |
|
335 | + $authmethod->setProperty('InnerAuthenticationMethod', $eapParams['inner_method']); |
|
336 | 336 | return $authmethod; |
337 | 337 | } |
338 | 338 |
@@ -64,11 +64,13 @@ discard block |
||
64 | 64 | if($this->all_eaps) { |
65 | 65 | $EAPs = []; |
66 | 66 | foreach ($attr['all_eaps'] as $eap) { |
67 | - if(in_array($eap, $this->supportedEapMethods)) |
|
68 | - $EAPs[] = $eap; |
|
67 | + if(in_array($eap, $this->supportedEapMethods)) { |
|
68 | + $EAPs[] = $eap; |
|
69 | + } |
|
69 | 70 | } |
70 | - } else |
|
71 | - $EAPs = [ $this->selected_eap]; |
|
71 | + } else { |
|
72 | + $EAPs = [ $this->selected_eap]; |
|
73 | + } |
|
72 | 74 | |
73 | 75 | foreach ($EAPs as $eap) { |
74 | 76 | $authmethods[] = $this->getAuthMethod($eap); |
@@ -83,8 +85,9 @@ discard block |
||
83 | 85 | $eap_idp->setAttribute('ID',$attr['internal:realm'][0]); |
84 | 86 | $eap_idp->setAttribute('namespace',$NAMESPACE); |
85 | 87 | } |
86 | - if($this->lang_scope === 'single') |
|
87 | - $eap_idp->setAttribute('lang',$this->lang_index); |
|
88 | + if($this->lang_scope === 'single') { |
|
89 | + $eap_idp->setAttribute('lang',$this->lang_index); |
|
90 | + } |
|
88 | 91 | $eap_idp->setAttribute('version','1'); |
89 | 92 | |
90 | 93 | |
@@ -124,9 +127,10 @@ discard block |
||
124 | 127 | $obj = new $class_name(); |
125 | 128 | $obj->setValue($a[0]); |
126 | 129 | return($obj); |
127 | - } else |
|
128 | - return ''; |
|
129 | -} |
|
130 | + } else { |
|
131 | + return ''; |
|
132 | + } |
|
133 | + } |
|
130 | 134 | |
131 | 135 | |
132 | 136 | private function getSimpleMLAttribute($attr_name) { |
@@ -153,17 +157,19 @@ discard block |
||
153 | 157 | } |
154 | 158 | |
155 | 159 | return($objs); |
156 | - } else |
|
157 | - return ''; |
|
158 | -} |
|
160 | + } else { |
|
161 | + return ''; |
|
162 | + } |
|
163 | + } |
|
159 | 164 | |
160 | 165 | private function getDisplayName() { |
161 | 166 | $attr = $this->attributes; |
162 | 167 | $objs = []; |
163 | 168 | if($this->lang_scope === 'global') { |
164 | 169 | $I = $attr['general:instname']['langs']; |
165 | - if($attr['internal:profile_count'][0] > 1) |
|
166 | - $P = $attr['profile:name']['langs']; |
|
170 | + if($attr['internal:profile_count'][0] > 1) { |
|
171 | + $P = $attr['profile:name']['langs']; |
|
172 | + } |
|
167 | 173 | foreach( $I as $l => $v ) { |
168 | 174 | $l = ( $l === 'C' ? 'any' : $l ); |
169 | 175 | $displayname = new DisplayName(); |
@@ -178,8 +184,9 @@ discard block |
||
178 | 184 | } else { |
179 | 185 | $displayname = new DisplayName(); |
180 | 186 | $v = $attr['general:instname'][0]; |
181 | - if($attr['internal:profile_count'][0] > 1) |
|
182 | - $v .= ' - '.$attr['profile:name'][0]; |
|
187 | + if($attr['internal:profile_count'][0] > 1) { |
|
188 | + $v .= ' - '.$attr['profile:name'][0]; |
|
189 | + } |
|
183 | 190 | $displayname->setValue($v); |
184 | 191 | $objs[] = $displayname; |
185 | 192 | } |
@@ -222,8 +229,7 @@ discard block |
||
222 | 229 | $providerlocation->setProperty('Latitude',$b['lat']); |
223 | 230 | $at1[] = $providerlocation; |
224 | 231 | } |
225 | - } |
|
226 | - else { |
|
232 | + } else { |
|
227 | 233 | $providerlocation = new ProviderLocation(); |
228 | 234 | $b = unserialize($at[0]); |
229 | 235 | $providerlocation->setProperty('Longitude',$b['lon']); |
@@ -270,9 +276,10 @@ discard block |
||
270 | 276 | $eapmethod->setProperty('Type',$eaptype); |
271 | 277 | $innerauthmethod->setProperty($class_name,$eapmethod); |
272 | 278 | return ['inner_method'=>$innerauthmethod,'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']]; |
273 | - } else |
|
274 | - return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
275 | -} |
|
279 | + } else { |
|
280 | + return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0]; |
|
281 | + } |
|
282 | + } |
|
276 | 283 | |
277 | 284 | private function getAuthMethod($eap) { |
278 | 285 | $attr = $this->attributes; |
@@ -327,12 +334,14 @@ discard block |
||
327 | 334 | $clientsidecredential = new ClientSideCredential(); |
328 | 335 | |
329 | 336 | // OuterIdentity |
330 | - if($attr['internal:use_anon_outer'] [0]) |
|
331 | - $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]); |
|
337 | + if($attr['internal:use_anon_outer'] [0]) { |
|
338 | + $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]); |
|
339 | + } |
|
332 | 340 | $clientsidecredential->setProperty('EAPType',$eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']); |
333 | 341 | $authmethod->setProperty('ClientSideCredential',$clientsidecredential); |
334 | - if($eapParams['inner_method']) |
|
335 | - $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']); |
|
342 | + if($eapParams['inner_method']) { |
|
343 | + $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']); |
|
344 | + } |
|
336 | 345 | return $authmethod; |
337 | 346 | } |
338 | 347 |
@@ -201,6 +201,9 @@ discard block |
||
201 | 201 | } |
202 | 202 | */ |
203 | 203 | |
204 | +/** |
|
205 | + * @param false|string $filename |
|
206 | + */ |
|
204 | 207 | function check_upload_sanity($optiontype, $filename) { |
205 | 208 | //echo "check_upload_sanity:$optiontype:$filename<br>\n"; |
206 | 209 | // we check logo_file with ImageMagick |
@@ -257,6 +260,9 @@ discard block |
||
257 | 260 | return FALSE; |
258 | 261 | } |
259 | 262 | |
263 | +/** |
|
264 | + * @param boolean $checkpublic |
|
265 | + */ |
|
260 | 266 | function getBlobFromDB($ref, $checkpublic) { |
261 | 267 | |
262 | 268 | $reference = valid_DB_reference($ref); |
@@ -294,6 +300,9 @@ discard block |
||
294 | 300 | return $blob; |
295 | 301 | } |
296 | 302 | |
303 | +/** |
|
304 | + * @param integer $number |
|
305 | + */ |
|
297 | 306 | function display_size($number) { |
298 | 307 | if ($number > 1024 * 1024) |
299 | 308 | return round($number / 1024 / 1024, 2) . " MiB"; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']); |
266 | 266 | $details['name'] = preg_replace('/\//', "", $details['name']); |
267 | - $certstatus = ( $details['root'] == 1 ? "R" : "I"); |
|
267 | + $certstatus = ($details['root'] == 1 ? "R" : "I"); |
|
268 | 268 | if ($details['ca'] == 0 && $details['root'] != 1) { |
269 | 269 | 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>"; |
270 | 270 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | break; |
341 | 341 | case "boolean": |
342 | - $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>"; |
|
342 | + $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off")) . "</strong></td></tr>"; |
|
343 | 343 | break; |
344 | 344 | default: |
345 | 345 | $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>"; |
@@ -121,16 +121,20 @@ |
||
121 | 121 | ]; |
122 | 122 | |
123 | 123 | $retval = ""; |
124 | - if (!$omittabletags) |
|
125 | - $retval .= "<tr><td>"; |
|
124 | + if (!$omittabletags) { |
|
125 | + $retval .= "<tr><td>"; |
|
126 | + } |
|
126 | 127 | $caption = $caption !== 0 ? $caption : $UI_messages[$level]['text']; |
127 | 128 | $retval .= "<img class='icon' src='" . $UI_messages[$level]['icon'] . "' alt='" . $caption . "' title='" . $caption . "'/>"; |
128 | - if (!$omittabletags) |
|
129 | - $retval .= "</td><td>"; |
|
130 | - if ($text !== 0) |
|
131 | - $retval .= $text; |
|
132 | - if (!$omittabletags) |
|
133 | - $retval .= "</td></tr>"; |
|
129 | + if (!$omittabletags) { |
|
130 | + $retval .= "</td><td>"; |
|
131 | + } |
|
132 | + if ($text !== 0) { |
|
133 | + $retval .= $text; |
|
134 | + } |
|
135 | + if (!$omittabletags) { |
|
136 | + $retval .= "</td></tr>"; |
|
137 | + } |
|
134 | 138 | return $retval; |
135 | 139 | } |
136 | 140 |
@@ -164,6 +164,9 @@ discard block |
||
164 | 164 | return $input; |
165 | 165 | } |
166 | 166 | |
167 | +/** |
|
168 | + * @return string |
|
169 | + */ |
|
167 | 170 | function valid_coord_serialized($input) { |
168 | 171 | if (is_array(unserialize($input))) { |
169 | 172 | $tentative = unserialize($input); |
@@ -182,6 +185,9 @@ discard block |
||
182 | 185 | } |
183 | 186 | } |
184 | 187 | |
188 | +/** |
|
189 | + * @return string |
|
190 | + */ |
|
185 | 191 | function valid_boolean($input) { |
186 | 192 | if ($input != "on") { |
187 | 193 | echo input_validation_error(_("Unknown state of boolean option!")); |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | exit(1); |
28 | 28 | } |
29 | 29 | |
30 | - foreach ($temp->listFederationAdmins() as $oneowner) |
|
31 | - if ($oneowner == $owner) |
|
30 | + foreach ($temp->listFederationAdmins() as $oneowner) { |
|
31 | + if ($oneowner == $owner) |
|
32 | 32 | return $temp; |
33 | + } |
|
33 | 34 | echo input_validation_error(_("This Federation identifier is not accessible!")); |
34 | 35 | exit(1); |
35 | 36 | } |
@@ -47,9 +48,10 @@ discard block |
||
47 | 48 | } |
48 | 49 | |
49 | 50 | if ($owner !== 0) { // check if the authenticated user is allowed to see this institution |
50 | - foreach ($temp->owner() as $oneowner) |
|
51 | - if ($oneowner['ID'] == $owner) |
|
51 | + foreach ($temp->owner() as $oneowner) { |
|
52 | + if ($oneowner['ID'] == $owner) |
|
52 | 53 | return $temp; |
54 | + } |
|
53 | 55 | echo input_validation_error(_("This IdP identifier is not accessible!")); |
54 | 56 | exit(1); |
55 | 57 | } |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | |
78 | 80 | function valid_Device($input) { |
79 | 81 | $devicelist = Devices::listDevices(); |
80 | - if (!isset($devicelist[$input])) |
|
81 | - echo input_validation_error(_("This device does not exist!")); |
|
82 | + if (!isset($devicelist[$input])) { |
|
83 | + echo input_validation_error(_("This device does not exist!")); |
|
84 | + } |
|
82 | 85 | return $input; |
83 | 86 | } |
84 | 87 | |
@@ -89,20 +92,24 @@ discard block |
||
89 | 92 | $retval = filter_var($retval, FILTER_SANITIZE_STRING, ["flags" => FILTER_FLAG_NO_ENCODE_QUOTES]); |
90 | 93 | // unless explicitly wanted, take away intermediate disturbing whitespace |
91 | 94 | // a simple "space" is NOT disturbing :-) |
92 | - if ($allow_whitspace === 0) |
|
93 | - $retval = preg_replace('/(\0|\r|\x0b|\t|\n)/', '', $retval); |
|
94 | - else // even if we allow whitespace, not pathological ones! |
|
95 | + if ($allow_whitspace === 0) { |
|
96 | + $retval = preg_replace('/(\0|\r|\x0b|\t|\n)/', '', $retval); |
|
97 | + } else { |
|
98 | + // even if we allow whitespace, not pathological ones! |
|
95 | 99 | $retval = preg_replace('/(\0|\r|\x0b)/', '', $retval); |
100 | + } |
|
96 | 101 | |
97 | 102 | return $retval; |
98 | 103 | } |
99 | 104 | |
100 | 105 | function valid_consortium_oi($input) { |
101 | 106 | $shallow = valid_string_db($input); |
102 | - if (strlen($shallow) != 6 && strlen($shallow) != 10) |
|
103 | - return FALSE; |
|
104 | - if (!preg_match("/^[a-fA-F0-9]+$/", $shallow)) |
|
105 | - return FALSE; |
|
107 | + if (strlen($shallow) != 6 && strlen($shallow) != 10) { |
|
108 | + return FALSE; |
|
109 | + } |
|
110 | + if (!preg_match("/^[a-fA-F0-9]+$/", $shallow)) { |
|
111 | + return FALSE; |
|
112 | + } |
|
106 | 113 | return $shallow; |
107 | 114 | } |
108 | 115 | |
@@ -167,8 +174,9 @@ discard block |
||
167 | 174 | function valid_coord_serialized($input) { |
168 | 175 | if (is_array(unserialize($input))) { |
169 | 176 | $tentative = unserialize($input); |
170 | - if (isset($tentative['lon']) && isset($tentative['lat']) && valid_coordinate($tentative['lon']) && valid_coordinate($tentative['lat'])) |
|
171 | - return $input; |
|
177 | + if (isset($tentative['lon']) && isset($tentative['lat']) && valid_coordinate($tentative['lon']) && valid_coordinate($tentative['lat'])) { |
|
178 | + return $input; |
|
179 | + } |
|
172 | 180 | } else { |
173 | 181 | echo input_validation_error(_("Wrong coordinate encoding!")); |
174 | 182 | exit(1); |
@@ -186,9 +194,10 @@ discard block |
||
186 | 194 | if ($input != "on") { |
187 | 195 | echo input_validation_error(_("Unknown state of boolean option!")); |
188 | 196 | exit(1); |
189 | - } else |
|
190 | - return $input; |
|
191 | -} |
|
197 | + } else { |
|
198 | + return $input; |
|
199 | + } |
|
200 | + } |
|
192 | 201 | |
193 | 202 | function valid_DB_reference($input) { |
194 | 203 | $table = ""; |
@@ -201,22 +210,26 @@ discard block |
||
201 | 210 | $table = "profile_option"; |
202 | 211 | } elseif (preg_match("/FED/", $input)) { |
203 | 212 | $table = "federation_option"; |
204 | - } else |
|
205 | - return FALSE; |
|
213 | + } else { |
|
214 | + return FALSE; |
|
215 | + } |
|
206 | 216 | if (preg_match("/.*-([0-9]*)/", $input, $rowindexmatch)) { |
207 | 217 | $rowindex = $rowindexmatch[1]; |
208 | - } else |
|
209 | - return FALSE; |
|
218 | + } else { |
|
219 | + return FALSE; |
|
220 | + } |
|
210 | 221 | return ["table" => $table, "rowindex" => $rowindex]; |
211 | 222 | } |
212 | 223 | |
213 | 224 | function valid_host($input) { |
214 | 225 | // is it a valid IP address (IPv4 or IPv6)? |
215 | - if (filter_var($input, FILTER_VALIDATE_IP)) |
|
216 | - return $input; |
|
226 | + if (filter_var($input, FILTER_VALIDATE_IP)) { |
|
227 | + return $input; |
|
228 | + } |
|
217 | 229 | // if not, it must be a host name. Use email validation by prefixing with a local part |
218 | - if (filter_var("stefan@" . $input, FILTER_VALIDATE_EMAIL)) |
|
219 | - return $input; |
|
230 | + if (filter_var("stefan@" . $input, FILTER_VALIDATE_EMAIL)) { |
|
231 | + return $input; |
|
232 | + } |
|
220 | 233 | // if we get here, it's bogus |
221 | 234 | return FALSE; |
222 | 235 | } |
223 | 236 | \ No newline at end of file |
@@ -353,8 +353,7 @@ |
||
353 | 353 | |
354 | 354 | /** |
355 | 355 | * returns the navigation link to a given GUI page |
356 | - * @param int $new_page new page number |
|
357 | - * @param string $text link text |
|
356 | + * @param string $arg_name |
|
358 | 357 | * @return string |
359 | 358 | */ |
360 | 359 |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | require_once("CAT.php"); |
20 | 20 | require_once("UserAPI.php"); |
21 | 21 | |
22 | -debug(4,"basic.php\n"); |
|
23 | -debug(4,$_POST); |
|
22 | +debug(4, "basic.php\n"); |
|
23 | +debug(4, $_POST); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * SimpleGUI defines extensions of the GUI class used only in the simple interface |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function __construct() { |
37 | 37 | parent::__construct(); |
38 | 38 | $this->Args = []; |
39 | - $this->page = 0; |
|
39 | + $this->page = 0; |
|
40 | 40 | $this->set_locale('core'); |
41 | 41 | $this->version = 2; |
42 | 42 | $this->Args['lang'] = CAT::get_lang(); |
@@ -49,28 +49,28 @@ discard block |
||
49 | 49 | */ |
50 | 50 | |
51 | 51 | |
52 | - if(isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1) |
|
52 | + if (isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1) |
|
53 | 53 | unset($_REQUEST['device']); |
54 | 54 | |
55 | 55 | /* Start with checking if we have the country code if not then use geolocation.. |
56 | 56 | */ |
57 | 57 | $F = array_keys($this->printCountryList(1)); |
58 | - if(isset($_REQUEST['country']) && $_REQUEST['country']) { |
|
58 | + if (isset($_REQUEST['country']) && $_REQUEST['country']) { |
|
59 | 59 | $c = strtoupper($_REQUEST['country']); |
60 | 60 | } else { |
61 | 61 | $L = $this->locateUser(); |
62 | - if( $L['status'] == 'ok' ) { |
|
62 | + if ($L['status'] == 'ok') { |
|
63 | 63 | $c = strtoupper($L['country']); |
64 | 64 | } else { |
65 | 65 | debug(2, "No coutry provided and unable to locate the address\n"); |
66 | - $c='NONE'; |
|
66 | + $c = 'NONE'; |
|
67 | 67 | } |
68 | 68 | } |
69 | - if(!in_array($c,$F)) |
|
70 | - $c= array_shift($F); |
|
69 | + if (!in_array($c, $F)) |
|
70 | + $c = array_shift($F); |
|
71 | 71 | $this->Country = new Federation($c); |
72 | 72 | $this->Args['country'] = $this->Country->name; |
73 | - $this->page = 1; |
|
73 | + $this->page = 1; |
|
74 | 74 | |
75 | 75 | // If we have IdP identifier then match country to this identifier |
76 | 76 | // if the request contians a country code and an IdP code that do nat match |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | // If we have Profile identifier then test if we also have IdP identifier, if we do |
79 | 79 | // and they do not match then drop the profile code and just leave the IdP |
80 | 80 | |
81 | - if(isset($_REQUEST['idp']) && $_REQUEST['idp']) { |
|
82 | - $this->page = 2; |
|
81 | + if (isset($_REQUEST['idp']) && $_REQUEST['idp']) { |
|
82 | + $this->page = 2; |
|
83 | 83 | try { |
84 | 84 | $this->Idp = new IdP($_REQUEST['idp']); |
85 | 85 | } |
86 | 86 | catch (Exception $fail) { |
87 | - $this->page = 1; |
|
87 | + $this->page = 1; |
|
88 | 88 | $this->set_locale("web_user"); |
89 | 89 | return; |
90 | 90 | } |
91 | 91 | $country_tmp = new Federation($this->Idp->federation); |
92 | - if(strtoupper($this->Country->name) !== strtoupper($country_tmp->name)) { |
|
92 | + if (strtoupper($this->Country->name) !== strtoupper($country_tmp->name)) { |
|
93 | 93 | unset($this->Idp); |
94 | 94 | $this->page = 1; |
95 | 95 | $this->set_locale("web_user"); |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | } |
98 | 98 | $this->Args['idp'] = $_REQUEST['idp']; |
99 | 99 | $this->profile_count = $this->Idp->profileCount(); |
100 | - if(!isset($_REQUEST['profile'])) { |
|
100 | + if (!isset($_REQUEST['profile'])) { |
|
101 | 101 | $this->set_locale("web_user"); |
102 | 102 | return; |
103 | 103 | } |
104 | - $this->page = 3; |
|
104 | + $this->page = 3; |
|
105 | 105 | try { |
106 | 106 | $this->Profile = new Profile($_REQUEST['profile']); |
107 | 107 | } |
108 | 108 | catch (Exception $fail) { |
109 | - $this->page = 2; |
|
109 | + $this->page = 2; |
|
110 | 110 | $this->set_locale("web_user"); |
111 | 111 | return; |
112 | 112 | } |
113 | - if($this->Profile->institution != $this->Idp->identifier) { |
|
113 | + if ($this->Profile->institution != $this->Idp->identifier) { |
|
114 | 114 | unset($this->Profile); |
115 | 115 | $this->page = 2; |
116 | 116 | $this->set_locale("web_user"); |
117 | 117 | return; |
118 | 118 | } |
119 | 119 | $this->Args['profile'] = $_REQUEST['profile']; |
120 | - if(isset($_REQUEST['device'])) { |
|
120 | + if (isset($_REQUEST['device'])) { |
|
121 | 121 | $this->Args['device'] = $_REQUEST['device']; |
122 | 122 | } |
123 | 123 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | public function listCountries() { |
131 | 131 | $out = ''; |
132 | 132 | $FED = $this->printCountryList(1); |
133 | - $out .= _('Select your country').'<br>'; |
|
134 | - $out .= '<select name="country" onchange="submit_form(this)">'."\n"; |
|
133 | + $out .= _('Select your country') . '<br>'; |
|
134 | + $out .= '<select name="country" onchange="submit_form(this)">' . "\n"; |
|
135 | 135 | foreach ($FED as $f => $F) { |
136 | - $out .= '<option value="'.$f.'"'; |
|
137 | - if($f === $this->Country->name) |
|
136 | + $out .= '<option value="' . $f . '"'; |
|
137 | + if ($f === $this->Country->name) |
|
138 | 138 | $out .= ' selected'; |
139 | - $out .= '>'.$F.'</option>'."\n"; |
|
139 | + $out .= '>' . $F . '</option>' . "\n"; |
|
140 | 140 | } |
141 | 141 | $out .= '</select>'; |
142 | 142 | return $out; |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | |
145 | 145 | public function listIdPs() { |
146 | 146 | $Inst = $this->orderIdentityProviders($this->Country->name); |
147 | - if(! isset($this->Idp)) |
|
148 | - $this->Idp = new Idp ($Inst[0]['idp']); |
|
147 | + if (!isset($this->Idp)) |
|
148 | + $this->Idp = new Idp($Inst[0]['idp']); |
|
149 | 149 | $i_id = $this->Idp->identifier; |
150 | 150 | $out = ''; |
151 | 151 | $out .= _("Select your institution"); |
152 | 152 | $out .= '<select name="idp" onchange="submit_form(this)">'; |
153 | 153 | foreach ($Inst as $I) { |
154 | - $out .= '<option value="'.$I['idp'].'"'; |
|
155 | - if($I['idp'] == $i_id) |
|
154 | + $out .= '<option value="' . $I['idp'] . '"'; |
|
155 | + if ($I['idp'] == $i_id) |
|
156 | 156 | $out .= ' selected'; |
157 | - $out .= '>'.$I['title'].'</option>'; |
|
157 | + $out .= '>' . $I['title'] . '</option>'; |
|
158 | 158 | } |
159 | 159 | $out .= '</select>'; |
160 | 160 | return $out; |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | |
163 | 163 | public function listProfiles() { |
164 | 164 | $Prof = $this->Idp->listProfiles(1); |
165 | - if(! isset($this->Profile)) |
|
165 | + if (!isset($this->Profile)) |
|
166 | 166 | $this->Profile = $Prof[0]; |
167 | 167 | $p_id = $this->Profile->identifier; |
168 | 168 | $this->Args['profile'] = $p_id; |
169 | 169 | $out = ''; |
170 | 170 | if (count($Prof) > 1) { |
171 | - $out .= _("Select the user group").'<br>'; |
|
171 | + $out .= _("Select the user group") . '<br>'; |
|
172 | 172 | $out .= '<select name="profile" onchange="submit_form(this)">'; |
173 | 173 | foreach ($Prof as $P) { |
174 | - $out .= '<option value="'.$P->identifier.'"'; |
|
175 | - if($P->identifier == $p_id) |
|
174 | + $out .= '<option value="' . $P->identifier . '"'; |
|
175 | + if ($P->identifier == $p_id) |
|
176 | 176 | $out .= ' selected'; |
177 | - $out .= '>'.$P->name.'</option>'; |
|
177 | + $out .= '>' . $P->name . '</option>'; |
|
178 | 178 | } |
179 | 179 | $out .= '</select>'; |
180 | 180 | } else { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | |
188 | 188 | public function listDevices() { |
189 | - if(! isset($this->Profile)) |
|
189 | + if (!isset($this->Profile)) |
|
190 | 190 | return ''; |
191 | 191 | $OS = $this->detectOS(); |
192 | 192 | $os = $OS['device']; |
@@ -195,55 +195,55 @@ discard block |
||
195 | 195 | $redirect_target = ''; |
196 | 196 | $device_redirects = ''; |
197 | 197 | $selected_os = 0; |
198 | - $unsupported_message = '<div id="unsupported_os">'._("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution")."</div><br>"; |
|
198 | + $unsupported_message = '<div id="unsupported_os">' . _("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution") . "</div><br>"; |
|
199 | 199 | |
200 | 200 | $a = $this->profileAttributes($this->Profile->identifier); |
201 | 201 | $thedevices = $a['devices']; |
202 | 202 | $message = ''; |
203 | - if(! $os) |
|
203 | + if (!$os) |
|
204 | 204 | $message = $unsupported_message; |
205 | - $out = _("Choose an installer to download").'<br>'; |
|
205 | + $out = _("Choose an installer to download") . '<br>'; |
|
206 | 206 | $out .= '<select name="device" onchange="set_device(this)">'; |
207 | - $i= 0; |
|
207 | + $i = 0; |
|
208 | 208 | foreach ($thedevices as $D) { |
209 | - if((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'] ) |
|
209 | + if ((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status']) |
|
210 | 210 | continue; |
211 | - if(! $os) |
|
211 | + if (!$os) |
|
212 | 212 | $os = $D['id']; |
213 | 213 | $disp = $D['display']; |
214 | - if($D['id'] === '0') { |
|
214 | + if ($D['id'] === '0') { |
|
215 | 215 | $profile_redirect = 1; |
216 | 216 | $redirect_target = $D['redirect']; |
217 | 217 | } |
218 | - $out .= '<option value="'.$D['id'].'"'; |
|
219 | - if($D['id'] == $os) { |
|
218 | + $out .= '<option value="' . $D['id'] . '"'; |
|
219 | + if ($D['id'] == $os) { |
|
220 | 220 | $out .= ' selected'; |
221 | 221 | $selected_os = 1; |
222 | - if($D['redirect']) { |
|
222 | + if ($D['redirect']) { |
|
223 | 223 | $redirect_target = $D['redirect']; |
224 | 224 | } |
225 | 225 | } |
226 | - $out .= '>'.$disp.'</option>'; |
|
227 | - $device_redirects .= 'redirects['.$i.'] = '.( $D['redirect'] ? 1 : 0 ).';'; |
|
226 | + $out .= '>' . $disp . '</option>'; |
|
227 | + $device_redirects .= 'redirects[' . $i . '] = ' . ($D['redirect'] ? 1 : 0) . ';'; |
|
228 | 228 | $i++; |
229 | 229 | } |
230 | 230 | $out .= '</select>'; |
231 | - if( $selected_os == 0) |
|
231 | + if ($selected_os == 0) |
|
232 | 232 | $message = $unsupported_message; |
233 | 233 | $out = $message . $out; |
234 | - if($profile_redirect) |
|
234 | + if ($profile_redirect) |
|
235 | 235 | $out = ''; |
236 | - if($redirect_target) { |
|
236 | + if ($redirect_target) { |
|
237 | 237 | $device_redirects .= 'is_redirected = 1;'; |
238 | - $out .= _("Your local administrator has specified a redirect to a local support page.").'<br>'. _("When you click <b>CONTINUE</b> this support page will be opened."); |
|
239 | - $action = 'window.location.href=\''.$redirect_target.'\'; return(false);'; |
|
240 | - $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("CONTINUE to local support page")."</button>"; |
|
238 | + $out .= _("Your local administrator has specified a redirect to a local support page.") . '<br>' . _("When you click <b>CONTINUE</b> this support page will be opened."); |
|
239 | + $action = 'window.location.href=\'' . $redirect_target . '\'; return(false);'; |
|
240 | + $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"" . $action . '">' . _("CONTINUE to local support page") . "</button>"; |
|
241 | 241 | } else { |
242 | 242 | $device_redirects .= 'is_redirected = 0;'; |
243 | 243 | $action = 'submit_form(this)'; |
244 | - $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("Do you have an account at this institution?").'<br>'._("If so and if the other settings above are OK then click here to download...")."</button>"; |
|
244 | + $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"" . $action . '">' . _("Do you have an account at this institution?") . '<br>' . _("If so and if the other settings above are OK then click here to download...") . "</button>"; |
|
245 | 245 | } |
246 | - $out .= '<script type="text/javascript">'.$device_redirects.'</script>'; |
|
246 | + $out .= '<script type="text/javascript">' . $device_redirects . '</script>'; |
|
247 | 247 | return $out; |
248 | 248 | } |
249 | 249 | |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | $thedevices = $a['devices']; |
254 | 254 | $this->set_locale("web_user"); |
255 | 255 | $out = ''; |
256 | - if(isset($a['description']) && $a['description']) |
|
257 | - print '<div>'.$a['description'] . '</div>'; |
|
256 | + if (isset($a['description']) && $a['description']) |
|
257 | + print '<div>' . $a['description'] . '</div>'; |
|
258 | 258 | if (isset($a['local_email']) && $a['local_email']) |
259 | 259 | $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>'; |
260 | 260 | if (isset($a['local_url']) && $a['local_url']) |
261 | 261 | $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>'; |
262 | 262 | if (isset($a['local_phone']) && $a['local_phone']) |
263 | 263 | $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>'; |
264 | - if( $out !== '') { |
|
264 | + if ($out !== '') { |
|
265 | 265 | print '<div class="user_info">'; |
266 | 266 | print _("If you encounter problems you should ask for help at your home institution"); |
267 | 267 | print $out; |
@@ -269,15 +269,15 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | foreach ($thedevices as $D) { |
272 | - if(isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) |
|
272 | + if (isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) |
|
273 | 273 | continue; |
274 | 274 | $disp = $D['display']; |
275 | - if($D['id'] === '0') { |
|
276 | - print _("Your local administrator has specified a redirect to a local support page.").' '. _("Click on the link below to continue."); |
|
277 | - print '<div style="width:100%; text-align:center"><a href ="'.$D['redirect'].'">'.$D['redirect'].'</a></div>'; |
|
275 | + if ($D['id'] === '0') { |
|
276 | + print _("Your local administrator has specified a redirect to a local support page.") . ' ' . _("Click on the link below to continue."); |
|
277 | + print '<div style="width:100%; text-align:center"><a href ="' . $D['redirect'] . '">' . $D['redirect'] . '</a></div>'; |
|
278 | 278 | exit; |
279 | 279 | } |
280 | - if($D['id'] === $this->Args['device']) |
|
280 | + if ($D['id'] === $this->Args['device']) |
|
281 | 281 | break; |
282 | 282 | } |
283 | 283 | $this->set_locale("web_user"); |
@@ -288,27 +288,27 @@ discard block |
||
288 | 288 | return; |
289 | 289 | } |
290 | 290 | $extra_text = ''; |
291 | - if(isset($D['message']) && $D['message']) |
|
291 | + if (isset($D['message']) && $D['message']) |
|
292 | 292 | $extra_text = $D['message']; |
293 | - if(isset($D['device_customtext']) && $D['device_customtext']) { |
|
294 | - if($extra_text) |
|
293 | + if (isset($D['device_customtext']) && $D['device_customtext']) { |
|
294 | + if ($extra_text) |
|
295 | 295 | $extra_text .= '<p>'; |
296 | 296 | $extra_text = $D['device_customtext']; |
297 | 297 | } |
298 | - if(isset($D['eap_customtext']) && $D['eap_customtext']) { |
|
299 | - if($extra_text) |
|
298 | + if (isset($D['eap_customtext']) && $D['eap_customtext']) { |
|
299 | + if ($extra_text) |
|
300 | 300 | $extra_text .= '<p>'; |
301 | 301 | $extra_text .= $D['eap_customtext']; |
302 | 302 | } |
303 | - if($extra_text) |
|
303 | + if ($extra_text) |
|
304 | 304 | $extra_text .= '<p>'; |
305 | 305 | print $extra_text; |
306 | 306 | |
307 | - $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang='.CAT::get_lang().'&device='.$o['device'].'&profile='.$o['profile']; |
|
307 | + $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang=' . CAT::get_lang() . '&device=' . $o['device'] . '&profile=' . $o['profile']; |
|
308 | 308 | |
309 | - print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']),'/'). '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display']. '</span></div></button>'; |
|
309 | + print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') . '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display'] . '</span></div></button>'; |
|
310 | 310 | |
311 | - print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">'._("Start over").'</button>'; |
|
311 | + print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">' . _("Start over") . '</button>'; |
|
312 | 312 | print $this->passArgument('country'); |
313 | 313 | print $this->passArgument('idp'); |
314 | 314 | print $this->passArgument('profile'); |
@@ -318,13 +318,13 @@ discard block |
||
318 | 318 | |
319 | 319 | |
320 | 320 | public function langSelection() { |
321 | - $out = _("View this page in")." "; |
|
321 | + $out = _("View this page in") . " "; |
|
322 | 322 | $out .= '<select onchange="submit_form(this)" name="lang">'; |
323 | 323 | foreach (Config::$LANGUAGES as $lng => $value) { |
324 | - $out .= '<option value="'.$lng.'"'; |
|
324 | + $out .= '<option value="' . $lng . '"'; |
|
325 | 325 | if ($lng === CAT::get_lang()) |
326 | 326 | $out .= ' selected'; |
327 | - $out .= '>'. $value['display'] . '</option>'; |
|
327 | + $out .= '>' . $value['display'] . '</option>'; |
|
328 | 328 | } |
329 | 329 | $out .= '</select>'; |
330 | 330 | return $out; |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $out = ''; |
339 | 339 | $c = strtoupper($this->Country->name); |
340 | 340 | $name = isset(Federation::$FederationList[$c]) ? Federation::$FederationList[$c] : $c; |
341 | - $name = preg_replace('/ +/',' ',$name); |
|
341 | + $name = preg_replace('/ +/', ' ', $name); |
|
342 | 342 | $out .= "$name; "; |
343 | 343 | $name = $this->Idp->name; |
344 | - $name = preg_replace('/ +/',' ',$name); |
|
344 | + $name = preg_replace('/ +/', ' ', $name); |
|
345 | 345 | $out .= "$name"; |
346 | - if($this->profile_count > 1) { |
|
347 | - $name = '; '.$this->Profile->name; |
|
348 | - $name = preg_replace('/ +/',' ',$name); |
|
346 | + if ($this->profile_count > 1) { |
|
347 | + $name = '; ' . $this->Profile->name; |
|
348 | + $name = preg_replace('/ +/', ' ', $name); |
|
349 | 349 | $out .= "$name"; |
350 | 350 | } |
351 | 351 | return $out; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | */ |
360 | 360 | |
361 | 361 | public function passArgument($arg_name) { |
362 | - return '<input type="hidden" name="'.$arg_name.'" value="'.$this->Args[$arg_name].'">'; |
|
362 | + return '<input type="hidden" name="' . $arg_name . '" value="' . $this->Args[$arg_name] . '">'; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | public $Country; |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | |
373 | 373 | $Gui = new SimpleGUI(); |
374 | 374 | |
375 | -debug(4,"\n----------------------------------SIMPLE.PHP------------------------\n"); |
|
375 | +debug(4, "\n----------------------------------SIMPLE.PHP------------------------\n"); |
|
376 | 376 | ?> |
377 | 377 | <!DOCTYPE html> |
378 | 378 | <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo CAT::get_lang()?>"> |
379 | 379 | <head lang="<?php echo CAT::get_lang()?>"> |
380 | - <title><?php echo Config::$APPEARANCE['productname_long'];?></title> |
|
381 | -<link href="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']),'/') ?>/resources/css/cat-basic.css.php" type= "text/css" rel="stylesheet" /> |
|
380 | + <title><?php echo Config::$APPEARANCE['productname_long']; ?></title> |
|
381 | +<link href="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') ?>/resources/css/cat-basic.css.php" type= "text/css" rel="stylesheet" /> |
|
382 | 382 | <meta charset="utf-8" /> |
383 | 383 | <script type="text/javascript"> |
384 | 384 | var redirects = new Array(); |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | </head> |
408 | 408 | <body style=""> |
409 | 409 | |
410 | -<?php debug(4,"SERVER\n"); debug(4,$_SERVER) ?> |
|
411 | -<?php print '<div id="motd">'.( isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : ' ' ).'</div>'; ?> |
|
410 | +<?php debug(4, "SERVER\n"); debug(4, $_SERVER) ?> |
|
411 | +<?php print '<div id="motd">' . (isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : ' ') . '</div>'; ?> |
|
412 | 412 | <form name="my_form" method="POST" action="<?php echo $_SERVER['SCRIPT_NAME']?>" accept-charset='UTF-8'> |
413 | 413 | <img src="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') ?>/resources/images/consortium_logo.png" style="width: 20%; padding-right:20px; padding-top:0px; float:right" alt="logo" /> |
414 | 414 | <?php |
@@ -420,22 +420,22 @@ discard block |
||
420 | 420 | */ |
421 | 421 | print '<h1><a href="' . $_SERVER['SCRIPT_NAME'] . '?lang=' . CAT::get_lang() . '">' . Config::$APPEARANCE['productname'] . '</a></h1>'; |
422 | 422 | print $Gui->langSelection(); |
423 | - if(! isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) { |
|
423 | + if (!isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) { |
|
424 | 424 | print "<p>\n"; |
425 | 425 | print $Gui->listCountries(); |
426 | - if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->name)])) |
|
426 | + if ($Gui->page == 2 && !isset($FED[strtoupper($Gui->Country->name)])) |
|
427 | 427 | $Gui->page = 1; |
428 | - print "<p>".$Gui->listIdPs(); |
|
429 | - print "<p>".$Gui->listProfiles(); |
|
430 | - print "<p>".$Gui->listDevices(); |
|
428 | + print "<p>" . $Gui->listIdPs(); |
|
429 | + print "<p>" . $Gui->listProfiles(); |
|
430 | + print "<p>" . $Gui->listDevices(); |
|
431 | 431 | print '<input type="hidden" name="devices_h" id="devices_h" value="0">'; |
432 | 432 | |
433 | 433 | } else { |
434 | - if($Gui->page != 3) { |
|
434 | + if ($Gui->page != 3) { |
|
435 | 435 | print "Arguments missmatch error."; |
436 | 436 | exit; |
437 | 437 | } |
438 | - print '<div id="user_choice">'.$Gui->yourChoice().'</div><p>'; |
|
438 | + print '<div id="user_choice">' . $Gui->yourChoice() . '</div><p>'; |
|
439 | 439 | $Gui->displayDeviceDownload(); |
440 | 440 | print '<input type="hidden" name="devices_h" id="devices_h" value="1">'; |
441 | 441 | } |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | </form> |
445 | 445 | <div class='footer'><hr /> |
446 | 446 | <?php |
447 | -print('<a href="tou.php">'._("Terms of use")."</a><p>"); |
|
448 | -echo Config::$APPEARANCE['productname']." - " . CAT::$VERSION; |
|
449 | -echo " © 2011-15 GÉANT on behalf of the GN3, GN3plus, GN4 consortia and others <a href='copyright.php'>Full Copyright and Licenses</a></div>";?> |
|
447 | +print('<a href="tou.php">' . _("Terms of use") . "</a><p>"); |
|
448 | +echo Config::$APPEARANCE['productname'] . " - " . CAT::$VERSION; |
|
449 | +echo " © 2011-15 GÉANT on behalf of the GN3, GN3plus, GN4 consortia and others <a href='copyright.php'>Full Copyright and Licenses</a></div>"; ?> |
|
450 | 450 | </body> |
451 | 451 | </html> |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | */ |
50 | 50 | |
51 | 51 | |
52 | - if(isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1) |
|
53 | - unset($_REQUEST['device']); |
|
52 | + if(isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1) { |
|
53 | + unset($_REQUEST['device']); |
|
54 | + } |
|
54 | 55 | |
55 | 56 | /* Start with checking if we have the country code if not then use geolocation.. |
56 | 57 | */ |
@@ -66,8 +67,9 @@ discard block |
||
66 | 67 | $c='NONE'; |
67 | 68 | } |
68 | 69 | } |
69 | - if(!in_array($c,$F)) |
|
70 | - $c= array_shift($F); |
|
70 | + if(!in_array($c,$F)) { |
|
71 | + $c= array_shift($F); |
|
72 | + } |
|
71 | 73 | $this->Country = new Federation($c); |
72 | 74 | $this->Args['country'] = $this->Country->name; |
73 | 75 | $this->page = 1; |
@@ -82,8 +84,7 @@ discard block |
||
82 | 84 | $this->page = 2; |
83 | 85 | try { |
84 | 86 | $this->Idp = new IdP($_REQUEST['idp']); |
85 | - } |
|
86 | - catch (Exception $fail) { |
|
87 | + } catch (Exception $fail) { |
|
87 | 88 | $this->page = 1; |
88 | 89 | $this->set_locale("web_user"); |
89 | 90 | return; |
@@ -104,8 +105,7 @@ discard block |
||
104 | 105 | $this->page = 3; |
105 | 106 | try { |
106 | 107 | $this->Profile = new Profile($_REQUEST['profile']); |
107 | - } |
|
108 | - catch (Exception $fail) { |
|
108 | + } catch (Exception $fail) { |
|
109 | 109 | $this->page = 2; |
110 | 110 | $this->set_locale("web_user"); |
111 | 111 | return; |
@@ -134,8 +134,9 @@ discard block |
||
134 | 134 | $out .= '<select name="country" onchange="submit_form(this)">'."\n"; |
135 | 135 | foreach ($FED as $f => $F) { |
136 | 136 | $out .= '<option value="'.$f.'"'; |
137 | - if($f === $this->Country->name) |
|
138 | - $out .= ' selected'; |
|
137 | + if($f === $this->Country->name) { |
|
138 | + $out .= ' selected'; |
|
139 | + } |
|
139 | 140 | $out .= '>'.$F.'</option>'."\n"; |
140 | 141 | } |
141 | 142 | $out .= '</select>'; |
@@ -144,16 +145,18 @@ discard block |
||
144 | 145 | |
145 | 146 | public function listIdPs() { |
146 | 147 | $Inst = $this->orderIdentityProviders($this->Country->name); |
147 | - if(! isset($this->Idp)) |
|
148 | - $this->Idp = new Idp ($Inst[0]['idp']); |
|
148 | + if(! isset($this->Idp)) { |
|
149 | + $this->Idp = new Idp ($Inst[0]['idp']); |
|
150 | + } |
|
149 | 151 | $i_id = $this->Idp->identifier; |
150 | 152 | $out = ''; |
151 | 153 | $out .= _("Select your institution"); |
152 | 154 | $out .= '<select name="idp" onchange="submit_form(this)">'; |
153 | 155 | foreach ($Inst as $I) { |
154 | 156 | $out .= '<option value="'.$I['idp'].'"'; |
155 | - if($I['idp'] == $i_id) |
|
156 | - $out .= ' selected'; |
|
157 | + if($I['idp'] == $i_id) { |
|
158 | + $out .= ' selected'; |
|
159 | + } |
|
157 | 160 | $out .= '>'.$I['title'].'</option>'; |
158 | 161 | } |
159 | 162 | $out .= '</select>'; |
@@ -162,8 +165,9 @@ discard block |
||
162 | 165 | |
163 | 166 | public function listProfiles() { |
164 | 167 | $Prof = $this->Idp->listProfiles(1); |
165 | - if(! isset($this->Profile)) |
|
166 | - $this->Profile = $Prof[0]; |
|
168 | + if(! isset($this->Profile)) { |
|
169 | + $this->Profile = $Prof[0]; |
|
170 | + } |
|
167 | 171 | $p_id = $this->Profile->identifier; |
168 | 172 | $this->Args['profile'] = $p_id; |
169 | 173 | $out = ''; |
@@ -172,8 +176,9 @@ discard block |
||
172 | 176 | $out .= '<select name="profile" onchange="submit_form(this)">'; |
173 | 177 | foreach ($Prof as $P) { |
174 | 178 | $out .= '<option value="'.$P->identifier.'"'; |
175 | - if($P->identifier == $p_id) |
|
176 | - $out .= ' selected'; |
|
179 | + if($P->identifier == $p_id) { |
|
180 | + $out .= ' selected'; |
|
181 | + } |
|
177 | 182 | $out .= '>'.$P->name.'</option>'; |
178 | 183 | } |
179 | 184 | $out .= '</select>'; |
@@ -186,8 +191,9 @@ discard block |
||
186 | 191 | |
187 | 192 | |
188 | 193 | public function listDevices() { |
189 | - if(! isset($this->Profile)) |
|
190 | - return ''; |
|
194 | + if(! isset($this->Profile)) { |
|
195 | + return ''; |
|
196 | + } |
|
191 | 197 | $OS = $this->detectOS(); |
192 | 198 | $os = $OS['device']; |
193 | 199 | $this->Args['device'] = $os; |
@@ -200,16 +206,19 @@ discard block |
||
200 | 206 | $a = $this->profileAttributes($this->Profile->identifier); |
201 | 207 | $thedevices = $a['devices']; |
202 | 208 | $message = ''; |
203 | - if(! $os) |
|
204 | - $message = $unsupported_message; |
|
209 | + if(! $os) { |
|
210 | + $message = $unsupported_message; |
|
211 | + } |
|
205 | 212 | $out = _("Choose an installer to download").'<br>'; |
206 | 213 | $out .= '<select name="device" onchange="set_device(this)">'; |
207 | 214 | $i= 0; |
208 | 215 | foreach ($thedevices as $D) { |
209 | - if((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'] ) |
|
210 | - continue; |
|
211 | - if(! $os) |
|
212 | - $os = $D['id']; |
|
216 | + if((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'] ) { |
|
217 | + continue; |
|
218 | + } |
|
219 | + if(! $os) { |
|
220 | + $os = $D['id']; |
|
221 | + } |
|
213 | 222 | $disp = $D['display']; |
214 | 223 | if($D['id'] === '0') { |
215 | 224 | $profile_redirect = 1; |
@@ -228,11 +237,13 @@ discard block |
||
228 | 237 | $i++; |
229 | 238 | } |
230 | 239 | $out .= '</select>'; |
231 | - if( $selected_os == 0) |
|
232 | - $message = $unsupported_message; |
|
240 | + if( $selected_os == 0) { |
|
241 | + $message = $unsupported_message; |
|
242 | + } |
|
233 | 243 | $out = $message . $out; |
234 | - if($profile_redirect) |
|
235 | - $out = ''; |
|
244 | + if($profile_redirect) { |
|
245 | + $out = ''; |
|
246 | + } |
|
236 | 247 | if($redirect_target) { |
237 | 248 | $device_redirects .= 'is_redirected = 1;'; |
238 | 249 | $out .= _("Your local administrator has specified a redirect to a local support page.").'<br>'. _("When you click <b>CONTINUE</b> this support page will be opened."); |
@@ -253,14 +264,18 @@ discard block |
||
253 | 264 | $thedevices = $a['devices']; |
254 | 265 | $this->set_locale("web_user"); |
255 | 266 | $out = ''; |
256 | - if(isset($a['description']) && $a['description']) |
|
257 | - print '<div>'.$a['description'] . '</div>'; |
|
258 | - if (isset($a['local_email']) && $a['local_email']) |
|
259 | - $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>'; |
|
260 | - if (isset($a['local_url']) && $a['local_url']) |
|
261 | - $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>'; |
|
262 | - if (isset($a['local_phone']) && $a['local_phone']) |
|
263 | - $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>'; |
|
267 | + if(isset($a['description']) && $a['description']) { |
|
268 | + print '<div>'.$a['description'] . '</div>'; |
|
269 | + } |
|
270 | + if (isset($a['local_email']) && $a['local_email']) { |
|
271 | + $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>'; |
|
272 | + } |
|
273 | + if (isset($a['local_url']) && $a['local_url']) { |
|
274 | + $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>'; |
|
275 | + } |
|
276 | + if (isset($a['local_phone']) && $a['local_phone']) { |
|
277 | + $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>'; |
|
278 | + } |
|
264 | 279 | if( $out !== '') { |
265 | 280 | print '<div class="user_info">'; |
266 | 281 | print _("If you encounter problems you should ask for help at your home institution"); |
@@ -269,16 +284,18 @@ discard block |
||
269 | 284 | } |
270 | 285 | |
271 | 286 | foreach ($thedevices as $D) { |
272 | - if(isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) |
|
273 | - continue; |
|
287 | + if(isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) { |
|
288 | + continue; |
|
289 | + } |
|
274 | 290 | $disp = $D['display']; |
275 | 291 | if($D['id'] === '0') { |
276 | 292 | print _("Your local administrator has specified a redirect to a local support page.").' '. _("Click on the link below to continue."); |
277 | 293 | print '<div style="width:100%; text-align:center"><a href ="'.$D['redirect'].'">'.$D['redirect'].'</a></div>'; |
278 | 294 | exit; |
279 | 295 | } |
280 | - if($D['id'] === $this->Args['device']) |
|
281 | - break; |
|
296 | + if($D['id'] === $this->Args['device']) { |
|
297 | + break; |
|
298 | + } |
|
282 | 299 | } |
283 | 300 | $this->set_locale("web_user"); |
284 | 301 | |
@@ -288,20 +305,24 @@ discard block |
||
288 | 305 | return; |
289 | 306 | } |
290 | 307 | $extra_text = ''; |
291 | - if(isset($D['message']) && $D['message']) |
|
292 | - $extra_text = $D['message']; |
|
308 | + if(isset($D['message']) && $D['message']) { |
|
309 | + $extra_text = $D['message']; |
|
310 | + } |
|
293 | 311 | if(isset($D['device_customtext']) && $D['device_customtext']) { |
294 | - if($extra_text) |
|
295 | - $extra_text .= '<p>'; |
|
312 | + if($extra_text) { |
|
313 | + $extra_text .= '<p>'; |
|
314 | + } |
|
296 | 315 | $extra_text = $D['device_customtext']; |
297 | 316 | } |
298 | 317 | if(isset($D['eap_customtext']) && $D['eap_customtext']) { |
299 | - if($extra_text) |
|
300 | - $extra_text .= '<p>'; |
|
318 | + if($extra_text) { |
|
319 | + $extra_text .= '<p>'; |
|
320 | + } |
|
301 | 321 | $extra_text .= $D['eap_customtext']; |
302 | 322 | } |
303 | - if($extra_text) |
|
304 | - $extra_text .= '<p>'; |
|
323 | + if($extra_text) { |
|
324 | + $extra_text .= '<p>'; |
|
325 | + } |
|
305 | 326 | print $extra_text; |
306 | 327 | |
307 | 328 | $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang='.CAT::get_lang().'&device='.$o['device'].'&profile='.$o['profile']; |
@@ -322,8 +343,9 @@ discard block |
||
322 | 343 | $out .= '<select onchange="submit_form(this)" name="lang">'; |
323 | 344 | foreach (Config::$LANGUAGES as $lng => $value) { |
324 | 345 | $out .= '<option value="'.$lng.'"'; |
325 | - if ($lng === CAT::get_lang()) |
|
326 | - $out .= ' selected'; |
|
346 | + if ($lng === CAT::get_lang()) { |
|
347 | + $out .= ' selected'; |
|
348 | + } |
|
327 | 349 | $out .= '>'. $value['display'] . '</option>'; |
328 | 350 | } |
329 | 351 | $out .= '</select>'; |
@@ -423,8 +445,9 @@ discard block |
||
423 | 445 | if(! isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) { |
424 | 446 | print "<p>\n"; |
425 | 447 | print $Gui->listCountries(); |
426 | - if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->name)])) |
|
427 | - $Gui->page = 1; |
|
448 | + if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->name)])) { |
|
449 | + $Gui->page = 1; |
|
450 | + } |
|
428 | 451 | print "<p>".$Gui->listIdPs(); |
429 | 452 | print "<p>".$Gui->listProfiles(); |
430 | 453 | print "<p>".$Gui->listDevices(); |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | debug(4,$_POST); |
24 | 24 | |
25 | 25 | /** |
26 | - * SimpleGUI defines extensions of the GUI class used only in the simple interface |
|
27 | - * this class does not define its own constructor. |
|
28 | - */ |
|
26 | + * SimpleGUI defines extensions of the GUI class used only in the simple interface |
|
27 | + * this class does not define its own constructor. |
|
28 | + */ |
|
29 | 29 | class SimpleGUI extends UserAPI { |
30 | 30 | |
31 | 31 | /** |
32 | - * create the SimpleGUI object calling CAT constructor first |
|
33 | - * |
|
34 | - * sets up all public prperties of the object |
|
35 | - */ |
|
32 | + * create the SimpleGUI object calling CAT constructor first |
|
33 | + * |
|
34 | + * sets up all public prperties of the object |
|
35 | + */ |
|
36 | 36 | public function __construct() { |
37 | - parent::__construct(); |
|
38 | - $this->Args = []; |
|
39 | - $this->page = 0; |
|
40 | - $this->set_locale('core'); |
|
41 | - $this->version = 2; |
|
42 | - $this->Args['lang'] = CAT::get_lang(); |
|
37 | + parent::__construct(); |
|
38 | + $this->Args = []; |
|
39 | + $this->page = 0; |
|
40 | + $this->set_locale('core'); |
|
41 | + $this->version = 2; |
|
42 | + $this->Args['lang'] = CAT::get_lang(); |
|
43 | 43 | //print "<pre>"; print_r($_REQUEST); print "</pre>"; |
44 | 44 | |
45 | 45 | /* |
@@ -50,24 +50,24 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | if(isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1) |
53 | - unset($_REQUEST['device']); |
|
53 | + unset($_REQUEST['device']); |
|
54 | 54 | |
55 | 55 | /* Start with checking if we have the country code if not then use geolocation.. |
56 | 56 | */ |
57 | 57 | $F = array_keys($this->printCountryList(1)); |
58 | 58 | if(isset($_REQUEST['country']) && $_REQUEST['country']) { |
59 | - $c = strtoupper($_REQUEST['country']); |
|
59 | + $c = strtoupper($_REQUEST['country']); |
|
60 | 60 | } else { |
61 | - $L = $this->locateUser(); |
|
62 | - if( $L['status'] == 'ok' ) { |
|
63 | - $c = strtoupper($L['country']); |
|
64 | - } else { |
|
65 | - debug(2, "No coutry provided and unable to locate the address\n"); |
|
66 | - $c='NONE'; |
|
67 | - } |
|
61 | + $L = $this->locateUser(); |
|
62 | + if( $L['status'] == 'ok' ) { |
|
63 | + $c = strtoupper($L['country']); |
|
64 | + } else { |
|
65 | + debug(2, "No coutry provided and unable to locate the address\n"); |
|
66 | + $c='NONE'; |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | if(!in_array($c,$F)) |
70 | - $c= array_shift($F); |
|
70 | + $c= array_shift($F); |
|
71 | 71 | $this->Country = new Federation($c); |
72 | 72 | $this->Args['country'] = $this->Country->name; |
73 | 73 | $this->page = 1; |
@@ -79,287 +79,287 @@ discard block |
||
79 | 79 | // and they do not match then drop the profile code and just leave the IdP |
80 | 80 | |
81 | 81 | if(isset($_REQUEST['idp']) && $_REQUEST['idp']) { |
82 | - $this->page = 2; |
|
83 | - try { |
|
84 | - $this->Idp = new IdP($_REQUEST['idp']); |
|
85 | - } |
|
86 | - catch (Exception $fail) { |
|
87 | - $this->page = 1; |
|
88 | - $this->set_locale("web_user"); |
|
89 | - return; |
|
90 | - } |
|
91 | - $country_tmp = new Federation($this->Idp->federation); |
|
92 | - if(strtoupper($this->Country->name) !== strtoupper($country_tmp->name)) { |
|
93 | - unset($this->Idp); |
|
94 | - $this->page = 1; |
|
95 | - $this->set_locale("web_user"); |
|
96 | - return; |
|
97 | - } |
|
98 | - $this->Args['idp'] = $_REQUEST['idp']; |
|
99 | - $this->profile_count = $this->Idp->profileCount(); |
|
100 | - if(!isset($_REQUEST['profile'])) { |
|
101 | - $this->set_locale("web_user"); |
|
102 | - return; |
|
103 | - } |
|
104 | - $this->page = 3; |
|
105 | - try { |
|
106 | - $this->Profile = new Profile($_REQUEST['profile']); |
|
107 | - } |
|
108 | - catch (Exception $fail) { |
|
109 | - $this->page = 2; |
|
110 | - $this->set_locale("web_user"); |
|
111 | - return; |
|
112 | - } |
|
113 | - if($this->Profile->institution != $this->Idp->identifier) { |
|
114 | - unset($this->Profile); |
|
115 | - $this->page = 2; |
|
116 | - $this->set_locale("web_user"); |
|
117 | - return; |
|
118 | - } |
|
119 | - $this->Args['profile'] = $_REQUEST['profile']; |
|
120 | - if(isset($_REQUEST['device'])) { |
|
121 | - $this->Args['device'] = $_REQUEST['device']; |
|
122 | - } |
|
82 | + $this->page = 2; |
|
83 | + try { |
|
84 | + $this->Idp = new IdP($_REQUEST['idp']); |
|
85 | + } |
|
86 | + catch (Exception $fail) { |
|
87 | + $this->page = 1; |
|
88 | + $this->set_locale("web_user"); |
|
89 | + return; |
|
90 | + } |
|
91 | + $country_tmp = new Federation($this->Idp->federation); |
|
92 | + if(strtoupper($this->Country->name) !== strtoupper($country_tmp->name)) { |
|
93 | + unset($this->Idp); |
|
94 | + $this->page = 1; |
|
95 | + $this->set_locale("web_user"); |
|
96 | + return; |
|
97 | + } |
|
98 | + $this->Args['idp'] = $_REQUEST['idp']; |
|
99 | + $this->profile_count = $this->Idp->profileCount(); |
|
100 | + if(!isset($_REQUEST['profile'])) { |
|
101 | + $this->set_locale("web_user"); |
|
102 | + return; |
|
103 | + } |
|
104 | + $this->page = 3; |
|
105 | + try { |
|
106 | + $this->Profile = new Profile($_REQUEST['profile']); |
|
107 | + } |
|
108 | + catch (Exception $fail) { |
|
109 | + $this->page = 2; |
|
110 | + $this->set_locale("web_user"); |
|
111 | + return; |
|
112 | + } |
|
113 | + if($this->Profile->institution != $this->Idp->identifier) { |
|
114 | + unset($this->Profile); |
|
115 | + $this->page = 2; |
|
116 | + $this->set_locale("web_user"); |
|
117 | + return; |
|
118 | + } |
|
119 | + $this->Args['profile'] = $_REQUEST['profile']; |
|
120 | + if(isset($_REQUEST['device'])) { |
|
121 | + $this->Args['device'] = $_REQUEST['device']; |
|
122 | + } |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | //print "<pre>"; print_r($_REQUEST); print "</pre>"; |
126 | - $this->set_locale("web_user"); |
|
126 | + $this->set_locale("web_user"); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // print coutry selection |
130 | 130 | public function listCountries() { |
131 | - $out = ''; |
|
132 | - $FED = $this->printCountryList(1); |
|
133 | - $out .= _('Select your country').'<br>'; |
|
134 | - $out .= '<select name="country" onchange="submit_form(this)">'."\n"; |
|
135 | - foreach ($FED as $f => $F) { |
|
136 | - $out .= '<option value="'.$f.'"'; |
|
137 | - if($f === $this->Country->name) |
|
138 | - $out .= ' selected'; |
|
139 | - $out .= '>'.$F.'</option>'."\n"; |
|
140 | - } |
|
141 | - $out .= '</select>'; |
|
142 | - return $out; |
|
131 | + $out = ''; |
|
132 | + $FED = $this->printCountryList(1); |
|
133 | + $out .= _('Select your country').'<br>'; |
|
134 | + $out .= '<select name="country" onchange="submit_form(this)">'."\n"; |
|
135 | + foreach ($FED as $f => $F) { |
|
136 | + $out .= '<option value="'.$f.'"'; |
|
137 | + if($f === $this->Country->name) |
|
138 | + $out .= ' selected'; |
|
139 | + $out .= '>'.$F.'</option>'."\n"; |
|
140 | + } |
|
141 | + $out .= '</select>'; |
|
142 | + return $out; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function listIdPs() { |
146 | - $Inst = $this->orderIdentityProviders($this->Country->name); |
|
147 | - if(! isset($this->Idp)) |
|
148 | - $this->Idp = new Idp ($Inst[0]['idp']); |
|
149 | - $i_id = $this->Idp->identifier; |
|
150 | - $out = ''; |
|
151 | - $out .= _("Select your institution"); |
|
152 | - $out .= '<select name="idp" onchange="submit_form(this)">'; |
|
153 | - foreach ($Inst as $I) { |
|
154 | - $out .= '<option value="'.$I['idp'].'"'; |
|
155 | - if($I['idp'] == $i_id) |
|
156 | - $out .= ' selected'; |
|
157 | - $out .= '>'.$I['title'].'</option>'; |
|
158 | - } |
|
159 | - $out .= '</select>'; |
|
160 | - return $out; |
|
146 | + $Inst = $this->orderIdentityProviders($this->Country->name); |
|
147 | + if(! isset($this->Idp)) |
|
148 | + $this->Idp = new Idp ($Inst[0]['idp']); |
|
149 | + $i_id = $this->Idp->identifier; |
|
150 | + $out = ''; |
|
151 | + $out .= _("Select your institution"); |
|
152 | + $out .= '<select name="idp" onchange="submit_form(this)">'; |
|
153 | + foreach ($Inst as $I) { |
|
154 | + $out .= '<option value="'.$I['idp'].'"'; |
|
155 | + if($I['idp'] == $i_id) |
|
156 | + $out .= ' selected'; |
|
157 | + $out .= '>'.$I['title'].'</option>'; |
|
158 | + } |
|
159 | + $out .= '</select>'; |
|
160 | + return $out; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function listProfiles() { |
164 | - $Prof = $this->Idp->listProfiles(1); |
|
165 | - if(! isset($this->Profile)) |
|
166 | - $this->Profile = $Prof[0]; |
|
167 | - $p_id = $this->Profile->identifier; |
|
168 | - $this->Args['profile'] = $p_id; |
|
169 | - $out = ''; |
|
170 | - if (count($Prof) > 1) { |
|
171 | - $out .= _("Select the user group").'<br>'; |
|
172 | - $out .= '<select name="profile" onchange="submit_form(this)">'; |
|
173 | - foreach ($Prof as $P) { |
|
174 | - $out .= '<option value="'.$P->identifier.'"'; |
|
175 | - if($P->identifier == $p_id) |
|
176 | - $out .= ' selected'; |
|
177 | - $out .= '>'.$P->name.'</option>'; |
|
178 | - } |
|
179 | - $out .= '</select>'; |
|
180 | - } else { |
|
181 | - $out .= $this->passArgument('profile'); |
|
182 | - } |
|
183 | - return $out; |
|
164 | + $Prof = $this->Idp->listProfiles(1); |
|
165 | + if(! isset($this->Profile)) |
|
166 | + $this->Profile = $Prof[0]; |
|
167 | + $p_id = $this->Profile->identifier; |
|
168 | + $this->Args['profile'] = $p_id; |
|
169 | + $out = ''; |
|
170 | + if (count($Prof) > 1) { |
|
171 | + $out .= _("Select the user group").'<br>'; |
|
172 | + $out .= '<select name="profile" onchange="submit_form(this)">'; |
|
173 | + foreach ($Prof as $P) { |
|
174 | + $out .= '<option value="'.$P->identifier.'"'; |
|
175 | + if($P->identifier == $p_id) |
|
176 | + $out .= ' selected'; |
|
177 | + $out .= '>'.$P->name.'</option>'; |
|
178 | + } |
|
179 | + $out .= '</select>'; |
|
180 | + } else { |
|
181 | + $out .= $this->passArgument('profile'); |
|
182 | + } |
|
183 | + return $out; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
187 | 187 | |
188 | 188 | public function listDevices() { |
189 | - if(! isset($this->Profile)) |
|
190 | - return ''; |
|
191 | - $OS = $this->detectOS(); |
|
192 | - $os = $OS['device']; |
|
193 | - $this->Args['device'] = $os; |
|
194 | - $profile_redirect = 0; |
|
195 | - $redirect_target = ''; |
|
196 | - $device_redirects = ''; |
|
197 | - $selected_os = 0; |
|
198 | - $unsupported_message = '<div id="unsupported_os">'._("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution")."</div><br>"; |
|
189 | + if(! isset($this->Profile)) |
|
190 | + return ''; |
|
191 | + $OS = $this->detectOS(); |
|
192 | + $os = $OS['device']; |
|
193 | + $this->Args['device'] = $os; |
|
194 | + $profile_redirect = 0; |
|
195 | + $redirect_target = ''; |
|
196 | + $device_redirects = ''; |
|
197 | + $selected_os = 0; |
|
198 | + $unsupported_message = '<div id="unsupported_os">'._("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution")."</div><br>"; |
|
199 | 199 | |
200 | - $a = $this->profileAttributes($this->Profile->identifier); |
|
201 | - $thedevices = $a['devices']; |
|
202 | - $message = ''; |
|
203 | - if(! $os) |
|
204 | - $message = $unsupported_message; |
|
205 | - $out = _("Choose an installer to download").'<br>'; |
|
206 | - $out .= '<select name="device" onchange="set_device(this)">'; |
|
207 | - $i= 0; |
|
208 | - foreach ($thedevices as $D) { |
|
209 | - if((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'] ) |
|
210 | - continue; |
|
211 | - if(! $os) |
|
212 | - $os = $D['id']; |
|
213 | - $disp = $D['display']; |
|
214 | - if($D['id'] === '0') { |
|
200 | + $a = $this->profileAttributes($this->Profile->identifier); |
|
201 | + $thedevices = $a['devices']; |
|
202 | + $message = ''; |
|
203 | + if(! $os) |
|
204 | + $message = $unsupported_message; |
|
205 | + $out = _("Choose an installer to download").'<br>'; |
|
206 | + $out .= '<select name="device" onchange="set_device(this)">'; |
|
207 | + $i= 0; |
|
208 | + foreach ($thedevices as $D) { |
|
209 | + if((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'] ) |
|
210 | + continue; |
|
211 | + if(! $os) |
|
212 | + $os = $D['id']; |
|
213 | + $disp = $D['display']; |
|
214 | + if($D['id'] === '0') { |
|
215 | 215 | $profile_redirect = 1; |
216 | 216 | $redirect_target = $D['redirect']; |
217 | - } |
|
218 | - $out .= '<option value="'.$D['id'].'"'; |
|
219 | - if($D['id'] == $os) { |
|
217 | + } |
|
218 | + $out .= '<option value="'.$D['id'].'"'; |
|
219 | + if($D['id'] == $os) { |
|
220 | 220 | $out .= ' selected'; |
221 | 221 | $selected_os = 1; |
222 | 222 | if($D['redirect']) { |
223 | - $redirect_target = $D['redirect']; |
|
223 | + $redirect_target = $D['redirect']; |
|
224 | + } |
|
224 | 225 | } |
225 | - } |
|
226 | - $out .= '>'.$disp.'</option>'; |
|
227 | - $device_redirects .= 'redirects['.$i.'] = '.( $D['redirect'] ? 1 : 0 ).';'; |
|
228 | - $i++; |
|
229 | - } |
|
230 | - $out .= '</select>'; |
|
231 | - if( $selected_os == 0) |
|
232 | - $message = $unsupported_message; |
|
233 | - $out = $message . $out; |
|
234 | - if($profile_redirect) |
|
235 | - $out = ''; |
|
236 | - if($redirect_target) { |
|
237 | - $device_redirects .= 'is_redirected = 1;'; |
|
238 | - $out .= _("Your local administrator has specified a redirect to a local support page.").'<br>'. _("When you click <b>CONTINUE</b> this support page will be opened."); |
|
239 | - $action = 'window.location.href=\''.$redirect_target.'\'; return(false);'; |
|
240 | - $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("CONTINUE to local support page")."</button>"; |
|
241 | - } else { |
|
242 | - $device_redirects .= 'is_redirected = 0;'; |
|
243 | - $action = 'submit_form(this)'; |
|
244 | - $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("Do you have an account at this institution?").'<br>'._("If so and if the other settings above are OK then click here to download...")."</button>"; |
|
245 | - } |
|
246 | - $out .= '<script type="text/javascript">'.$device_redirects.'</script>'; |
|
247 | - return $out; |
|
226 | + $out .= '>'.$disp.'</option>'; |
|
227 | + $device_redirects .= 'redirects['.$i.'] = '.( $D['redirect'] ? 1 : 0 ).';'; |
|
228 | + $i++; |
|
229 | + } |
|
230 | + $out .= '</select>'; |
|
231 | + if( $selected_os == 0) |
|
232 | + $message = $unsupported_message; |
|
233 | + $out = $message . $out; |
|
234 | + if($profile_redirect) |
|
235 | + $out = ''; |
|
236 | + if($redirect_target) { |
|
237 | + $device_redirects .= 'is_redirected = 1;'; |
|
238 | + $out .= _("Your local administrator has specified a redirect to a local support page.").'<br>'. _("When you click <b>CONTINUE</b> this support page will be opened."); |
|
239 | + $action = 'window.location.href=\''.$redirect_target.'\'; return(false);'; |
|
240 | + $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("CONTINUE to local support page")."</button>"; |
|
241 | + } else { |
|
242 | + $device_redirects .= 'is_redirected = 0;'; |
|
243 | + $action = 'submit_form(this)'; |
|
244 | + $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("Do you have an account at this institution?").'<br>'._("If so and if the other settings above are OK then click here to download...")."</button>"; |
|
245 | + } |
|
246 | + $out .= '<script type="text/javascript">'.$device_redirects.'</script>'; |
|
247 | + return $out; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | public function displayDeviceDownload() { |
251 | - $this->set_locale('devices'); |
|
252 | - $a = $this->profileAttributes($this->Profile->identifier); |
|
253 | - $thedevices = $a['devices']; |
|
254 | - $this->set_locale("web_user"); |
|
255 | - $out = ''; |
|
256 | - if(isset($a['description']) && $a['description']) |
|
257 | - print '<div>'.$a['description'] . '</div>'; |
|
258 | - if (isset($a['local_email']) && $a['local_email']) |
|
259 | - $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>'; |
|
260 | - if (isset($a['local_url']) && $a['local_url']) |
|
261 | - $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>'; |
|
262 | - if (isset($a['local_phone']) && $a['local_phone']) |
|
263 | - $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>'; |
|
264 | - if( $out !== '') { |
|
265 | - print '<div class="user_info">'; |
|
266 | - print _("If you encounter problems you should ask for help at your home institution"); |
|
267 | - print $out; |
|
268 | - print "</div>\n"; |
|
269 | - } |
|
251 | + $this->set_locale('devices'); |
|
252 | + $a = $this->profileAttributes($this->Profile->identifier); |
|
253 | + $thedevices = $a['devices']; |
|
254 | + $this->set_locale("web_user"); |
|
255 | + $out = ''; |
|
256 | + if(isset($a['description']) && $a['description']) |
|
257 | + print '<div>'.$a['description'] . '</div>'; |
|
258 | + if (isset($a['local_email']) && $a['local_email']) |
|
259 | + $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>'; |
|
260 | + if (isset($a['local_url']) && $a['local_url']) |
|
261 | + $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>'; |
|
262 | + if (isset($a['local_phone']) && $a['local_phone']) |
|
263 | + $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>'; |
|
264 | + if( $out !== '') { |
|
265 | + print '<div class="user_info">'; |
|
266 | + print _("If you encounter problems you should ask for help at your home institution"); |
|
267 | + print $out; |
|
268 | + print "</div>\n"; |
|
269 | + } |
|
270 | 270 | |
271 | - foreach ($thedevices as $D) { |
|
272 | - if(isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) |
|
273 | - continue; |
|
274 | - $disp = $D['display']; |
|
275 | - if($D['id'] === '0') { |
|
276 | - print _("Your local administrator has specified a redirect to a local support page.").' '. _("Click on the link below to continue."); |
|
277 | - print '<div style="width:100%; text-align:center"><a href ="'.$D['redirect'].'">'.$D['redirect'].'</a></div>'; |
|
278 | - exit; |
|
279 | - } |
|
280 | - if($D['id'] === $this->Args['device']) |
|
281 | - break; |
|
282 | - } |
|
283 | - $this->set_locale("web_user"); |
|
284 | - |
|
285 | - $o = $this->generateInstaller($this->Args['device'], $this->Profile->identifier); |
|
286 | - if (!$o['link']) { |
|
287 | - print _("This is embarrassing. Generation of your installer failed. System admins have been notified. We will try to take care of the problem as soon as possible."); |
|
288 | - return; |
|
289 | - } |
|
290 | - $extra_text = ''; |
|
291 | - if(isset($D['message']) && $D['message']) |
|
292 | - $extra_text = $D['message']; |
|
293 | - if(isset($D['device_customtext']) && $D['device_customtext']) { |
|
294 | - if($extra_text) |
|
295 | - $extra_text .= '<p>'; |
|
296 | - $extra_text = $D['device_customtext']; |
|
271 | + foreach ($thedevices as $D) { |
|
272 | + if(isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) |
|
273 | + continue; |
|
274 | + $disp = $D['display']; |
|
275 | + if($D['id'] === '0') { |
|
276 | + print _("Your local administrator has specified a redirect to a local support page.").' '. _("Click on the link below to continue."); |
|
277 | + print '<div style="width:100%; text-align:center"><a href ="'.$D['redirect'].'">'.$D['redirect'].'</a></div>'; |
|
278 | + exit; |
|
279 | + } |
|
280 | + if($D['id'] === $this->Args['device']) |
|
281 | + break; |
|
282 | + } |
|
283 | + $this->set_locale("web_user"); |
|
284 | + |
|
285 | + $o = $this->generateInstaller($this->Args['device'], $this->Profile->identifier); |
|
286 | + if (!$o['link']) { |
|
287 | + print _("This is embarrassing. Generation of your installer failed. System admins have been notified. We will try to take care of the problem as soon as possible."); |
|
288 | + return; |
|
297 | 289 | } |
298 | - if(isset($D['eap_customtext']) && $D['eap_customtext']) { |
|
299 | - if($extra_text) |
|
300 | - $extra_text .= '<p>'; |
|
301 | - $extra_text .= $D['eap_customtext']; |
|
290 | + $extra_text = ''; |
|
291 | + if(isset($D['message']) && $D['message']) |
|
292 | + $extra_text = $D['message']; |
|
293 | + if(isset($D['device_customtext']) && $D['device_customtext']) { |
|
294 | + if($extra_text) |
|
295 | + $extra_text .= '<p>'; |
|
296 | + $extra_text = $D['device_customtext']; |
|
302 | 297 | } |
303 | - if($extra_text) |
|
304 | - $extra_text .= '<p>'; |
|
305 | - print $extra_text; |
|
298 | + if(isset($D['eap_customtext']) && $D['eap_customtext']) { |
|
299 | + if($extra_text) |
|
300 | + $extra_text .= '<p>'; |
|
301 | + $extra_text .= $D['eap_customtext']; |
|
302 | + } |
|
303 | + if($extra_text) |
|
304 | + $extra_text .= '<p>'; |
|
305 | + print $extra_text; |
|
306 | 306 | |
307 | - $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang='.CAT::get_lang().'&device='.$o['device'].'&profile='.$o['profile']; |
|
307 | + $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang='.CAT::get_lang().'&device='.$o['device'].'&profile='.$o['profile']; |
|
308 | 308 | |
309 | - print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']),'/'). '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display']. '</span></div></button>'; |
|
309 | + print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']),'/'). '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display']. '</span></div></button>'; |
|
310 | 310 | |
311 | - print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">'._("Start over").'</button>'; |
|
312 | - print $this->passArgument('country'); |
|
313 | - print $this->passArgument('idp'); |
|
314 | - print $this->passArgument('profile'); |
|
315 | - print $this->passArgument('device'); |
|
311 | + print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">'._("Start over").'</button>'; |
|
312 | + print $this->passArgument('country'); |
|
313 | + print $this->passArgument('idp'); |
|
314 | + print $this->passArgument('profile'); |
|
315 | + print $this->passArgument('device'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
319 | 319 | |
320 | 320 | public function langSelection() { |
321 | - $out = _("View this page in")." "; |
|
322 | - $out .= '<select onchange="submit_form(this)" name="lang">'; |
|
323 | - foreach (Config::$LANGUAGES as $lng => $value) { |
|
324 | - $out .= '<option value="'.$lng.'"'; |
|
325 | - if ($lng === CAT::get_lang()) |
|
326 | - $out .= ' selected'; |
|
327 | - $out .= '>'. $value['display'] . '</option>'; |
|
328 | - } |
|
329 | - $out .= '</select>'; |
|
330 | - return $out; |
|
321 | + $out = _("View this page in")." "; |
|
322 | + $out .= '<select onchange="submit_form(this)" name="lang">'; |
|
323 | + foreach (Config::$LANGUAGES as $lng => $value) { |
|
324 | + $out .= '<option value="'.$lng.'"'; |
|
325 | + if ($lng === CAT::get_lang()) |
|
326 | + $out .= ' selected'; |
|
327 | + $out .= '>'. $value['display'] . '</option>'; |
|
328 | + } |
|
329 | + $out .= '</select>'; |
|
330 | + return $out; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
334 | - * displays the navigation bar showing the current location of the page |
|
335 | - */ |
|
334 | + * displays the navigation bar showing the current location of the page |
|
335 | + */ |
|
336 | 336 | |
337 | 337 | public function yourChoice() { |
338 | - $out = ''; |
|
339 | - $c = strtoupper($this->Country->name); |
|
340 | - $name = isset(Federation::$federationList[$c]) ? Federation::$federationList[$c] : $c; |
|
341 | - $name = preg_replace('/ +/',' ',$name); |
|
342 | - $out .= "$name; "; |
|
343 | - $name = $this->Idp->name; |
|
344 | - $name = preg_replace('/ +/',' ',$name); |
|
345 | - $out .= "$name"; |
|
346 | - if($this->profile_count > 1) { |
|
347 | - $name = '; '.$this->Profile->name; |
|
348 | - $name = preg_replace('/ +/',' ',$name); |
|
349 | - $out .= "$name"; |
|
350 | - } |
|
351 | - return $out; |
|
338 | + $out = ''; |
|
339 | + $c = strtoupper($this->Country->name); |
|
340 | + $name = isset(Federation::$federationList[$c]) ? Federation::$federationList[$c] : $c; |
|
341 | + $name = preg_replace('/ +/',' ',$name); |
|
342 | + $out .= "$name; "; |
|
343 | + $name = $this->Idp->name; |
|
344 | + $name = preg_replace('/ +/',' ',$name); |
|
345 | + $out .= "$name"; |
|
346 | + if($this->profile_count > 1) { |
|
347 | + $name = '; '.$this->Profile->name; |
|
348 | + $name = preg_replace('/ +/',' ',$name); |
|
349 | + $out .= "$name"; |
|
350 | + } |
|
351 | + return $out; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
355 | - * returns the navigation link to a given GUI page |
|
356 | - * @param int $new_page new page number |
|
357 | - * @param string $text link text |
|
358 | - * @return string |
|
359 | - */ |
|
355 | + * returns the navigation link to a given GUI page |
|
356 | + * @param int $new_page new page number |
|
357 | + * @param string $text link text |
|
358 | + * @return string |
|
359 | + */ |
|
360 | 360 | |
361 | 361 | public function passArgument($arg_name) { |
362 | - return '<input type="hidden" name="'.$arg_name.'" value="'.$this->Args[$arg_name].'">'; |
|
362 | + return '<input type="hidden" name="'.$arg_name.'" value="'.$this->Args[$arg_name].'">'; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | public $Country; |
@@ -422,24 +422,24 @@ discard block |
||
422 | 422 | print $Gui->langSelection(); |
423 | 423 | if(! isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) { |
424 | 424 | print "<p>\n"; |
425 | - print $Gui->listCountries(); |
|
426 | - if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->name)])) |
|
427 | - $Gui->page = 1; |
|
428 | - print "<p>".$Gui->listIdPs(); |
|
429 | - print "<p>".$Gui->listProfiles(); |
|
430 | - print "<p>".$Gui->listDevices(); |
|
431 | - print '<input type="hidden" name="devices_h" id="devices_h" value="0">'; |
|
425 | + print $Gui->listCountries(); |
|
426 | + if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->name)])) |
|
427 | + $Gui->page = 1; |
|
428 | + print "<p>".$Gui->listIdPs(); |
|
429 | + print "<p>".$Gui->listProfiles(); |
|
430 | + print "<p>".$Gui->listDevices(); |
|
431 | + print '<input type="hidden" name="devices_h" id="devices_h" value="0">'; |
|
432 | 432 | |
433 | 433 | } else { |
434 | - if($Gui->page != 3) { |
|
435 | - print "Arguments missmatch error."; |
|
436 | - exit; |
|
437 | - } |
|
434 | + if($Gui->page != 3) { |
|
435 | + print "Arguments missmatch error."; |
|
436 | + exit; |
|
437 | + } |
|
438 | 438 | print '<div id="user_choice">'.$Gui->yourChoice().'</div><p>'; |
439 | - $Gui->displayDeviceDownload(); |
|
439 | + $Gui->displayDeviceDownload(); |
|
440 | 440 | print '<input type="hidden" name="devices_h" id="devices_h" value="1">'; |
441 | 441 | } |
442 | - ?> |
|
442 | + ?> |
|
443 | 443 | <input type="hidden" name="reset_dev" id="reset_dev" value="0"> |
444 | 444 | </form> |
445 | 445 | <div class='footer'><hr /> |
@@ -30,6 +30,9 @@ discard block |
||
30 | 30 | return $cat; |
31 | 31 | } |
32 | 32 | |
33 | +/** |
|
34 | + * @param Type $pagetitle |
|
35 | + */ |
|
33 | 36 | function defaultPagePrelude($pagetitle, $auth_required = TRUE) { |
34 | 37 | if ($auth_required == TRUE) { |
35 | 38 | require_once(dirname(dirname(dirname(__FILE__))) . "/admin/inc/auth.inc.php"); |
@@ -66,6 +69,9 @@ discard block |
||
66 | 69 | return $Cat; |
67 | 70 | } |
68 | 71 | |
72 | +/** |
|
73 | + * @param Type $area |
|
74 | + */ |
|
69 | 75 | function productheader($area, $language) { |
70 | 76 | echo "<div class='maincontent'>"; |
71 | 77 | // echo "You are here: ".$_SERVER['REQUEST_URI']; |
@@ -99,8 +99,7 @@ discard block |
||
99 | 99 | // in the admin area or on the main index.php ... |
100 | 100 | if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) { |
101 | 101 | $logoUrl .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/")) . "/resources/images/consortium_logo.png"; |
102 | - } |
|
103 | - else { |
|
102 | + } else { |
|
104 | 103 | $logoUrl .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/admin/")) . "/resources/images/consortium_logo.png"; |
105 | 104 | } |
106 | 105 | $logoUrl = "//" . $logoUrl; |
@@ -182,10 +181,11 @@ discard block |
||
182 | 181 | <a href='overview_user.php'>" . _("Go to your Profile page") . "</a> |
183 | 182 | <a href='inc/logout.php'>" . _("Logout") . "</a> "; |
184 | 183 | } |
185 | - if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) |
|
186 | - echo "<a href='" . dirname($_SERVER['SCRIPT_NAME']) . "/'>" . _("Start page") . "</a>"; |
|
187 | - else |
|
188 | - echo "<a href='../'>" . _("Start page") . "</a>"; |
|
184 | + if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) { |
|
185 | + echo "<a href='" . dirname($_SERVER['SCRIPT_NAME']) . "/'>" . _("Start page") . "</a>"; |
|
186 | + } else { |
|
187 | + echo "<a href='../'>" . _("Start page") . "</a>"; |
|
188 | + } |
|
189 | 189 | ?> |
190 | 190 | </p> |
191 | 191 | </div> <!-- sidebar --> |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | $ourlocale = CAT::get_lang(); |
39 | 39 | header("Content-Type:text/html;charset=utf-8"); |
40 | 40 | echo "<!DOCTYPE html> |
41 | - <html xmlns='http://www.w3.org/1999/xhtml' lang='". $ourlocale ."'> |
|
42 | - <head lang='". $ourlocale ."'> |
|
41 | + <html xmlns='http://www.w3.org/1999/xhtml' lang='". $ourlocale . "'> |
|
42 | + <head lang='". $ourlocale . "'> |
|
43 | 43 | <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"; |
44 | 44 | |
45 | 45 | $cssUrl = valid_host($_SERVER['HTTP_HOST']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | <select id='lang' name='lang' onchange='this.form.submit()'> |
78 | 78 | <?php |
79 | 79 | foreach (Config::$LANGUAGES as $lang => $value) { |
80 | - echo "<option value='$lang' " . (strtoupper($language) == strtoupper($lang) ? "selected" : "" ) . " >" . $value['display'] . "</option> "; |
|
80 | + echo "<option value='$lang' " . (strtoupper($language) == strtoupper($lang) ? "selected" : "") . " >" . $value['display'] . "</option> "; |
|
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | </select> |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | <?php |
138 | 138 | if ($wizard_style) { |
139 | 139 | echo "<p>" . |
140 | - sprintf(_("In this section, you define on which media %s should be configured on user devices."),Config::$CONSORTIUM['name']) . "</p> |
|
140 | + sprintf(_("In this section, you define on which media %s should be configured on user devices."), Config::$CONSORTIUM['name']) . "</p> |
|
141 | 141 | <ul>"; |
142 | 142 | echo "<li>"; |
143 | - echo "<strong>" . ( count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>"; |
|
143 | + echo "<strong>" . (count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>"; |
|
144 | 144 | if (count(Config::$CONSORTIUM['ssid']) > 0) { |
145 | 145 | $ssidlist = ""; |
146 | 146 | foreach (Config::$CONSORTIUM['ssid'] as $ssid) |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | echo "</li>"; |
158 | 158 | |
159 | 159 | echo "<li>"; |
160 | - echo "<strong>" . ( count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>"; |
|
160 | + echo "<strong>" . (count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>"; |
|
161 | 161 | if (count(Config::$CONSORTIUM['interworking-consortium-oi']) > 0) { |
162 | 162 | $consortiumlist = ""; |
163 | 163 | foreach (Config::$CONSORTIUM['interworking-consortium-oi'] as $oi) |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | echo _("Please configure which Consortium OIs should be configured in the installers."); |
171 | 171 | } |
172 | 172 | echo "</li>"; |
173 | - echo "<li><strong>"._("Support for wired IEEE 802.1X:")." </strong>" |
|
174 | - . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail)."). |
|
173 | + echo "<li><strong>" . _("Support for wired IEEE 802.1X:") . " </strong>" |
|
174 | + . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail).") . |
|
175 | 175 | "</li>"; |
176 | - echo "<li><strong>"._("Removal of bootstrap/onboarding SSIDs:")." </strong>" |
|
176 | + echo "<li><strong>" . _("Removal of bootstrap/onboarding SSIDs:") . " </strong>" |
|
177 | 177 | . _("If you use a captive portal to distribute configurations, you may want to unconfigure/disable that SSID after the bootstrap process. With this option, the SSID will either be removed, or be defined as 'Only connect manually'.") |
178 | 178 | . "</li>"; |
179 | 179 | echo "</ul>"; |
@@ -31,10 +31,11 @@ discard block |
||
31 | 31 | $idpoptions = $my_inst->getAttributes(); |
32 | 32 | $inst_name = $my_inst->name; |
33 | 33 | |
34 | -if ($wizard_style) |
|
34 | +if ($wizard_style) { |
|
35 | 35 | $cat = defaultPagePrelude(sprintf(_("%s: IdP enrollment wizard (step 2)"), Config::$APPEARANCE['productname'])); |
36 | -else |
|
36 | +} else { |
|
37 | 37 | $cat = defaultPagePrelude(sprintf(_("%s: Editing IdP '%s'"), Config::$APPEARANCE['productname'], $inst_name)); |
38 | +} |
|
38 | 39 | // let's check if the inst handle actually exists in the DB and user is authorised |
39 | 40 | ?> |
40 | 41 | <script src="js/option_expand.js" type="text/javascript"></script> |
@@ -43,9 +44,10 @@ discard block |
||
43 | 44 | |
44 | 45 | <?php |
45 | 46 | $additional = FALSE; |
46 | -foreach ($idpoptions as $optionname => $optionvalue) |
|
47 | +foreach ($idpoptions as $optionname => $optionvalue) { |
|
47 | 48 | if ($optionvalue['name'] == "general:geo_coordinates") |
48 | 49 | $additional = TRUE; |
50 | +} |
|
49 | 51 | geo_widget_head($my_inst->federation, $inst_name) |
50 | 52 | ?> |
51 | 53 | <script> |
@@ -74,10 +76,11 @@ discard block |
||
74 | 76 | |
75 | 77 | <h1> |
76 | 78 | <?php |
77 | -if ($wizard_style) |
|
79 | +if ($wizard_style) { |
|
78 | 80 | echo _("Step 2: General Information about your IdP"); |
79 | -else |
|
81 | +} else { |
|
80 | 82 | printf(_("Editing IdP information for '%s'"), $inst_name); |
83 | +} |
|
81 | 84 | ?> |
82 | 85 | </h1> |
83 | 86 | <div class='infobox'> |
@@ -98,9 +101,10 @@ discard block |
||
98 | 101 | echo "<form enctype='multipart/form-data' action='edit_idp_result.php?inst_id=$my_inst->identifier" . ($wizard_style ? "&wizard=true" : "") . "' method='post' accept-charset='UTF-8'> |
99 | 102 | <input type='hidden' name='MAX_FILE_SIZE' value='" . Config::$MAX_UPLOAD_SIZE . "'>"; |
100 | 103 | |
101 | -if ($wizard_style) |
|
104 | +if ($wizard_style) { |
|
102 | 105 | echo "<p>" . |
103 | 106 | _("Hello, newcomer. Your institution is new to us. This wizard will ask you several questions about your IdP, so that we can generate beautiful profiles for you in the end. All of the information below is optional, but it is important to fill out as many fields as possible for the benefit of your end users.") . "</p>"; |
107 | +} |
|
104 | 108 | ?> |
105 | 109 | <fieldset class="option_container"> |
106 | 110 | <legend><strong><?php echo _("General Information"); ?></strong></legend> |
@@ -143,12 +147,14 @@ discard block |
||
143 | 147 | echo "<strong>" . ( count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>"; |
144 | 148 | if (count(Config::$CONSORTIUM['ssid']) > 0) { |
145 | 149 | $ssidlist = ""; |
146 | - foreach (Config::$CONSORTIUM['ssid'] as $ssid) |
|
147 | - $ssidlist .= ", '<strong>" . $ssid . "</strong>'"; |
|
150 | + foreach (Config::$CONSORTIUM['ssid'] as $ssid) { |
|
151 | + $ssidlist .= ", '<strong>" . $ssid . "</strong>'"; |
|
152 | + } |
|
148 | 153 | $ssidlist = substr($ssidlist, 2); |
149 | 154 | echo sprintf(ngettext("We will always configure this SSID for WPA2/AES: %s.", "We will always configure these SSIDs for WPA2/AES: %s.", count(Config::$CONSORTIUM['ssid'])), $ssidlist); |
150 | - if (Config::$CONSORTIUM['tkipsupport']) |
|
151 | - echo " " . _("They will also be configured for WPA/TKIP if the device supports multiple encryption types."); |
|
155 | + if (Config::$CONSORTIUM['tkipsupport']) { |
|
156 | + echo " " . _("They will also be configured for WPA/TKIP if the device supports multiple encryption types."); |
|
157 | + } |
|
152 | 158 | echo "<br/>" . sprintf(_("It is also possible to define custom additional SSIDs with the options '%s' and '%s' below."), display_name("media:SSID"), display_name("media:SSID_with_legacy")); |
153 | 159 | } else { |
154 | 160 | echo _("Please configure which SSIDs should be configured in the installers."); |
@@ -160,8 +166,9 @@ discard block |
||
160 | 166 | echo "<strong>" . ( count(Config::$CONSORTIUM['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>"; |
161 | 167 | if (count(Config::$CONSORTIUM['interworking-consortium-oi']) > 0) { |
162 | 168 | $consortiumlist = ""; |
163 | - foreach (Config::$CONSORTIUM['interworking-consortium-oi'] as $oi) |
|
164 | - $consortiumlist .= ", '<strong>" . $oi . "</strong>'"; |
|
169 | + foreach (Config::$CONSORTIUM['interworking-consortium-oi'] as $oi) { |
|
170 | + $consortiumlist .= ", '<strong>" . $oi . "</strong>'"; |
|
171 | + } |
|
165 | 172 | $consortiumlist = substr($consortiumlist, 2); |
166 | 173 | echo sprintf(ngettext("We will always configure this Consortium OI: %s.", "We will always configure these Consortium OIs: %s.", count(Config::$CONSORTIUM['interworking-consortium-oi'])), $consortiumlist); |
167 | 174 | |
@@ -190,11 +197,12 @@ discard block |
||
190 | 197 | <fieldset class="option_container"> |
191 | 198 | <legend><strong><?php echo _("Helpdesk Details for all users"); ?></strong></legend> |
192 | 199 | <?php |
193 | -if ($wizard_style) |
|
200 | +if ($wizard_style) { |
|
194 | 201 | echo "<p>" . |
195 | 202 | _("If your IdP provides a helpdesk for its users, it would be nice if you would tell us the pointers to this helpdesk. Some site installers might be able to signal this information to the user if he gets stuck.") . "</p> |
196 | 203 | <p>" . |
197 | 204 | _("If you enter a value here, it will be added to the site installers for all your users, and will be displayed on the download page. If you operate separate helpdesks for different user groups (we call this 'profiles'), or operate no help desk at all (shame on you!), you can also leave any of these fields empty and optionally specify per-profile helpdesk information later in this wizard.") . "</p>"; |
205 | +} |
|
198 | 206 | ?> |
199 | 207 | |
200 | 208 | <table id="expandable_support_options"> |
@@ -206,9 +214,10 @@ discard block |
||
206 | 214 | <!-- <fieldset class="option_container"> |
207 | 215 | <legend><strong><?php echo _("EAP details for all users"); ?></strong></legend> |
208 | 216 | <?php |
209 | -if ($wizard_style) |
|
217 | +if ($wizard_style) { |
|
210 | 218 | echo "<p>" . _("Most EAP methods need server-side authentication details, like the CA certificate and/or server name(s) of your authentication servers. If all the EAP methods you support work with the same CA and or Common Names of servers, you can enter them here and they will be added as trust anchors in all profiles. If the details differ per profile or per EAP-type, you can also enter them in the individual profiles later.") . "</p> |
211 | 219 | <p>" . sprintf(_("<strong>Note well: </strong>The server-side validation is a cornerstone of %s; without it, users are subject to man-in-the-middle attacks! We will not generate site installers without Trusted CA anchors and server names."), Config::$CONSORTIUM['name']) . "</p>"; |
220 | +} |
|
212 | 221 | ?> |
213 | 222 | <table id="expandable_eapserver_options"> |
214 | 223 | <?php |
@@ -18,10 +18,11 @@ |
||
18 | 18 | if ($ls['Code'] === 'urn:oasis:names:tc:SAML:2.0:status:Success' && !isset($ls['SubCode'])) { |
19 | 19 | /* Successful logout. */ |
20 | 20 | $url = htmlspecialchars($_SERVER['HTTP_HOST']) . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/admin/logout_check.php")); |
21 | - if ($_SERVER['HTTPS'] == "on") |
|
22 | - $url = "https://" . $url; |
|
23 | - else |
|
24 | - $url = "http://" . $url; |
|
21 | + if ($_SERVER['HTTPS'] == "on") { |
|
22 | + $url = "https://" . $url; |
|
23 | + } else { |
|
24 | + $url = "http://" . $url; |
|
25 | + } |
|
25 | 26 | |
26 | 27 | header("Location: $url"); |
27 | 28 | } else { |