Test Failed
Push — master ( 9dc220...59de9a )
by Tomasz
10:00
created

WindowsCommon::scaleLogo()   B

Complexity

Conditions 6
Paths 8

Size

Total Lines 31
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 31
rs 8.9297
cc 6
nc 8
nop 2
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
Bug introduced by
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
Bug introduced by
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
            try {
258
                $imageObject = new \Gmagick($imagePath); 
259
            } catch (Exception $e) {
260
                return NULL;
261
            }
262
        } else {
263
            try {
264
                $imageObject = new \Imagick($imagePath);
265
            } catch (Exception $e) {
266
                return NULL;
267
            }
268
        }
269
        $imageSize = $imageObject->getImageGeometry();
0 ignored issues
show
Bug introduced by
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

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

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