Issues (173)

Security Analysis    13 potential vulnerabilities

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting (3)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (6)
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting (1)
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

devices/ms/WindowsCommon.php (6 issues)

1
<?php
2
3
/*
4
 * *****************************************************************************
5
 * Contributions to this work were made on behalf of the GÉANT project, a 
6
 * project that has received funding from the European Union’s Framework 
7
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
8
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
9
 * 691567 (GN4-1) and No. 731122 (GN4-2).
10
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
11
 * of the copyright in all material which was developed by a member of the GÉANT
12
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
13
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
14
 * UK as a branch of GÉANT Vereniging.
15
 * 
16
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
17
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
18
 *
19
 * License: see the web/copyright.inc.php file in the file structure or
20
 *          <base_url>/copyright.php after deploying the software
21
 */
22
23
/**
24
 * This file contains common functions needed by all Windows installers
25
 * @author Tomasz Wolniewicz <[email protected]>
26
 *
27
 * @package ModuleWriting
28
 */
29
30
namespace devices\ms;
31
32
use \Exception;
0 ignored issues
show
The type \Exception was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
34
/**
35
 * This class defines common functions needed by all Windows installers
36
 * @author Tomasz Wolniewicz <[email protected]>
37
 *
38
 * @package ModuleWriting
39
 */
