Some fixes

This commit is contained in:
Geoffrey Frogeye 2016-12-10 20:16:23 +01:00
parent 931a6ae2b3
commit f308830095

View file

@ -1,9 +1,8 @@
<?php
require __DIR__ . '/vendor/autoload.php';
use OTPHP\TOTP;
include_once('config.inc.php');
require_once('config.inc.php');
$route = explode('/', trim(substr(explode('?', $_SERVER['REDIRECT_URL'])[0], strrpos($_SERVER['SCRIPT_NAME'], '/')), '/'));
$meth = $_SERVER['REQUEST_METHOD'];
@ -190,12 +189,22 @@ function getKeys($network) {
global $SSH_KEY_REGEX;
global $DOMAIN;
$machines = load('machine');
$networks = load('networks');
$networks = load('network');
$t = '';
foreach ($machines as $machineName => $machine) {
if (
(isset($machine['network']) && isset($networks[$machine['network']]) && $networks[$machine['network']]['secure'] == 'true')
|| ($network && in_array($machine['network'], $network['allowed']))
(
isset($machine['network'])
&& isset($networks[$machine['network']])
) && (
(
$networks[$machine['network']]['secure'] == 'true'
) || (
$network
&& isset($network['allowed'])
&& in_array($machine['network'], $network['allowed'])
)
)
) {
if (isset($machine['userkey']) && preg_match($SSH_KEY_REGEX, $machine['userkey'], $matches)) {
$t .= $matches[0].' '.$machineName.'@'.($machine['network'] ? $machine['network'].'.' : '').$DOMAIN."\n";