@@ -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"; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $filetype = $info->buffer($filename, FILEINFO_MIME_TYPE); |
251 | 251 | |
252 | 252 | // we only take plain text files in UTF-8! |
253 | - if ( $filetype == "text/plain" && iconv("UTF-8", "UTF-8", $filename) !== FALSE) |
|
253 | + if ($filetype == "text/plain" && iconv("UTF-8", "UTF-8", $filename) !== FALSE) |
|
254 | 254 | return TRUE; |
255 | 255 | } |
256 | 256 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']); |
318 | 318 | $details['name'] = preg_replace('/\//', "", $details['name']); |
319 | - $certstatus = ( $details['root'] == 1 ? "R" : "I"); |
|
319 | + $certstatus = ($details['root'] == 1 ? "R" : "I"); |
|
320 | 320 | if ($details['ca'] == 0 && $details['root'] != 1) |
321 | 321 | 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>"; |
322 | 322 | else |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | } |
392 | 392 | break; |
393 | 393 | case "boolean": |
394 | - $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>"; |
|
394 | + $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off")) . "</strong></td></tr>"; |
|
395 | 395 | break; |
396 | 396 | default: |
397 | 397 | $retval .= "<tr><td>" . display_name($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>"; |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | $DisplayNames[_("SSID (with WPA/TKIP)")] = "media:SSID_with_legacy"; |
82 | 82 | } |
83 | 83 | |
84 | - if (!empty(Config::$CONSORTIUM['interworking-consortium-oi']) && count(Config::$CONSORTIUM['interworking-consortium-oi']) > 0) |
|
85 | - $DisplayNames[_("Additional HS20 Consortium OI")] = "media:consortium_OI"; |
|
84 | + if (!empty(Config::$CONSORTIUM['interworking-consortium-oi']) && count(Config::$CONSORTIUM['interworking-consortium-oi']) > 0) { |
|
85 | + $DisplayNames[_("Additional HS20 Consortium OI")] = "media:consortium_OI"; |
|
86 | + } |
|
86 | 87 | $DisplayNames[_("HS20 Consortium OI")] = "media:consortium_OI"; |
87 | 88 | |
88 | 89 | $find = array_search($input, $DisplayNames); |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | |
97 | 98 | function tooltip($input) { |
98 | 99 | $descriptions = []; |
99 | - if (count(Config::$CONSORTIUM['ssid']) > 0) |
|
100 | - $descriptions[sprintf(_("This attribute can be set if you want to configure an additional SSID besides the default SSIDs for %s. It is almost always a bad idea not to use the default SSIDs. The only exception is if you have premises with an overlap of the radio signal with another %s hotspot. Typical misconceptions about additional SSIDs include: I want to have a local SSID for my own users. It is much better to use the default SSID and separate user groups with VLANs. That approach has two advantages: 1) your users will configure %s properly because it is their everyday SSID; 2) if you use a custom name and advertise this one as extra secure, your users might at some point roam to another place which happens to have the same SSID name. They might then be misled to believe that they are connecting to an extra secure network while they are not."), Config::$CONSORTIUM['name'], Config::$CONSORTIUM['name'], Config::$CONSORTIUM['name'])] = "media:SSID"; |
|
100 | + if (count(Config::$CONSORTIUM['ssid']) > 0) { |
|
101 | + $descriptions[sprintf(_("This attribute can be set if you want to configure an additional SSID besides the default SSIDs for %s. It is almost always a bad idea not to use the default SSIDs. The only exception is if you have premises with an overlap of the radio signal with another %s hotspot. Typical misconceptions about additional SSIDs include: I want to have a local SSID for my own users. It is much better to use the default SSID and separate user groups with VLANs. That approach has two advantages: 1) your users will configure %s properly because it is their everyday SSID; 2) if you use a custom name and advertise this one as extra secure, your users might at some point roam to another place which happens to have the same SSID name. They might then be misled to believe that they are connecting to an extra secure network while they are not."), Config::$CONSORTIUM['name'], Config::$CONSORTIUM['name'], Config::$CONSORTIUM['name'])] = "media:SSID"; |
|
102 | + } |
|
101 | 103 | |
102 | 104 | $find = array_search($input, $descriptions); |
103 | 105 | |
@@ -118,16 +120,20 @@ discard block |
||
118 | 120 | ]; |
119 | 121 | |
120 | 122 | $retval = ""; |
121 | - if (!$omittabletags) |
|
122 | - $retval .= "<tr><td>"; |
|
123 | + if (!$omittabletags) { |
|
124 | + $retval .= "<tr><td>"; |
|
125 | + } |
|
123 | 126 | $caption = $caption !== 0 ? $caption : $UI_messages[$level]['text']; |
124 | 127 | $retval .= "<img class='icon' src='" . $UI_messages[$level]['icon'] . "' alt='" . $caption . "' title='" . $caption . "'/>"; |
125 | - if (!$omittabletags) |
|
126 | - $retval .= "</td><td>"; |
|
127 | - if ($text !== 0) |
|
128 | - $retval .= $text; |
|
129 | - if (!$omittabletags) |
|
130 | - $retval .= "</td></tr>"; |
|
128 | + if (!$omittabletags) { |
|
129 | + $retval .= "</td><td>"; |
|
130 | + } |
|
131 | + if ($text !== 0) { |
|
132 | + $retval .= $text; |
|
133 | + } |
|
134 | + if (!$omittabletags) { |
|
135 | + $retval .= "</td></tr>"; |
|
136 | + } |
|
131 | 137 | return $retval; |
132 | 138 | } |
133 | 139 | |
@@ -236,8 +242,9 @@ discard block |
||
236 | 242 | if ($optiontype == "eap:ca_file") { |
237 | 243 | // echo "Checking $optiontype with file $filename"; |
238 | 244 | $cert = X509::processCertificate($filename); |
239 | - if ($cert) |
|
240 | - return TRUE; |
|
245 | + if ($cert) { |
|
246 | + return TRUE; |
|
247 | + } |
|
241 | 248 | // echo "Error! The certificate seems broken!"; |
242 | 249 | return FALSE; |
243 | 250 | } |
@@ -250,8 +257,9 @@ discard block |
||
250 | 257 | $filetype = $info->buffer($filename, FILEINFO_MIME_TYPE); |
251 | 258 | |
252 | 259 | // we only take plain text files in UTF-8! |
253 | - if ( $filetype == "text/plain" && iconv("UTF-8", "UTF-8", $filename) !== FALSE) |
|
254 | - return TRUE; |
|
260 | + if ( $filetype == "text/plain" && iconv("UTF-8", "UTF-8", $filename) !== FALSE) { |
|
261 | + return TRUE; |
|
262 | + } |
|
255 | 263 | } |
256 | 264 | |
257 | 265 | return FALSE; |
@@ -261,23 +269,26 @@ discard block |
||
261 | 269 | |
262 | 270 | $reference = valid_DB_reference($ref); |
263 | 271 | |
264 | - if ($reference == FALSE) |
|
265 | - return; |
|
272 | + if ($reference == FALSE) { |
|
273 | + return; |
|
274 | + } |
|
266 | 275 | |
267 | 276 | // the data is either public (just give it away) or not; in this case, only |
268 | 277 | // release if the data belongs to admin himself |
269 | 278 | if ($checkpublic) { |
270 | 279 | // we might be called without session context (filepreview) so get the |
271 | 280 | // context if needed |
272 | - if (session_status() != PHP_SESSION_ACTIVE) |
|
273 | - session_start(); |
|
281 | + if (session_status() != PHP_SESSION_ACTIVE) { |
|
282 | + session_start(); |
|
283 | + } |
|
274 | 284 | $owners = DBConnection::isDataRestricted($reference["table"], $reference["rowindex"]); |
275 | 285 | |
276 | 286 | $owners_condensed = []; |
277 | 287 | |
278 | 288 | if ($owners !== FALSE) { // see if we're authenticated and owners of the data |
279 | - foreach ($owners as $oneowner) |
|
280 | - $owners_condensed[] = $oneowner['ID']; |
|
289 | + foreach ($owners as $oneowner) { |
|
290 | + $owners_condensed[] = $oneowner['ID']; |
|
291 | + } |
|
281 | 292 | if (!isAuthenticated()) { |
282 | 293 | return FALSE; // admin-only, but we are not an admin |
283 | 294 | } elseif (array_search($_SESSION['user'], $owners_condensed) === FALSE) { |
@@ -289,51 +300,59 @@ discard block |
||
289 | 300 | } |
290 | 301 | |
291 | 302 | $blob = DBConnection::fetchRawDataByIndex($reference["table"], $reference["rowindex"]); |
292 | - if (!$blob) |
|
293 | - return FALSE; |
|
303 | + if (!$blob) { |
|
304 | + return FALSE; |
|
305 | + } |
|
294 | 306 | return $blob; |
295 | 307 | } |
296 | 308 | |
297 | 309 | function display_size($number) { |
298 | - if ($number > 1024 * 1024) |
|
299 | - return round($number / 1024 / 1024, 2) . " MiB"; |
|
300 | - if ($number > 1024) |
|
301 | - return round($number / 1024, 2) . " KiB"; |
|
310 | + if ($number > 1024 * 1024) { |
|
311 | + return round($number / 1024 / 1024, 2) . " MiB"; |
|
312 | + } |
|
313 | + if ($number > 1024) { |
|
314 | + return round($number / 1024, 2) . " KiB"; |
|
315 | + } |
|
302 | 316 | return $number . " B"; |
303 | 317 | } |
304 | 318 | |
305 | 319 | function previewCAinHTML($ca_reference) { |
306 | 320 | $found = preg_match("/^ROWID-.*/", $ca_reference); |
307 | - if (!$found) |
|
308 | - return "<div>" . _("Error, ROWID expected.") . "</div>"; |
|
321 | + if (!$found) { |
|
322 | + return "<div>" . _("Error, ROWID expected.") . "</div>"; |
|
323 | + } |
|
309 | 324 | |
310 | 325 | $ca_blob = base64_decode(getBlobFromDB($ca_reference, FALSE)); |
311 | 326 | |
312 | 327 | $func = new X509; |
313 | 328 | $details = $func->processCertificate($ca_blob); |
314 | - if ($details === FALSE) |
|
315 | - return _("There was an error processing the certificate!"); |
|
329 | + if ($details === FALSE) { |
|
330 | + return _("There was an error processing the certificate!"); |
|
331 | + } |
|
316 | 332 | |
317 | 333 | $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']); |
318 | 334 | $details['name'] = preg_replace('/\//', "", $details['name']); |
319 | 335 | $certstatus = ( $details['root'] == 1 ? "R" : "I"); |
320 | - if ($details['ca'] == 0 && $details['root'] != 1) |
|
321 | - 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>"; |
|
322 | - else |
|
323 | - return "<div class='ca-summary' ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>" . $details['name'] . "</div>"; |
|
324 | -} |
|
336 | + if ($details['ca'] == 0 && $details['root'] != 1) { |
|
337 | + 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>"; |
|
338 | + } else { |
|
339 | + return "<div class='ca-summary' ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>" . $details['name'] . "</div>"; |
|
340 | + } |
|
341 | + } |
|
325 | 342 | |
326 | 343 | function previewImageinHTML($image_reference) { |
327 | 344 | $found = preg_match("/^ROWID-.*/", $image_reference); |
328 | - if (!$found) |
|
329 | - return "<div>" . _("Error, ROWID expected.") . "</div>"; |
|
345 | + if (!$found) { |
|
346 | + return "<div>" . _("Error, ROWID expected.") . "</div>"; |
|
347 | + } |
|
330 | 348 | return "<img style='max-width:150px' src='inc/filepreview.php?id=" . $image_reference . "' alt='" . _("Preview of logo file") . "'/>"; |
331 | 349 | } |
332 | 350 | |
333 | 351 | function previewInfoFileinHTML($file_reference) { |
334 | 352 | $found = preg_match("/^ROWID-.*/", $file_reference); |
335 | - if (!$found) |
|
336 | - return _("<div>Error, ROWID expected, got $file_reference.</div>"); |
|
353 | + if (!$found) { |
|
354 | + return _("<div>Error, ROWID expected, got $file_reference.</div>"); |
|
355 | + } |
|
337 | 356 | |
338 | 357 | $file_blob = unserialize(getBlobFromDB($file_reference, FALSE)); |
339 | 358 | $file_blob = base64_decode($file_blob['content']); |
@@ -360,10 +379,11 @@ discard block |
||
360 | 379 | /* echo "<pre>"; |
361 | 380 | print_r($taggedarray); |
362 | 381 | echo "</pre>"; */ |
363 | - if ($taggedarray['lang'] == 'C') |
|
364 | - $language = _("default/other languages"); |
|
365 | - else |
|
366 | - $language = Config::$LANGUAGES[$taggedarray['lang']]['display']; |
|
382 | + if ($taggedarray['lang'] == 'C') { |
|
383 | + $language = _("default/other languages"); |
|
384 | + } else { |
|
385 | + $language = Config::$LANGUAGES[$taggedarray['lang']]['display']; |
|
386 | + } |
|
367 | 387 | $content = $taggedarray["content"]; |
368 | 388 | } else { |
369 | 389 | $language = ""; |
@@ -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 | } |
@@ -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 |
@@ -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->identifier; |
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->identifier) !== strtoupper($country_tmp->identifier)) { |
|
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->identifier) !== strtoupper($country_tmp->identifier)) { |
|
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->identifier) |
|
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->identifier) |
|
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->identifier); |
|
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->identifier); |
|
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->identifier); |
|
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->identifier); |
|
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->identifier)])) |
|
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->identifier)])) |
|
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 /> |
@@ -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->identifier; |
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->identifier) !== strtoupper($country_tmp->identifier)) { |
|
92 | + if (strtoupper($this->Country->identifier) !== strtoupper($country_tmp->identifier)) { |
|
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->identifier) |
|
136 | + $out .= '<option value="' . $f . '"'; |
|
137 | + if ($f === $this->Country->identifier) |
|
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->identifier); |
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->identifier); |
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->identifier)])) |
|
426 | + if ($Gui->page == 2 && !isset($FED[strtoupper($Gui->Country->identifier)])) |
|
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->identifier; |
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->identifier) |
|
138 | - $out .= ' selected'; |
|
137 | + if($f === $this->Country->identifier) { |
|
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->identifier); |
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->identifier)])) |
|
427 | - $Gui->page = 1; |
|
448 | + if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->identifier)])) { |
|
449 | + $Gui->page = 1; |
|
450 | + } |
|
428 | 451 | print "<p>".$Gui->listIdPs(); |
429 | 452 | print "<p>".$Gui->listProfiles(); |
430 | 453 | print "<p>".$Gui->listDevices(); |
@@ -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']; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | else |
62 | 62 | $css_url = "http://" . $css_url; |
63 | 63 | echo "<link rel='stylesheet' type='text/css' href='$css_url' />"; |
64 | - echo "<title>".htmlspecialchars($pagetitle)."</title>"; |
|
64 | + echo "<title>" . htmlspecialchars($pagetitle) . "</title>"; |
|
65 | 65 | |
66 | 66 | return $Cat; |
67 | 67 | } |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | echo "<form action='" . $place['path'] . "' method='GET' accept-charset='UTF-8'>" . _("View this page in") . " "; |
133 | 133 | echo "<select id='lang' name='lang' onchange='this.form.submit()'>"; |
134 | 134 | foreach (Config::$LANGUAGES as $lang => $value) { |
135 | - echo "<option value='$lang' ".(strtoupper($language) == strtoupper($lang) ? "selected" : "" )." >" . $value['display'] . "</option> "; |
|
135 | + echo "<option value='$lang' " . (strtoupper($language) == strtoupper($lang) ? "selected" : "") . " >" . $value['display'] . "</option> "; |
|
136 | 136 | } |
137 | 137 | echo "</select>"; |
138 | 138 | foreach ($_GET as $var => $value) { |
139 | 139 | if ($var != "lang" && $value != "") |
140 | - echo "<input type='hidden' name='".htmlspecialchars($var)."' value='".htmlspecialchars($value)."'>"; |
|
140 | + echo "<input type='hidden' name='" . htmlspecialchars($var) . "' value='" . htmlspecialchars($value) . "'>"; |
|
141 | 141 | } |
142 | 142 | echo "</form>"; |
143 | 143 | echo "</div><!--langselection-->"; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // content from here on will SCROLL instead of being fixed at the top |
164 | 164 | echo "<div class='pagecontent'> |
165 | 165 | <div class='trick'>"; |
166 | - echo "<div id='secondrow' style='border-bottom:5px solid ". Config::$APPEARANCE['colour1']."; min-height:100px;'>"; |
|
166 | + echo "<div id='secondrow' style='border-bottom:5px solid " . Config::$APPEARANCE['colour1'] . "; min-height:100px;'>"; |
|
167 | 167 | echo "<div id='secondarycaptions' style='display:inline-block; float:left'>"; |
168 | 168 | echo "<h2>$cap2</h2>"; |
169 | 169 | echo "</div><!--secondarycaptions-->"; |
@@ -44,8 +44,9 @@ discard block |
||
44 | 44 | <head lang='$ourlocale'> |
45 | 45 | <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"; |
46 | 46 | $css_url = valid_host($_SERVER['HTTP_HOST']); |
47 | - if ($css_url === FALSE) |
|
48 | - exit(1); |
|
47 | + if ($css_url === FALSE) { |
|
48 | + exit(1); |
|
49 | + } |
|
49 | 50 | // we need to construct the right path to the consortium logo; we are either |
50 | 51 | // in the admin area or on the main index.php ... |
51 | 52 | if (strpos($_SERVER['PHP_SELF'], "admin/") !== FALSE) { |
@@ -56,10 +57,11 @@ discard block |
||
56 | 57 | $css_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/")) . "/resources/css/cat.css.php"; |
57 | 58 | } |
58 | 59 | |
59 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") |
|
60 | - $css_url = "https://" . $css_url; |
|
61 | - else |
|
62 | - $css_url = "http://" . $css_url; |
|
60 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { |
|
61 | + $css_url = "https://" . $css_url; |
|
62 | + } else { |
|
63 | + $css_url = "http://" . $css_url; |
|
64 | + } |
|
63 | 65 | echo "<link rel='stylesheet' type='text/css' href='$css_url' />"; |
64 | 66 | echo "<title>".htmlspecialchars($pagetitle)."</title>"; |
65 | 67 | |
@@ -136,24 +138,28 @@ discard block |
||
136 | 138 | } |
137 | 139 | echo "</select>"; |
138 | 140 | foreach ($_GET as $var => $value) { |
139 | - if ($var != "lang" && $value != "") |
|
140 | - echo "<input type='hidden' name='".htmlspecialchars($var)."' value='".htmlspecialchars($value)."'>"; |
|
141 | + if ($var != "lang" && $value != "") { |
|
142 | + echo "<input type='hidden' name='".htmlspecialchars($var)."' value='".htmlspecialchars($value)."'>"; |
|
143 | + } |
|
141 | 144 | } |
142 | 145 | echo "</form>"; |
143 | 146 | echo "</div><!--langselection-->"; |
144 | 147 | $logo_url = valid_host($_SERVER['HTTP_HOST']); |
145 | - if ($logo_url === FALSE) |
|
146 | - exit(1); |
|
148 | + if ($logo_url === FALSE) { |
|
149 | + exit(1); |
|
150 | + } |
|
147 | 151 | // we need to construct the right path to the consortium logo; we are either |
148 | 152 | // in the admin area or on the main index.php ... |
149 | - if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) |
|
150 | - $logo_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/")) . "/resources/images/consortium_logo.png"; |
|
151 | - else |
|
152 | - $logo_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/admin/")) . "/resources/images/consortium_logo.png"; |
|
153 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") |
|
154 | - $logo_url = "https://" . $logo_url; |
|
155 | - else |
|
156 | - $logo_url = "http://" . $logo_url; |
|
153 | + if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) { |
|
154 | + $logo_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/")) . "/resources/images/consortium_logo.png"; |
|
155 | + } else { |
|
156 | + $logo_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/admin/")) . "/resources/images/consortium_logo.png"; |
|
157 | + } |
|
158 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { |
|
159 | + $logo_url = "https://" . $logo_url; |
|
160 | + } else { |
|
161 | + $logo_url = "http://" . $logo_url; |
|
162 | + } |
|
157 | 163 | echo "<div class='consortium_logo'> |
158 | 164 | <img id='test_locate' src='$logo_url' alt='Consortium Logo'> |
159 | 165 | </div> <!-- consortium_logo -->"; |
@@ -168,10 +174,11 @@ discard block |
||
168 | 174 | echo "<h2>$cap2</h2>"; |
169 | 175 | echo "</div><!--secondarycaptions-->"; |
170 | 176 | |
171 | - if (isset(Config::$APPEARANCE['MOTD']) && Config::$APPEARANCE['MOTD'] != "") |
|
172 | - echo "<div id='header_MOTD' style='display:inline-block; padding-left:20px;vertical-align:top;'> |
|
177 | + if (isset(Config::$APPEARANCE['MOTD']) && Config::$APPEARANCE['MOTD'] != "") { |
|
178 | + echo "<div id='header_MOTD' style='display:inline-block; padding-left:20px;vertical-align:top;'> |
|
173 | 179 | <p class='MOTD'>" . Config::$APPEARANCE['MOTD'] . "</p> |
174 | 180 | </div><!--header_MOTD-->"; |
181 | + } |
|
175 | 182 | |
176 | 183 | // echo $_SERVER['PHP_SELF']; |
177 | 184 | echo "<div class='sidebar'><p>"; |
@@ -183,10 +190,11 @@ discard block |
||
183 | 190 | <a href='overview_user.php'>" . _("Go to your Profile page") . "</a> |
184 | 191 | <a href='inc/logout.php'>" . _("Logout") . "</a> "; |
185 | 192 | } |
186 | - if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) |
|
187 | - echo "<a href='" . dirname($_SERVER['SCRIPT_NAME']) . "/'>" . _("Start page") . "</a>"; |
|
188 | - else |
|
189 | - echo "<a href='../'>" . _("Start page") . "</a>"; |
|
193 | + if (strpos($_SERVER['PHP_SELF'], "admin/") === FALSE) { |
|
194 | + echo "<a href='" . dirname($_SERVER['SCRIPT_NAME']) . "/'>" . _("Start page") . "</a>"; |
|
195 | + } else { |
|
196 | + echo "<a href='../'>" . _("Start page") . "</a>"; |
|
197 | + } |
|
190 | 198 | echo "</p> |
191 | 199 | </div> <!-- sidebar --></div><!--secondrow-->"; |
192 | 200 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | /** |
9 | 9 | * |
10 | 10 | */ |
11 | - $root = dirname(dirname(__FILE__)); |
|
12 | - include($root."/config/config.php"); |
|
13 | - set_include_path(get_include_path() . PATH_SEPARATOR . "$root/core" . PATH_SEPARATOR . "$root"); |
|
11 | + $root = dirname(dirname(__FILE__)); |
|
12 | + include($root."/config/config.php"); |
|
13 | + set_include_path(get_include_path() . PATH_SEPARATOR . "$root/core" . PATH_SEPARATOR . "$root"); |
|
14 | 14 | ?> |
@@ -9,6 +9,6 @@ |
||
9 | 9 | * |
10 | 10 | */ |
11 | 11 | $root = dirname(dirname(__FILE__)); |
12 | - include($root."/config/config.php"); |
|
12 | + include($root . "/config/config.php"); |
|
13 | 13 | set_include_path(get_include_path() . PATH_SEPARATOR . "$root/core" . PATH_SEPARATOR . "$root"); |
14 | 14 | ?> |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | ]; |
142 | 142 | |
143 | 143 | /** |
144 | - * Configuration for GeoIP2 |
|
145 | - * Beware, the legacy version does not really work with IPv6 addresses |
|
146 | - * version: set to 2 if you wish to use GeoIP2, to 1 for the legacy version or set to 0 to turn off geolocation service |
|
147 | - * geoip2-path-to-autoloader: points to the GeoIP2 autoloader |
|
148 | - * geoip2-path-to-db: points to the GeoIP2 city database |
|
149 | - * @var array |
|
150 | - */ |
|
144 | + * Configuration for GeoIP2 |
|
145 | + * Beware, the legacy version does not really work with IPv6 addresses |
|
146 | + * version: set to 2 if you wish to use GeoIP2, to 1 for the legacy version or set to 0 to turn off geolocation service |
|
147 | + * geoip2-path-to-autoloader: points to the GeoIP2 autoloader |
|
148 | + * geoip2-path-to-db: points to the GeoIP2 city database |
|
149 | + * @var array |
|
150 | + */ |
|
151 | 151 | |
152 | 152 | public static $GEOIP = [ |
153 | 153 | 'version' => 0, |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | * @var array |
175 | 175 | */ |
176 | 176 | public static $LANGUAGES = [ |
177 | - 'ca' => ['display' => 'Català', 'locale' => 'ca_ES.utf8'], |
|
178 | - 'de' => ['display' => 'Deutsch', 'locale' => 'de_DE.utf8'], |
|
179 | - 'en' => ['display' => 'English(GB)', 'locale' => 'en_GB.utf8'], |
|
180 | - 'es' => ['display' => 'Español', 'locale' => 'es_ES.utf8'], |
|
181 | - 'gl' => ['display' => 'Galego', 'locale' => 'gl_ES.utf8'], |
|
182 | - 'hr' => ['display' => 'Hrvatski', 'locale' => 'hr_HR.utf8'], |
|
183 | - 'it' => ['display' => 'Italiano', 'locale' => 'it_IT.utf8'], |
|
184 | - 'nb' => ['display' => 'Norsk', 'locale' => 'nb_NO.utf8'], |
|
185 | - 'pl' => ['display' => 'Polski', 'locale' => 'pl_PL.utf8'], |
|
186 | - 'sl' => ['display' => 'Slovenščina', 'locale' => 'sl_SI.utf8'], |
|
187 | - 'sr' => ['display' => 'Srpski', 'locale' => 'sr_RS@latin'], |
|
188 | - 'fi' => ['display' => 'Suomi', 'locale' => 'fi_FI.utf8'], |
|
189 | - 'el' => ['display' => 'Ελληνικά', 'locale' => 'el_GR.utf8'], |
|
190 | - 'hu' => ['display' => 'Magyar', 'locale' => 'hu_HU.utf8'], |
|
191 | - 'pt' => ['display' => 'Português', 'locale' => 'pt_PT.utf8'], |
|
177 | + 'ca' => ['display' => 'Català', 'locale' => 'ca_ES.utf8'], |
|
178 | + 'de' => ['display' => 'Deutsch', 'locale' => 'de_DE.utf8'], |
|
179 | + 'en' => ['display' => 'English(GB)', 'locale' => 'en_GB.utf8'], |
|
180 | + 'es' => ['display' => 'Español', 'locale' => 'es_ES.utf8'], |
|
181 | + 'gl' => ['display' => 'Galego', 'locale' => 'gl_ES.utf8'], |
|
182 | + 'hr' => ['display' => 'Hrvatski', 'locale' => 'hr_HR.utf8'], |
|
183 | + 'it' => ['display' => 'Italiano', 'locale' => 'it_IT.utf8'], |
|
184 | + 'nb' => ['display' => 'Norsk', 'locale' => 'nb_NO.utf8'], |
|
185 | + 'pl' => ['display' => 'Polski', 'locale' => 'pl_PL.utf8'], |
|
186 | + 'sl' => ['display' => 'Slovenščina', 'locale' => 'sl_SI.utf8'], |
|
187 | + 'sr' => ['display' => 'Srpski', 'locale' => 'sr_RS@latin'], |
|
188 | + 'fi' => ['display' => 'Suomi', 'locale' => 'fi_FI.utf8'], |
|
189 | + 'el' => ['display' => 'Ελληνικά', 'locale' => 'el_GR.utf8'], |
|
190 | + 'hu' => ['display' => 'Magyar', 'locale' => 'hu_HU.utf8'], |
|
191 | + 'pt' => ['display' => 'Português', 'locale' => 'pt_PT.utf8'], |
|
192 | 192 | |
193 | 193 | // For the following languages, partial translations exist in Transifex, but |
194 | 194 | // they are not complete enough for display. Their Transifex content is not |
@@ -237,45 +237,45 @@ discard block |
||
237 | 237 | ], |
238 | 238 | |
239 | 239 | 'TLS-clientcerts' => [ |
240 | - 'CA1' => [ |
|
240 | + 'CA1' => [ |
|
241 | 241 | 'status' => 'ACCREDITED', |
242 | 242 | 'issuerCA' => '/DC=org/DC=pki1/CN=PKI 1', |
243 | 243 | 'certificates' => [ |
244 | - [ |
|
244 | + [ |
|
245 | 245 | 'status' => 'CORRECT', |
246 | 246 | 'public' => 'ca1-client-cert.pem', |
247 | 247 | 'private' => 'ca1-client-key.pem', |
248 | 248 | 'expected' => 'PASS'], |
249 | - [ |
|
249 | + [ |
|
250 | 250 | 'status' => 'WRONGPOLICY', |
251 | 251 | 'public' => 'ca1-nopolicy-cert.pem', |
252 | 252 | 'private' => 'ca1-nopolicy-key.key', |
253 | 253 | 'expected' => 'FAIL'], |
254 | - [ |
|
254 | + [ |
|
255 | 255 | 'status' => 'EXPIRED', |
256 | 256 | 'public' => 'ca1-exp.pem', |
257 | 257 | 'private' => 'ca1-exp.key', |
258 | 258 | 'expected' => 'FAIL'], |
259 | - [ |
|
259 | + [ |
|
260 | 260 | 'status' => 'REVOKED', |
261 | 261 | 'public' => 'ca1-revoked.pem', |
262 | 262 | 'private' => 'ca1-revoked.key', |
263 | 263 | 'expected' => 'FAIL'], |
264 | 264 | ] |
265 | - ], |
|
266 | - 'CA-N' => [ |
|
265 | + ], |
|
266 | + 'CA-N' => [ |
|
267 | 267 | 'status' => 'NONACCREDITED', |
268 | 268 | 'issuerCA' => '/DC=org/DC=pkiN/CN=PKI N', |
269 | 269 | 'certificates' => [ |
270 | - [ |
|
270 | + [ |
|
271 | 271 | 'status' => 'CORRECT', |
272 | 272 | 'public' => 'caN-client-cert.pem', |
273 | 273 | 'private' => 'caN-client-cert.key', |
274 | 274 | 'expected' => 'FAIL'], |
275 | - ] |
|
276 | - ] |
|
277 | - ], |
|
278 | - 'accreditedCAsURL' => '', |
|
275 | + ] |
|
276 | + ] |
|
277 | + ], |
|
278 | + 'accreditedCAsURL' => '', |
|
279 | 279 | ]; |
280 | 280 | |
281 | 281 | /** |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | 'db' => 'customer_db', |
314 | 314 | 'user' => 'customerservice', |
315 | 315 | 'pass' => '2lame4u'], |
316 | - 'enforce-external-sync' => TRUE, |
|
317 | - /* if you feed your user database from a third-party source and do not want CAT to update it on its own, you can |
|
316 | + 'enforce-external-sync' => TRUE, |
|
317 | + /* if you feed your user database from a third-party source and do not want CAT to update it on its own, you can |
|
318 | 318 | * make it read-only |
319 | 319 | */ |
320 | - 'userdb-readonly' => FALSE, |
|
320 | + 'userdb-readonly' => FALSE, |
|
321 | 321 | ]; |
322 | 322 | |
323 | 323 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * pass: password for the username |
164 | 164 | * @var array |
165 | 165 | */ |
166 | - public static $MAILSETTINGS = [ // we always use Submission |
|
166 | + public static $MAILSETTINGS = [// we always use Submission |
|
167 | 167 | 'host' => 'submission.capable.mta', |
168 | 168 | 'user'=> 'mailuser', |
169 | 169 | 'pass' => 'mailpass', |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | * @var array |
175 | 175 | */ |
176 | 176 | public static $LANGUAGES = [ |
177 | - 'ca' => ['display' => 'Català', 'locale' => 'ca_ES.utf8'], |
|
178 | - 'de' => ['display' => 'Deutsch', 'locale' => 'de_DE.utf8'], |
|
177 | + 'ca' => ['display' => 'Català', 'locale' => 'ca_ES.utf8'], |
|
178 | + 'de' => ['display' => 'Deutsch', 'locale' => 'de_DE.utf8'], |
|
179 | 179 | 'en' => ['display' => 'English(GB)', 'locale' => 'en_GB.utf8'], |
180 | - 'es' => ['display' => 'Español', 'locale' => 'es_ES.utf8'], |
|
181 | - 'gl' => ['display' => 'Galego', 'locale' => 'gl_ES.utf8'], |
|
182 | - 'hr' => ['display' => 'Hrvatski', 'locale' => 'hr_HR.utf8'], |
|
183 | - 'it' => ['display' => 'Italiano', 'locale' => 'it_IT.utf8'], |
|
184 | - 'nb' => ['display' => 'Norsk', 'locale' => 'nb_NO.utf8'], |
|
185 | - 'pl' => ['display' => 'Polski', 'locale' => 'pl_PL.utf8'], |
|
180 | + 'es' => ['display' => 'Español', 'locale' => 'es_ES.utf8'], |
|
181 | + 'gl' => ['display' => 'Galego', 'locale' => 'gl_ES.utf8'], |
|
182 | + 'hr' => ['display' => 'Hrvatski', 'locale' => 'hr_HR.utf8'], |
|
183 | + 'it' => ['display' => 'Italiano', 'locale' => 'it_IT.utf8'], |
|
184 | + 'nb' => ['display' => 'Norsk', 'locale' => 'nb_NO.utf8'], |
|
185 | + 'pl' => ['display' => 'Polski', 'locale' => 'pl_PL.utf8'], |
|
186 | 186 | 'sl' => ['display' => 'Slovenščina', 'locale' => 'sl_SI.utf8'], |
187 | - 'sr' => ['display' => 'Srpski', 'locale' => 'sr_RS@latin'], |
|
188 | - 'fi' => ['display' => 'Suomi', 'locale' => 'fi_FI.utf8'], |
|
189 | - 'el' => ['display' => 'Ελληνικά', 'locale' => 'el_GR.utf8'], |
|
190 | - 'hu' => ['display' => 'Magyar', 'locale' => 'hu_HU.utf8'], |
|
191 | - 'pt' => ['display' => 'Português', 'locale' => 'pt_PT.utf8'], |
|
187 | + 'sr' => ['display' => 'Srpski', 'locale' => 'sr_RS@latin'], |
|
188 | + 'fi' => ['display' => 'Suomi', 'locale' => 'fi_FI.utf8'], |
|
189 | + 'el' => ['display' => 'Ελληνικά', 'locale' => 'el_GR.utf8'], |
|
190 | + 'hu' => ['display' => 'Magyar', 'locale' => 'hu_HU.utf8'], |
|
191 | + 'pt' => ['display' => 'Português', 'locale' => 'pt_PT.utf8'], |
|
192 | 192 | |
193 | 193 | // For the following languages, partial translations exist in Transifex, but |
194 | 194 | // they are not complete enough for display. Their Transifex content is not |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | * NSIS version - with version 3 UTF installers will be created |
344 | 344 | * see also $PATHS['makensis'] |
345 | 345 | */ |
346 | - public static $NSIS_VERSION = 2 ; |
|
346 | + public static $NSIS_VERSION = 2; |
|
347 | 347 | |
348 | - public static $SUPERADMINS = [ |
|
348 | + public static $SUPERADMINS = [ |
|
349 | 349 | 'eptid:someuser', |
350 | 350 | 'http://sommeopenid.example/anotheruser', |
351 | 351 | 'I do not care about security!', |