Subversion Repositories oidplus

Rev

Rev 439 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 439 Rev 440
Line 362... Line 362...
362
                # PECL uuid extension like seen in php-uuid at Debian 9
362
                # PECL uuid extension like seen in php-uuid at Debian 9
363
                return trim(uuid_create(UUID_TYPE_TIME));
363
                return trim(uuid_create(UUID_TYPE_TIME));
364
        }
364
        }
365
 
365
 
366
        # On Debian: aptitude install uuid-runtime
366
        # On Debian: aptitude install uuid-runtime
367
        if (!stristr(PHP_OS, 'WINDOWS')) {
367
        if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
368
                $out = array();
368
                $out = array();
369
                $ec = -1;
369
                $ec = -1;
370
                exec('uuidgen -t', $out, $ec);
370
                exec('uuidgen -t', $out, $ec);
371
                if ($ec == 0) return $out[0];
371
                if ($ec == 0) return $out[0];
372
        }
372
        }
Line 432... Line 432...
432
function get_mac_address() {
432
function get_mac_address() {
433
        // TODO: This should actually be part of mac_utils.inc.php, but we need it
433
        // TODO: This should actually be part of mac_utils.inc.php, but we need it
434
        //       here, and mac_utils.inc.php shall only be optional. What to do?
434
        //       here, and mac_utils.inc.php shall only be optional. What to do?
435
        $out = array();
435
        $out = array();
436
        $ec = -1;
436
        $ec = -1;
437
        if (stristr(PHP_OS, 'WINDOWS')) {
437
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
438
                exec("ipconfig /all", $out, $ec);
438
                exec("ipconfig /all", $out, $ec);
439
                if ($ec == 0) {
439
                if ($ec == 0) {
440
                        $out = implode("\n",$out);
440
                        $out = implode("\n",$out);
-
 
441
                        $m = array();
441
                        if (preg_match("/([0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2})/ismU", $out, $m)) {
442
                        if (preg_match("/([0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2}\\-[0-9a-f]{2})/ismU", $out, $m)) {
442
                                return $m[1];
443
                                return str_replace('-', ':', strtolower($m[1]));
443
                        }
444
                        }
444
                }
445
                }
445
        } else {
446
        } else {
446
                exec("netstat -ie", $out, $ec);
447
                exec("netstat -ie", $out, $ec);
447
                if ($ec == 0) {
448
                if ($ec == 0) {
448
                        $out = implode("\n",$out);
449
                        $out = implode("\n",$out);
-
 
450
                        $m = array();
449
                        if (preg_match("/([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})/ismU", $out, $m)) {
451
                        if (preg_match("/([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})/ismU", $out, $m)) {
450
                                return $m[1];
452
                                return $m[1];
451
                        }
453
                        }
452
                }
454
                }
453
        }
455
        }
Line 504... Line 506...
504
 
506
 
505
                # PECL uuid extension like seen in php-uuid at Debian 9
507
                # PECL uuid extension like seen in php-uuid at Debian 9
506
                return trim(uuid_create(UUID_TYPE_RANDOM));
508
                return trim(uuid_create(UUID_TYPE_RANDOM));
507
        }
509
        }
508
 
510
 
509
        if (!stristr(PHP_OS, 'WINDOWS')) {
511
        if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
510
                # On Debian: aptitude install uuid-runtime
512
                # On Debian: aptitude install uuid-runtime
511
                $out = array();
513
                $out = array();
512
                $ec = -1;
514
                $ec = -1;
513
                exec('uuidgen -r', $out, $ec);
515
                exec('uuidgen -r', $out, $ec);
514
                if ($ec == 0) return $out[0];
516
                if ($ec == 0) return $out[0];