diff --git a/lib/API.php b/lib/API.php index 1168829403ef10cc3ce772faf7a80dc489af719b..591ff8207e6115d74e9fe4f0f63512a6906a331b 100644 --- a/lib/API.php +++ b/lib/API.php @@ -530,7 +530,7 @@ class API { 'header' => "Show federation detils.", 'supportedFormats' => ['json', 'print_r'], 'arguments' => [ - $this->addStdArgument('fed_id', TRUE), + $this->addStdArgument('fed_id'), $this->addStdArgument('reg_auth'), $this->addStdArgument('format'), ], @@ -555,6 +555,7 @@ class API { $show_email = 1; } $edugain->load_federation_details('sha1', $show_email); + $edugain->load_federation_stats(); $out = $edugain->FEDS[$this->fed_id]; return $out; } diff --git a/page-logic/status.php b/page-logic/status.php index 75670e4dd75cf83bcca8dcef262c08e367a3be2b..61bd9c328ffd6ab328b5056d208cd973658e8c09 100644 --- a/page-logic/status.php +++ b/page-logic/status.php @@ -143,29 +143,64 @@ function dateMissingCheck($federation, $fieldName) { return !isset($federation[$fieldName]) || $federation[$fieldName] == '0000-00-00 00:00:00'; } -foreach ($edugain->FEDS as $countryCode => $federation) { - $status = $federation['status']; - $processedFederation = processFederation($federation); - $processedFederation['status'] = $status; - if ($status) { // This will exclude federations with a status of 0 (lib/Status.php ln 124) - if ($status < 4 && $status != 2) { - $candidates[] = $processedFederation; - } else if ($status > 3 && $status < 5) { - $votingOnly[] = $processedFederation; - } else if ($status == 6 || $status == 5) { - $participants[] = $processedFederation; - } +$data = []; +$singleFed = false; +$reg_auth_safe = ''; +if (!empty($_REQUEST['fed_id'])) { + $code = $_REQUEST['fed_id']; + if (!preg_match('/^:?([a-zA-Z]*-?[a-zA-Z]*)(:[a-aA-Z]*-?[a-zA-Z]*)*$/', $code)) { + exit; } + $singleFed = true; } +if (!empty($_REQUEST['reg_auth'])) { + $reg_auth = $_REQUEST['reg_auth']; + $reg_auth_safe = $edugain->cleanInput($reg_auth); + $singleFed = true; +// print $reg_auth_safe; +} -$data = []; -$data['participants'] = $participants; -$data['votingOnly'] = $votingOnly; -$data['candidates'] = $candidates; -if (isset($_GET['issues'])) { - $data['problem_switch'] = 1; +if ($singleFed) { + $my_federation = ''; + foreach ($edugain->FEDS as $countryCode => $federation) { + if ($code !== $countryCode && ($reg_auth_safe === '' || $reg_auth_safe !== $federation['reg_auth'])) { + continue; + } + $status = $federation['status']; + if ($status === 0) { + exit; + } + $processedFederation['status'] = $status; + $my_federation = processFederation($federation); + } + if ($my_federation === '') { + exit; + } + $data['federation'] = $my_federation; + echo $twig->render('status/status-members-details.html', $data); } else { - $data['problem_switch'] = 0; + foreach ($edugain->FEDS as $countryCode => $federation) { + $status = $federation['status']; + $processedFederation = processFederation($federation); + $processedFederation['status'] = $status; + if ($status) { // This will exclude federations with a status of 0 (lib/Status.php ln 124) + if ($status < 4 && $status != 2) { + $candidates[] = $processedFederation; + } else if ($status > 3 && $status < 5) { + $votingOnly[] = $processedFederation; + } else if ($status == 6 || $status == 5) { + $participants[] = $processedFederation; + } + } + } + $data['participants'] = $participants; + $data['votingOnly'] = $votingOnly; + $data['candidates'] = $candidates; + if (isset($_GET['issues'])) { + $data['problem_switch'] = 1; + } else { + $data['problem_switch'] = 0; + } + echo $twig->render('status.html', $data); } -echo $twig->render('status.html', $data);