40
abstract class WindowsCommon extends \core\DeviceConfig
41
{
42
43
    /**
44
     * copies various common files into temp dir for inclusion into installers
45
     * 
46
     * @return void
47
     * @throws Exception
48
     */
49
    public function copyBasicFiles()
50
    {
51
        if (!($this->copyFile('wlan_test.exe') &&
52
                $this->copyFile('check_wired.cmd') &&
53
                $this->copyFile('install_wired.cmd') &&
54
                $this->copyFile('cat_bg.bmp') &&
55
                $this->copyFile('base64.nsh'))) {
56
            throw new Exception("Copying needed files (part 1) failed for at least one file!");
57
        }
58
59
        if (!($this->copyFile('cat32.ico') &&
60
                $this->copyFile('cat_150.bmp') &&
61
                $this->copyFile('WLANSetEAPUserData/WLANSetEAPUserData32.exe', 'WLANSetEAPUserDatax86.exe') &&
62
                $this->copyFile('WLANSetEAPUserData/WLANSetEAPUserData64.exe', 'WLANSetEAPUserDatax64.exe') &&
63
                $this->copyFile('WLANSetEAPUserData/WLANSetEAPUserDataARM64.exe', 'WLANSetEAPUserDataARM64.exe'))) {
64
            throw new Exception("Copying needed files (part 2) failed for at least one file!");
65
        }
66
        if (!$this->translateFile('common.inc', 'common.nsh')) {
67
            throw new Exception("Translating needed file common.inc failed!");
68
        }
69
        return;
70
    }
71
72
    /**
73
     *  Copy a file from the module location to the temporary directory applying transcoding.
74
     *
75
     * Transcoding is only required for Windows installers, and no Unicode support
76
     * in NSIS (NSIS version below 3)
77
     * Transcoding is only applied if the third optional parameter is set and nonzero
78
     * If CONFIG['NSIS']_VERSION is set to 3 or more, no transcoding will be applied
79
     * regardless of the third parameter value.
80
     * If the second argument is provided and is not equal to 0, then the file will be
81
     * saved under the name taken from this argument.
82
     * If only one parameter is given or the second is equal to 0, source and destination
83
     * filenames are the same.
84
     * The third optional parameter, if nonzero, should be the character set understood by iconv
85
     * This is required by the Windows installer and is expected to go away in the future.
86
     * Source file can be located either in the Files subdirectory or in the sibdirectory of Files
87
     * named the same as device_id. The second option takes precedence.
88
     *
89
     * @param string $source_name The source file name
90
     * @param string $output_name The destination file name
91
     * @return boolean
92
     * @final not to be redefined
93
     */
94
    final protected function translateFile($source_name, $output_name = NULL)
95
    {
96
        // there is no explicit gettext() call in this function, but catalogues
97
        // and translations occur in the various ".inc" files - so make sure we
98
        // operate in the correct catalogue
99
        \core\common\Entity::intoThePotatoes();
100
        if ($output_name === NULL) {
101
            $output_name = $source_name;
102
        }
103
104
        $this->loggerInstance->debug(5, "translateFile($source_name, $output_name)\n");
105
        ob_start();
106
        $this->loggerInstance->debug(5, $this->module_path . '/Files/' . $this->device_id . '/' . $source_name . "\n");
107
        $source = $this->findSourceFile($source_name);
108
109
        if ($source !== false) { // if there is no file found, don't attempt to include an uninitialised variable
110
            include $source;
111
        }
112
        $output = ob_get_clean();
113
        $fileHandle = fopen("$output_name", "w");
114
        if ($fileHandle === false) {
115
            $this->loggerInstance->debug(2, "translateFile($source, $output_name) failed\n");
116
            \core\common\Entity::outOfThePotatoes();
117
            return false;
118
        }
119
        fwrite($fileHandle, $output);
120
        fclose($fileHandle);
121
        $this->loggerInstance->debug(5, "translateFile($source, $output_name) end\n");
122
        \core\common\Entity::outOfThePotatoes();
123
        return true;
124
    }
125
126
    /**
127
     * Transcode a string adding double quotes escaping
128
     *
129
     * Transcoding is only required for Windows installers, and no Unicode support
130
     * in NSIS (NSIS version below 3)
131
     * Transcoding is only applied if the third optional parameter is set and nonzero
132
     * If CONFIG['NSIS']_VERSION is set to 3 or more, no transcoding will be applied
133
     * regardless of the second parameter value.
134
     * The second optional parameter, if nonzero, should be the character set understood by iconv
135
     * This is required by the Windows installer and is expected to go away in the future.
136
     *
137
     * @param string $source_string The source string
138
     * @param int    $encoding      Set Windows charset if non-zero
139
     * @return string
140
     * @final not to be redefined
141
     */
142
    final protected function translateString($source_string)
143
    {
144
        $this->loggerInstance->debug(5, "translateString input: \"$source_string\"\n");
145
        if (empty($source_string)) {
146
            return $source_string;
147
        }
148
149
        $output_c = $source_string;
150
        $source_string = str_replace('"', '$\\"', $output_c);
151
152
        return $source_string;
153
    }
154
155
156
    /**
157
     * copies GEANTlink files into temp dir for later inclusion into installers
158
     * 
159
     * @return void
160
     * @throws Exception
161
     */
162
    public function copyGeantLinkFiles()
163
    {
164
        if (!($this->copyFile('GEANTLink/GEANTLink-x86.msi', 'GEANTLink-x86.msi') &&
165
                $this->copyFile('GEANTLink/GEANTLink-x64.msi', 'GEANTLink-x64.msi') &&
166
                $this->copyFile('GEANTLink/GEANTLink-ARM64.msi', 'GEANTLink-ARM64.msi') &&
167
                $this->copyFile('GEANTLink/CredWrite.exe', 'CredWrite.exe') &&
168
                $this->copyFile('GEANTLink/MsiUseFeature.exe', 'MsiUseFeature.exe'))) {
169
            throw new Exception("Copying needed files (GEANTLink) failed for at least one file!");
170
        }
171
        if (!$this->translateFile('geant_link.inc', 'cat.NSI')) {
172
            throw new Exception("Translating needed file geant_link.inc failed!");
173
        }
174
    }
175
176
    /**
177
     * function to escape double quotes in a special NSI-compatible way
178
     * 
179
     * @param string $in input string
180
     * @return string
181
     */
182
    public static function echoNsis($in)
183
    {
184
        echo preg_replace('/"/', '$\"', $in);
185
    }
186
187
    /**
188
     * @param string $input input string
189
     * @return string
190
     */
191
    public static function sprintNsis($input)
192
    {
193
        return preg_replace('/"/', '$\"', $input);
194
    }
195
196
    /**
197
     * determine Windows language settings based on requested installer language
198
     * 
199
     * @return void
200
     */
201
    protected function prepareInstallerLang()
202
    {
203
        if (isset($this->LANGS[$this->languageInstance->getLang()])) {
204
            $this->lang = $this->LANGS[$this->languageInstance->getLang()];
205
        } else {
206
            $this->lang = 'English';
207
        }
208
    }
209
210
    /**
211
     * creates HTML code which will be displayed when the "info" button is pressed
212
     * 
213
     * @return string the HTML code
214
     */
215
    public function writeDeviceInfo()
216
    {
217
        \core\common\Entity::intoThePotatoes();
218
        $networkList = [];
219
        foreach (array_keys($this->getAttribute('internal:networks')) as $networkName) {
0 ignored issues
show
It seems like $this->getAttribute('internal:networks') can also be of type null; however, parameter $array of array_keys() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

219
        foreach (array_keys(/** @scrutinizer ignore-type */ $this->getAttribute('internal:networks')) as $networkName) {
Loading history...
220
            $networkList[] = $networkName;
221
        }
222
        $configNetworkList = [];
223
        foreach (array_keys(\config\ConfAssistant::CONSORTIUM['networks']) as $networkName) {
224
            $configNetworkList[] = $networkName;
225
        }
226
227
        $configCount = count($configNetworkList);
228
        $networksCount = count($networkList);
229
        $out = "<p>";
230
        $out .= sprintf(_("%s installer will be in the form of an EXE file. It will configure %s on your device, by creating wireless network profiles.<p>When you click the download button, the installer will be saved by your browser. Copy it to the machine you want to configure and execute."), \config\ConfAssistant::CONSORTIUM['display_name'], \config\ConfAssistant::CONSORTIUM['display_name']);
231
        $out .= "<p>";
232
        if ($networksCount > $configCount) {
233
            $out .= sprintf(ngettext("In addition to <strong>%s</strong> the installer will also configure access to:", "In addition to <strong>%s</strong> the installer will also configure access to the following networks:", $networksCount - $configCount), implode(', ', $configNetworkList)) . " ";
234
            $out .= '<strong>' . join('</strong>, <strong>', array_diff($networkList, $configNetworkList)) . '</strong>';
235
            $out .= "<p>";
236
        }
237
// TODO - change this below
238
        if ($this->selectedEapObject->isClientCertRequired()) {
239
            $out .= _("In order to connect to the network you will need an a personal certificate in the form of a p12 file. You should obtain this certificate from your organisation. Consult the support page to find out how this certificate can be obtained. Such certificate files are password protected. You should have both the file and the password available during the installation process.");
240
            return $out;
241
        }
242
        // not EAP-TLS
243
        $out .= _("In order to connect to the network you will need an account from your organisation. You should consult the support page to find out how this account can be obtained. It is very likely that your account is already activated.");
244
        \core\common\Entity::outOfThePotatoes();
245
        return $out;
246
    }
247
248
    /**
249
     * scales a logo to the desired size
250
     * @param string $imagePath path to the image
251
     * @param int    $maxSize   maximum size of output image (larger axis counts)
252
     * @return \Imagick|\GMagick *Magick image object
253
     */
254
    private function scaleLogo($imagePath, $maxSize)
255
    {
256
        if (class_exists('\\Gmagick')) { 
257
            $imageObject = new \Gmagick($imagePath); 
258
        } else {
259
            $imageObject = new \Imagick($imagePath);
260
        }
261
        $imageSize = $imageObject->getImageGeometry();
0 ignored issues
show
The method getImageGeometry() does not exist on Gmagick. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

261
        /** @scrutinizer ignore-call */ 
262
        $imageSize = $imageObject->getImageGeometry();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
262
        $imageMax = max($imageSize);
263
        $this->loggerInstance->debug(5, "Logo size: ");
264
        $this->loggerInstance->debug(5, $imageSize);
265
        $this->loggerInstance->debug(5, "max=$imageMax\n");
266
// resize logo if necessary
267
        if ($imageMax > $maxSize) {
268
            if ($imageMax == $imageSize['width']) {
269
                $imageObject->scaleImage($maxSize, 0);
270
            } else {
271
                $imageObject->scaleImage(0, $maxSize);
272
            }
273
        }
274
        $imageSize = $imageObject->getImageGeometry();
275
        $this->background['freeHeight'] -= $imageSize['height'];
276
        return($imageObject);
277
    }
278
279
    /**
280
     * combines the inst and federation logo into one image and writes to file
281
     * 
282
     * @param array $logos   inst logo meta info
283
     * @param array $fedLogo fed logo meta info
284
     * @return void
285
     */
286
    protected function combineLogo($logos = NULL, $fedLogo = NULL)
287
    {
288
        // maximum size to which we want to resize the logos
289
290
        $maxSize = 120;
291
        // $freeTop is set to how much vertical space we need to leave at the top
292
        // this will depend on the design of the background
293
        $freeTop = 70;
294
        // $freeBottom is set to how much vertical space we need to leave at the bottom
295
        // this will depend on the design of the background
296
        // we are prefixig the paths with getcwd() which might appear unnecessary
297
        // but under some conditions appeared to be required
298
        $freeBottom = 30;
299
        if (class_exists('\\Gmagick')) { 
300
            $bgImage = new \Gmagick(getcwd().'/cat_bg.bmp');
301
        } else {
302
            $bgImage = new \Imagick(getcwd().'/cat_bg.bmp');
303
        }
304
        $bgImage->setFormat('BMP3');
0 ignored issues
show
The method setFormat() does not exist on Gmagick. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

304
        $bgImage->/** @scrutinizer ignore-call */ 
305
                  setFormat('BMP3');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
305
        $bgImageSize = $bgImage->getImageGeometry();
306
        $logosToPlace = [];
307
        $this->background = [];
308
        $this->background['freeHeight'] = $bgImageSize['height'] - $freeTop - $freeBottom;
309
310
        if ($this->getAttribute('fed:include_logo_installers') === NULL) {
311
            $fedLogo = NULL;
312
        }
313
        if ($fedLogo != NULL) {
314
            $logosToPlace[] = $this->scaleLogo(getcwd()."/".$fedLogo[0]['name'], $maxSize);
315
        }
316
        if ($logos != NULL) {
317
            $logosToPlace[] = $this->scaleLogo(getcwd()."/".$logos[0]['name'], $maxSize);
318
        }
319
320
        $logoCount = count($logosToPlace);
321
        if ($logoCount > 0) {
322
            $voffset = $freeTop;
323
            $freeSpace = (int) round($this->background['freeHeight'] / ($logoCount + 1));
324
            foreach ($logosToPlace as $logo) {
325
                $voffset += $freeSpace;
326
                $logoSize = $logo->getImageGeometry();
327
                $hoffset = (int) round(($bgImageSize['width'] - $logoSize['width']) / 2);
328
                $bgImage->compositeImage($logo, $logo->getImageCompose(), $hoffset, $voffset);
329
                $voffset += $logoSize['height'];
330
            }
331
        }
332
//new image is saved as the background
333
        $bgImage->writeImage('BMP3:'.getcwd().'/cat_bg.bmp');
334
    }
335
336
    /**
337
     * adds a digital signature to the installer, and returns path to file
338
     * 
339
     * @return string path to signed installer
340
     */
341
    protected function signInstaller()
342
    {
343
        $fileName = $this->installerBasename . '.exe';
344
        if (!$this->sign) {
345
            rename("installer.exe", $fileName);
346
            return $fileName;
347
        }
348
        $retval = 0;
349
        // are actually signing
350
        $outputFromSigning = system($this->sign . " installer.exe '$fileName' > /dev/null", $retval);
351
        $this->loggerInstance->debug(4, $retval, "Output from Windows signing:", "==\n");
352
        if ($retval !== 0 || $outputFromSigning === false) {
353
            $this->loggerInstance->debug(2, "Signing the WindowsCommon installer $fileName FAILED!\n");
354
            // we are passing a name that will be then used as a path - this will not exist, hence an error will
355
            // be generated
356
            return("no_go");
357
        }
358
        return $fileName;
359
    }
360
361
    /**
362
     * creates one single installer .exe out of the NSH inputs and other files
363
     * 
364
     * @return void
365
     */
366
    protected function compileNSIS()
367
    {
368
        $makensis = \config\ConfAssistant::PATHS['makensis'] . " -INPUTCHARSET UTF8";
369
        $lcAll = getenv("LC_ALL");
370
        putenv("LC_ALL=en_US.UTF-8");
371
        $command = $makensis . ' -V4 cat.NSI > nsis.log 2>&1';
372
        system($command);
373
        putenv("LC_ALL=" . $lcAll);
374
        $this->loggerInstance->debug(4, "compileNSIS:$command\n");
375
    }
376
377
    /**
378
     * find out where the user can get support
379
     * 
380
     * @param array  $attr list of profile attributes
381
     * @param string $type which type of support resource to we want
382
     * @return string NSH line with the resulting !define
383
     */
384
    private function getSupport($attr, $type)
385
    {
386
        $supportString = [
387
            'email' => 'SUPPORT',
388
            'url' => 'URL',
389
        ];
390
        $s = "support_" . $type . "_substitute";
391
        $substitute = $this->translateString($this->$s);
392
        $returnValue = !empty($attr['support:' . $type][0]) ? $attr['support:' . $type][0] : $substitute;
393
        return '!define ' . $supportString[$type] . ' "' . $returnValue . '"' . "\n";
394
    }
395
396
    /**
397
     * returns various NSH !define statements for later inclusion into main file
398
     * 
399
     * @param array $attr profile attributes
400
     * @return string
401
     */
402
    protected function writeNsisDefines($attr)
403
    {
404
        $fcontents = '';
405
        if ($attr['internal:profile_count'][0] > 1) {
406
            $fcontents .= "\n" . '!define USER_GROUP "' . $this->translateString(str_replace('"', '$\\"', $attr['profile:name'][0])) . '"
407
';
408
        }
409
        $fcontents .= '
410
Caption "' . $this->translateString(sprintf(WindowsCommon::sprintNsis(_("%s installer for %s")), \config\ConfAssistant::CONSORTIUM['display_name'], $attr['general:instname'][0])) . '"
411
!define APPLICATION "' . $this->translateString(sprintf(WindowsCommon::sprintNsis(_("%s installer for %s")), \config\ConfAssistant::CONSORTIUM['display_name'], $attr['general:instname'][0])) . '"
412
!define VERSION "' . \core\CAT::VERSION_MAJOR . '.' . \core\CAT::VERSION_MINOR . '.' . \core\CAT::VERSION_PATCH . '"
413
!define INSTALLER_NAME "installer.exe"
414
!define LANG "' . $this->lang . '"
415
!define LOCALE "' . preg_replace('/\..*$/', '', \config\Master::LANGUAGES[$this->languageInstance->getLang()]['locale']) . '"
416
;--------------------------------
417
!define ORGANISATION "' . $this->translateString($attr['general:instname'][0]) . '"
418
';
419
        $fcontents .= $this->getSupport($attr, 'email');
420
        $fcontents .= $this->getSupport($attr, 'url');
421
        if (\core\common\Entity::getAttributeValue($attr, 'media:wired', 0) == 'on') {
422
            $fcontents .= '!define WIRED
423
        ';
424
        }
425
        $fcontents .= '!define PROVIDERID "urn:UUID:' . $this->deviceUUID . '"
426
';
427
        if (!empty($attr['internal:realm'][0])) {
428
            $fcontents .= '!define REALM "' . $attr['internal:realm'][0] . '"
429
';
430
        }
431
        if (!empty($attr['internal:hint_userinput_suffix'][0]) && $attr['internal:hint_userinput_suffix'][0] == 1) {
432
            $fcontents .= '!define HINT_USER_INPUT "' . $attr['internal:hint_userinput_suffix'][0] . '"
433
';
434
        }
435
        if (!empty($attr['internal:verify_userinput_suffix'][0]) && $attr['internal:verify_userinput_suffix'][0] == 1) {
436
            $fcontents .= '!define VERIFY_USER_REALM_INPUT "' . $attr['internal:verify_userinput_suffix'][0] . '"
437
';
438
        }
439
        $fcontents .= $this->msInfoFile($attr);
440
        return $fcontents;
441
    }
442
443
    /**
444
     * includes NSH commands displaying terms of use file into installer, if any
445
     * 
446
     * @param array $attr profile attributes
447
     * @return string NSH commands
448
     * @throws Exception
449
     */
450
    protected function msInfoFile($attr)
451
    {
452
        $out = '';
453
        if (isset($attr['support:info_file'])) {
454
            $out .= '!define EXTERNAL_INFO "';
455
//  $this->loggerInstance->debug(4,"Info file type ".$attr['support:info_file'][0]['mime']."\n");
456
            if ($attr['internal:info_file'][0]['mime'] == 'rtf') {
457
                $out = '!define LICENSE_FILE "' . $attr['internal:info_file'][0]['name'];
458
            } elseif ($attr['internal:info_file'][0]['mime'] == 'txt') {
459
                $infoFile = file_get_contents($attr['internal:info_file'][0]['name']);
460
                if ($infoFile === false) {
461
                    throw new Exception("We were told this file exists. Failing to read it is not really possible.");
462
                }
463
                $infoFileConverted = $infoFile;
464
465
                if ($infoFileConverted !== false && strlen($infoFileConverted) > 0) {
466
                    file_put_contents('info_f.txt', $infoFileConverted);
467
                    $out = '!define LICENSE_FILE " info_f.txt';
468
                }
469
            } else {
470
                $out = '!define EXTERNAL_INFO "' . $attr['internal:info_file'][0]['name'];
471
            }
472
473
            $out .= "\"\n";
474
        }
475
        $this->loggerInstance->debug(4, "Info file returned: $out");
476
        return $out;
477
    }
478
479
    /**
480
     * writes commands to delete SSIDs, if any, into a file
481
     * 
482
     * @param array $profiles WLAN profiles to delete
483
     * @return void
484
     * @throws Exception
485
     */
486
    protected function writeAdditionalDeletes($profiles)
487
    {
488
        if (count($profiles) == 0) {
489
            return;
490
        }
491
        $fileHandle = fopen('profiles.nsh', 'a');
492
        if ($fileHandle === false) {
493
            throw new Exception("Unable to open possibly pre-existing profiles.nsh to append additional deletes.");
494
        }
495
        fwrite($fileHandle, "!define AdditionalDeletes\n");
496
        foreach ($profiles as $profile) {
497
            fwrite($fileHandle, "!insertmacro define_delete_profile \"$profile\"\n");
498
        }
499
        fclose($fileHandle);
500
    }
501
502
    /**
503
     * writes client certificate into file
504
     * 
505
     * @return void
506
     * @throws Exception
507
     */
508
    protected function writeClientP12File()
509
    {
510
        if (!is_array($this->clientCert)) {
511
            throw new Exception("the client block was called but there is no client certificate!");
512
        }
513
        file_put_contents('SB_cert.p12', $this->clientCert["certdata"]);
514
    }
515
516
    public $LANGS = [
517
        'fr' => "French",
518
        'de' => "German",
519
        'es' => "SpanishInternational",
520
        'it' => "Italian",
521
        'nl' => "Dutch",
522
        'sv' => "Swedish",
523
        'fi' => "Finnish",
524
        'pl' => "Polish",
525
        'ca' => "Catalan",
526
        'sr' => "SerbianLatin",
527
        'hr' => "Croatian",
528
        'sl' => "Slovenian",
529
        'da' => "Danish",
530
        'nb' => "Norwegian",
531
        'nn' => "NorwegianNynorsk",
532
        'el' => "Greek",
533
        'ru' => "Russian",
534
        'pt' => "Portuguese",
535
        'uk' => "Ukrainian",
536
        'cs' => "Czech",
537
        'sk' => "Slovak",
538
        'bg' => "Bulgarian",
539
        'hu' => "Hungarian",
540
        'ro' => "Romanian",
541
        'lv' => "Latvian",
542
        'mk' => "Macedonian",
543
        'et' => "Estonian",
544
        'tr' => "Turkish",
545
        'lt' => "Lithuanian",
546
        'ar' => "Arabic",
547
        'he' => "Hebrew",
548
        'id' => "Indonesian",
549
        'mn' => "Mongolian",
550
        'sq' => "Albanian",
551
        'br' => "Breton",
552
        'be' => "Belarusian",
553
        'is' => "Icelandic",
554
        'ms' => "Malay",
555
        'bs' => "Bosnian",
556
        'ga' => "Irish",
557
        'uz' => "Uzbek",
558
        'gl' => "Galician",
559
        'af' => "Afrikaans",
560
        'ast' => "Asturian",
561
    ];
562
    
563
    
564
    /**
565
     * this constant controls if the system generates sepaarate SSID and OI profiles
566
     * or puts all settings into a single profile
567
     */
568
    const separateHS20profiles = true;
0 ignored issues
show
This class constant is not uppercase (expected SEPARATEHS20PROFILES).
Loading history...
569
    /**
570
     * this constant controls if the system generates sepaarate profiles for every SSID
571
     * for it to work, the separateHS20profiles needs also be set to true
572
     */
573
    const separateSSIDprofiles = true;
0 ignored issues
show
This class constant is not uppercase (expected SEPARATESSIDPROFILES).
Loading history...
574
    
575
    public $codePage;
576
    public $lang;
577
    public $useGeantLink = false;
578
    private $background;
579
580
}
581