From 9513075bc8bde28a4c4eaeb842f69cfd7b2770f5 Mon Sep 17 00:00:00 2001 From: Tomasz Wolniewicz Date: Tue, 5 Nov 2024 10:54:55 +0100 Subject: [PATCH] fixes resolving issues #312 and #313 --- core/CAT.php | 506 ++++++++++++++------------- core/ExternalEduroamDBData.php | 8 +- core/Federation.php | 3 +- web/admin/action_req_certificate.php | 13 +- 4 files changed, 267 insertions(+), 263 deletions(-) diff --git a/core/CAT.php b/core/CAT.php index bb68ffd4f..824e37414 100644 --- a/core/CAT.php +++ b/core/CAT.php @@ -140,255 +140,255 @@ public function __construct() */ $this->knownFederations = [ - 'AD' => _("Andorra"), - 'AT' => _("Austria"), - 'BE' => _("Belgium"), - 'BG' => _("Bulgaria"), - 'CY' => _("Cyprus"), - 'CZ' => _("Czech Republic"), - 'DK' => _("Denmark"), - 'EE' => _("Estonia"), - 'FI' => _("Finland"), - 'FR' => _("France"), - 'DE' => _("Germany"), - 'GR' => _("Greece"), - 'HR' => _("Croatia"), - 'IE' => _("Ireland"), - 'IS' => _("Iceland"), - 'IT' => _("Italy"), - 'HU' => _("Hungary"), - 'KS' => _("Kosovo"), - 'LU' => _("Luxembourg"), - 'LV' => _("Latvia"), - 'LT' => _("Lithuania"), - 'MK' => _("Macedonia"), - 'RS' => _("Serbia"), - 'NL' => _("Netherlands"), - 'NO' => _("Norway"), - 'PL' => _("Poland"), - 'PT' => _("Portugal"), - 'RO' => _("Romania"), - 'SI' => _("Slovenia"), - 'ES' => _("Spain"), - 'SE' => _("Sweden"), - 'SK' => _("Slovakia"), - 'CH' => _("Switzerland"), - 'TR' => _("Turkey"), - 'UK' => _("United Kingdom"), - 'TEST' => 'TEST Country', - 'AU' => _("Australia"), - 'CA' => _("Canada"), - 'IL' => _("Israel"), - 'JP' => _("Japan"), - 'NZ' => _("New Zealand"), - 'US' => _("U.S.A."), - 'BR' => _("Brazil"), - 'CL' => _("Chile"), - 'PE' => _("Peru"), - 'VE' => _("Venezuela"), - 'DEFAULT' => _("Default"), - 'AM' => _("Armenia"), - 'AZ' => _("Azerbaijan"), - 'BY' => _("Belarus"), - 'EC' => _("Ecuador"), - 'HK' => _("Hong Kong"), - 'KE' => _("Kenya"), - 'KG' => _("Kyrgyzstan"), - 'KR' => _("Korea"), - 'KZ' => _("Kazakhstan"), - 'MA' => _("Morocco"), - 'MD' => _("Moldova"), - 'ME' => _("Montenegro"), - 'MO' => _("Macau"), - 'MT' => _("Malta"), - 'RU' => _("Russia"), - 'SG' => _("Singapore"), - 'TH' => _("Thailand"), - 'TW' => _("Taiwan"), - 'ZA' => _("South Africa"), - 'AF' => 'Afghanistan', - 'AL' => 'Albania', - 'DZ' => 'Algeria', - 'AS' => 'American Samoa', - 'AO' => 'Angola', - 'AI' => 'Anguilla', - 'AQ' => 'Antarctica', - 'AG' => 'Antigua And Barbuda', - 'AR' => 'Argentina', - 'AW' => 'Aruba', - 'BS' => 'Bahamas, The', - 'BH' => 'Bahrain', - 'BD' => 'Bangladesh', - 'BB' => 'Barbados', - 'BZ' => 'Belize', - 'BJ' => 'Benin', - 'BM' => 'Bermuda', - 'BT' => 'Bhutan', - 'BO' => 'Bolivia', - 'BA' => 'Bosnia And Herzegovina', - 'BW' => 'Botswana', - 'BV' => 'Bouvet Island', - 'IO' => 'British Indian Ocean Territory', - 'BN' => 'Brunei', - 'BF' => 'Burkina Faso', - 'MM' => 'Burma', - 'BI' => 'Burundi', - 'KH' => 'Cambodia', - 'CM' => 'Cameroon', - 'CV' => 'Cape Verde', - 'KY' => 'Cayman Islands', - 'CF' => 'Central African Republic', - 'TD' => 'Chad', - 'CN' => 'China', - 'CX' => 'Christmas Island', - 'CC' => 'Cocos (keeling) Islands', - 'CO' => 'Colombia', - 'KM' => 'Comoros', - 'CG' => 'Congo (brazzaville) ', - 'CD' => 'Congo (kinshasa)', - 'CK' => 'Cook Islands', - 'CR' => 'Costa Rica', - 'CI' => 'CÔte D’ivoire', - 'CU' => 'Cuba', - 'CW' => 'CuraÇao', - 'DJ' => 'Djibouti', - 'DM' => 'Dominica', - 'DO' => 'Dominican Republic', - 'EG' => 'Egypt', - 'SV' => 'El Salvador', - 'GQ' => 'Equatorial Guinea', - 'ER' => 'Eritrea', - 'ET' => 'Ethiopia', - 'FK' => 'Falkland Islands (islas Malvinas)', - 'FO' => 'Faroe Islands', - 'FJ' => 'Fiji', - 'GF' => 'French Guiana', - 'PF' => 'French Polynesia', - 'TF' => 'French Southern And Antarctic Lands', - 'GA' => 'Gabon', - 'GM' => 'Gambia, The', - 'GE' => 'Georgia', - 'GEANT' => 'The GEANT country', - 'GH' => 'Ghana', - 'GI' => 'Gibraltar', - 'GL' => 'Greenland', - 'GD' => 'Grenada', - 'GP' => 'Guadeloupe', - 'GU' => 'Guam', - 'GT' => 'Guatemala', - 'GG' => 'Guernsey', - 'GN' => 'Guinea', - 'GW' => 'Guinea-bissau', - 'GY' => 'Guyana', - 'HT' => 'Haiti', - 'HM' => 'Heard Island And Mcdonald Islands', - 'HN' => 'Honduras', - 'IN' => 'India', - 'ID' => 'Indonesia', - 'IR' => 'Iran', - 'IQ' => 'Iraq', - 'IM' => 'Isle Of Man', - 'JM' => 'Jamaica', - 'JE' => 'Jersey', - 'JO' => 'Jordan', - 'KI' => 'Kiribati', - 'KP' => 'Korea, North', - 'KW' => 'Kuwait', - 'LA' => 'Laos', - 'LB' => 'Lebanon', - 'LS' => 'Lesotho', - 'LR' => 'Liberia', - 'LY' => 'Libya', - 'LI' => 'Liechtenstein', - 'MG' => 'Madagascar', - 'MW' => 'Malawi', - 'MY' => 'Malaysia', - 'MV' => 'Maldives', - 'ML' => 'Mali', - 'MH' => 'Marshall Islands', - 'MQ' => 'Martinique', - 'MR' => 'Mauritania', - 'MU' => 'Mauritius', - 'YT' => 'Mayotte', - 'MX' => 'Mexico', - 'FM' => 'Micronesia, Federated States Of', - 'MC' => 'Monaco', - 'MN' => 'Mongolia', - 'MS' => 'Montserrat', - 'MZ' => 'Mozambique', - 'NA' => 'Namibia', - 'NR' => 'Nauru', - 'NP' => 'Nepal', - 'NC' => 'New Caledonia', - 'NI' => 'Nicaragua', - 'NE' => 'Niger', - 'NG' => 'Nigeria', - 'NU' => 'Niue', - 'NF' => 'Norfolk Island', - 'MP' => 'Northern Mariana Islands', - 'OM' => 'Oman', - 'PK' => 'Pakistan', - 'PW' => 'Palau', - 'PA' => 'Panama', - 'PG' => 'Papua New Guinea', - 'PY' => 'Paraguay', - 'PH' => 'Philippines', - 'PN' => 'Pitcairn Islands', - 'PR' => 'Puerto Rico', - 'QA' => 'Qatar', - 'RE' => 'Reunion', - 'RW' => 'Rwanda', - 'BL' => 'Saint Barthelemy', - 'SH' => 'Saint Helena, Ascension, And Tristan Da Cunha', - 'KN' => 'Saint Kitts And Nevis', - 'LC' => 'Saint Lucia', - 'MF' => 'Saint Martin', - 'PM' => 'Saint Pierre And Miquelon', - 'VC' => 'Saint Vincent And The Grenadines', - 'WS' => 'Samoa', - 'SM' => 'San Marino', - 'ST' => 'Sao Tome And Principe', - 'SA' => 'Saudi Arabia', - 'SN' => 'Senegal', - 'SC' => 'Seychelles', - 'SL' => 'Sierra Leone', - 'SX' => 'Sint Maarten', - 'SB' => 'Solomon Islands', - 'SO' => 'Somalia', - 'GS' => 'South Georgia And South Sandwich Islands', - 'SS' => 'South Sudan', - 'LK' => 'Sri Lanka', - 'SD' => 'Sudan', - 'SR' => 'Suriname', - 'SZ' => 'Swaziland', - 'SY' => 'Syria', - 'TJ' => 'Tajikistan', - 'TZ' => 'Tanzania', - 'TL' => 'Timor-leste', - 'TG' => 'Togo', - 'TK' => 'Tokelau', - 'TO' => 'Tonga', - 'TT' => 'Trinidad And Tobago', - 'TN' => 'Tunisia', - 'TM' => 'Turkmenistan', - 'TC' => 'Turks And Caicos Islands', - 'TV' => 'Tuvalu', - 'UG' => 'Uganda', - 'UA' => 'Ukraine', - 'AE' => 'United Arab Emirates', - 'GB' => 'United Kingdom', - 'UY' => 'Uruguay', - 'UZ' => 'Uzbekistan', - 'VU' => 'Vanuatu', - 'VA' => 'Vatican City', - 'VN' => 'Vietnam', - 'VG' => 'Virgin Islands, British', - 'VI' => 'Virgin Islands, United States ', - 'WF' => 'Wallis And Futuna', - 'EH' => 'Western Sahara', - 'YE' => 'Yemen', - 'ZM' => 'Zambia', - 'ZW' => 'Zimbabwe', + 'AD' => ['name'=>_("Andorra")], + 'AT' => ['name'=>_("Austria")], + 'BE' => ['name'=>_("Belgium")], + 'BG' => ['name'=>_("Bulgaria")], + 'CY' => ['name'=>_("Cyprus")], + 'CZ' => ['name'=>_("Czech Republic")], + 'DK' => ['name'=>_("Denmark")], + 'EE' => ['name'=>_("Estonia")], + 'FI' => ['name'=>_("Finland")], + 'FR' => ['name'=>_("France")], + 'DE' => ['name'=>_("Germany")], + 'GR' => ['name'=>_("Greece")], + 'HR' => ['name'=>_("Croatia")], + 'IE' => ['name'=>_("Ireland")], + 'IS' => ['name'=>_("Iceland")], + 'IT' => ['name'=>_("Italy")], + 'HU' => ['name'=>_("Hungary")], + 'KS' => ['name'=>_("Kosovo")], + 'LU' => ['name'=>_("Luxembourg")], + 'LV' => ['name'=>_("Latvia")], + 'LT' => ['name'=>_("Lithuania")], + 'MK' => ['name'=>_("Macedonia")], + 'RS' => ['name'=>_("Serbia")], + 'NL' => ['name'=>_("Netherlands")], + 'NO' => ['name'=>_("Norway")], + 'PL' => ['name'=>_("Poland"), 'code'=>'PS'], + 'PT' => ['name'=>_("Portugal")], + 'RO' => ['name'=>_("Romania")], + 'SI' => ['name'=>_("Slovenia")], + 'ES' => ['name'=>_("Spain")], + 'SE' => ['name'=>_("Sweden")], + 'SK' => ['name'=>_("Slovakia")], + 'CH' => ['name'=>_("Switzerland")], + 'TR' => ['name'=>_("Turkey")], + 'UK' => ['name'=>_("United Kingdom")], + 'TEST' => ['name'=>'TEST Country'], + 'AU' => ['name'=>_("Australia")], + 'CA' => ['name'=>_("Canada")], + 'IL' => ['name'=>_("Israel")], + 'JP' => ['name'=>_("Japan")], + 'NZ' => ['name'=>_("New Zealand")], + 'US' => ['name'=>_("U.S.A.")], + 'BR' => ['name'=>_("Brazil")], + 'CL' => ['name'=>_("Chile")], + 'PE' => ['name'=>_("Peru")], + 'VE' => ['name'=>_("Venezuela")], + 'DEFAULT' => ['name'=>_("Default")], + 'AM' => ['name'=>_("Armenia")], + 'AZ' => ['name'=>_("Azerbaijan")], + 'BY' => ['name'=>_("Belarus")], + 'EC' => ['name'=>_("Ecuador")], + 'HK' => ['name'=>_("Hong Kong")], + 'KE' => ['name'=>_("Kenya")], + 'KG' => ['name'=>_("Kyrgyzstan")], + 'KR' => ['name'=>_("Korea")], + 'KZ' => ['name'=>_("Kazakhstan")], + 'MA' => ['name'=>_("Morocco")], + 'MD' => ['name'=>_("Moldova")], + 'ME' => ['name'=>_("Montenegro")], + 'MO' => ['name'=>_("Macau")], + 'MT' => ['name'=>_("Malta")], + 'RU' => ['name'=>_("Russia")], + 'SG' => ['name'=>_("Singapore")], + 'TH' => ['name'=>_("Thailand")], + 'TW' => ['name'=>_("Taiwan")], + 'ZA' => ['name'=>_("South Africa")], + 'AF' => ['name'=>'Afghanistan'], + 'AL' => ['name'=>'Albania'], + 'DZ' => ['name'=>'Algeria'], + 'AS' => ['name'=>'American Samoa'], + 'AO' => ['name'=>'Angola'], + 'AI' => ['name'=>'Anguilla'], + 'AQ' => ['name'=>'Antarctica'], + 'AG' => ['name'=>'Antigua And Barbuda'], + 'AR' => ['name'=>'Argentina'], + 'AW' => ['name'=>'Aruba'], + 'BS' => ['name'=>'Bahamas], The'], + 'BH' => ['name'=>'Bahrain'], + 'BD' => ['name'=>'Bangladesh'], + 'BB' => ['name'=>'Barbados'], + 'BZ' => ['name'=>'Belize'], + 'BJ' => ['name'=>'Benin'], + 'BM' => ['name'=>'Bermuda'], + 'BT' => ['name'=>'Bhutan'], + 'BO' => ['name'=>'Bolivia'], + 'BA' => ['name'=>'Bosnia And Herzegovina'], + 'BW' => ['name'=>'Botswana'], + 'BV' => ['name'=>'Bouvet Island'], + 'IO' => ['name'=>'British Indian Ocean Territory'], + 'BN' => ['name'=>'Brunei'], + 'BF' => ['name'=>'Burkina Faso'], + 'MM' => ['name'=>'Burma'], + 'BI' => ['name'=>'Burundi'], + 'KH' => ['name'=>'Cambodia'], + 'CM' => ['name'=>'Cameroon'], + 'CV' => ['name'=>'Cape Verde'], + 'KY' => ['name'=>'Cayman Islands'], + 'CF' => ['name'=>'Central African Republic'], + 'TD' => ['name'=>'Chad'], + 'CN' => ['name'=>'China'], + 'CX' => ['name'=>'Christmas Island'], + 'CC' => ['name'=>'Cocos (keeling) Islands'], + 'CO' => ['name'=>'Colombia'], + 'KM' => ['name'=>'Comoros'], + 'CG' => ['name'=>'Congo (brazzaville) '], + 'CD' => ['name'=>'Congo (kinshasa)'], + 'CK' => ['name'=>'Cook Islands'], + 'CR' => ['name'=>'Costa Rica'], + 'CI' => ['name'=>'CÔte D’ivoire'], + 'CU' => ['name'=>'Cuba'], + 'CW' => ['name'=>'CuraÇao'], + 'DJ' => ['name'=>'Djibouti'], + 'DM' => ['name'=>'Dominica'], + 'DO' => ['name'=>'Dominican Republic'], + 'EG' => ['name'=>'Egypt'], + 'SV' => ['name'=>'El Salvador'], + 'GQ' => ['name'=>'Equatorial Guinea'], + 'ER' => ['name'=>'Eritrea'], + 'ET' => ['name'=>'Ethiopia'], + 'FK' => ['name'=>'Falkland Islands (islas Malvinas)'], + 'FO' => ['name'=>'Faroe Islands'], + 'FJ' => ['name'=>'Fiji'], + 'GF' => ['name'=>'French Guiana'], + 'PF' => ['name'=>'French Polynesia'], + 'TF' => ['name'=>'French Southern And Antarctic Lands'], + 'GA' => ['name'=>'Gabon'], + 'GM' => ['name'=>'Gambia], The'], + 'GE' => ['name'=>'Georgia'], + 'GEANT' => ['name'=>'The GEANT country'], + 'GH' => ['name'=>'Ghana'], + 'GI' => ['name'=>'Gibraltar'], + 'GL' => ['name'=>'Greenland'], + 'GD' => ['name'=>'Grenada'], + 'GP' => ['name'=>'Guadeloupe'], + 'GU' => ['name'=>'Guam'], + 'GT' => ['name'=>'Guatemala'], + 'GG' => ['name'=>'Guernsey'], + 'GN' => ['name'=>'Guinea'], + 'GW' => ['name'=>'Guinea-bissau'], + 'GY' => ['name'=>'Guyana'], + 'HT' => ['name'=>'Haiti'], + 'HM' => ['name'=>'Heard Island And Mcdonald Islands'], + 'HN' => ['name'=>'Honduras'], + 'IN' => ['name'=>'India'], + 'ID' => ['name'=>'Indonesia'], + 'IR' => ['name'=>'Iran'], + 'IQ' => ['name'=>'Iraq'], + 'IM' => ['name'=>'Isle Of Man'], + 'JM' => ['name'=>'Jamaica'], + 'JE' => ['name'=>'Jersey'], + 'JO' => ['name'=>'Jordan'], + 'KI' => ['name'=>'Kiribati'], + 'KP' => ['name'=>'Korea], North'], + 'KW' => ['name'=>'Kuwait'], + 'LA' => ['name'=>'Laos'], + 'LB' => ['name'=>'Lebanon'], + 'LS' => ['name'=>'Lesotho'], + 'LR' => ['name'=>'Liberia'], + 'LY' => ['name'=>'Libya'], + 'LI' => ['name'=>'Liechtenstein'], + 'MG' => ['name'=>'Madagascar'], + 'MW' => ['name'=>'Malawi'], + 'MY' => ['name'=>'Malaysia'], + 'MV' => ['name'=>'Maldives'], + 'ML' => ['name'=>'Mali'], + 'MH' => ['name'=>'Marshall Islands'], + 'MQ' => ['name'=>'Martinique'], + 'MR' => ['name'=>'Mauritania'], + 'MU' => ['name'=>'Mauritius'], + 'YT' => ['name'=>'Mayotte'], + 'MX' => ['name'=>'Mexico'], + 'FM' => ['name'=>'Micronesia, Federated States Of'], + 'MC' => ['name'=>'Monaco'], + 'MN' => ['name'=>'Mongolia'], + 'MS' => ['name'=>'Montserrat'], + 'MZ' => ['name'=>'Mozambique'], + 'NA' => ['name'=>'Namibia'], + 'NR' => ['name'=>'Nauru'], + 'NP' => ['name'=>'Nepal'], + 'NC' => ['name'=>'New Caledonia'], + 'NI' => ['name'=>'Nicaragua'], + 'NE' => ['name'=>'Niger'], + 'NG' => ['name'=>'Nigeria'], + 'NU' => ['name'=>'Niue'], + 'NF' => ['name'=>'Norfolk Island'], + 'MP' => ['name'=>'Northern Mariana Islands'], + 'OM' => ['name'=>'Oman'], + 'PK' => ['name'=>'Pakistan'], + 'PW' => ['name'=>'Palau'], + 'PA' => ['name'=>'Panama'], + 'PG' => ['name'=>'Papua New Guinea'], + 'PY' => ['name'=>'Paraguay'], + 'PH' => ['name'=>'Philippines'], + 'PN' => ['name'=>'Pitcairn Islands'], + 'PR' => ['name'=>'Puerto Rico'], + 'QA' => ['name'=>'Qatar'], + 'RE' => ['name'=>'Reunion'], + 'RW' => ['name'=>'Rwanda'], + 'BL' => ['name'=>'Saint Barthelemy'], + 'SH' => ['name'=>'Saint Helena, Ascension, And Tristan Da Cunha'], + 'KN' => ['name'=>'Saint Kitts And Nevis'], + 'LC' => ['name'=>'Saint Lucia'], + 'MF' => ['name'=>'Saint Martin'], + 'PM' => ['name'=>'Saint Pierre And Miquelon'], + 'VC' => ['name'=>'Saint Vincent And The Grenadines'], + 'WS' => ['name'=>'Samoa'], + 'SM' => ['name'=>'San Marino'], + 'ST' => ['name'=>'Sao Tome And Principe'], + 'SA' => ['name'=>'Saudi Arabia'], + 'SN' => ['name'=>'Senegal'], + 'SC' => ['name'=>'Seychelles'], + 'SL' => ['name'=>'Sierra Leone'], + 'SX' => ['name'=>'Sint Maarten'], + 'SB' => ['name'=>'Solomon Islands'], + 'SO' => ['name'=>'Somalia'], + 'GS' => ['name'=>'South Georgia And South Sandwich Islands'], + 'SS' => ['name'=>'South Sudan'], + 'LK' => ['name'=>'Sri Lanka'], + 'SD' => ['name'=>'Sudan'], + 'SR' => ['name'=>'Suriname'], + 'SZ' => ['name'=>'Swaziland'], + 'SY' => ['name'=>'Syria'], + 'TJ' => ['name'=>'Tajikistan'], + 'TZ' => ['name'=>'Tanzania'], + 'TL' => ['name'=>'Timor-leste'], + 'TG' => ['name'=>'Togo'], + 'TK' => ['name'=>'Tokelau'], + 'TO' => ['name'=>'Tonga'], + 'TT' => ['name'=>'Trinidad And Tobago'], + 'TN' => ['name'=>'Tunisia'], + 'TM' => ['name'=>'Turkmenistan'], + 'TC' => ['name'=>'Turks And Caicos Islands'], + 'TV' => ['name'=>'Tuvalu'], + 'UG' => ['name'=>'Uganda'], + 'UA' => ['name'=>'Ukraine'], + 'AE' => ['name'=>'United Arab Emirates'], + 'GB' => ['name'=>_('United Kingdom')], + 'UY' => ['name'=>'Uruguay'], + 'UZ' => ['name'=>'Uzbekistan'], + 'VU' => ['name'=>'Vanuatu'], + 'VA' => ['name'=>'Vatican City'], + 'VN' => ['name'=>'Vietnam'], + 'VG' => ['name'=>'Virgin Islands, British'], + 'VI' => ['name'=>'Virgin Islands, United States '], + 'WF' => ['name'=>'Wallis And Futuna'], + 'EH' => ['name'=>'Western Sahara'], + 'YE' => ['name'=>'Yemen'], + 'ZM' => ['name'=>'Zambia'], + 'ZW' => ['name'=>'Zimbabwe'], ]; common\Entity::outOfThePotatoes(); @@ -514,10 +514,12 @@ public function printCountryList($activeOnly = 0) // SELECT never returns a boolean, always a mysqli_object while ($activeFederations = mysqli_fetch_object(/** @scrutinizer ignore-type */ $federations)) { $fedIdentifier = $activeFederations->country; // UPPER() has capitalised this for us - $returnArray[$fedIdentifier] = isset($this->knownFederations[$fedIdentifier]) ? $this->knownFederations[$fedIdentifier] : $fedIdentifier; + $returnArray[$fedIdentifier] = isset($this->knownFederations[$fedIdentifier]) ? $this->knownFederations[$fedIdentifier]['name'] : $fedIdentifier; } } else { - $returnArray = $this->knownFederations; + foreach ($this->knownFederations as $fedIdentifier => $value) { + $returnArray = $value['name']; + } } asort($returnArray, SORT_LOCALE_STRING); $this->languageInstance->setTextDomain($olddomain); @@ -594,7 +596,7 @@ public function getExternalCountriesList() // the query yielded a mysqli_result because it's a SELECT, this never gives back a boolean while ($eduroamFederations = mysqli_fetch_object(/** @scrutinizer ignore-type */ $federations)) { $fedIdentifier = $eduroamFederations->country; - $returnArray[$fedIdentifier] = isset($this->knownFederations[$fedIdentifier]) ? $this->knownFederations[$fedIdentifier] : $fedIdentifier; + $returnArray[$fedIdentifier] = isset($this->knownFederations[$fedIdentifier]) ? $this->knownFederations[$fedIdentifier]['name'] : $fedIdentifier; } asort($returnArray, SORT_LOCALE_STRING); $returnArray['time'] = $timeElapsed; diff --git a/core/ExternalEduroamDBData.php b/core/ExternalEduroamDBData.php index 941879d5d..112aa3bb4 100644 --- a/core/ExternalEduroamDBData.php +++ b/core/ExternalEduroamDBData.php @@ -289,7 +289,7 @@ public function listExternalTlsServersInstitution($tld) { $query = "SELECT ROid, instid, type, inst_name, servers, contacts FROM eduroamv2.view_tls_inst WHERE country = ? AND servers IS NOT NULL AND contacts IS NOT NULL"; $instServerTransaction = $this->db->exec($query, "s", $tld); while ($instServerResponses = mysqli_fetch_object(/** @scrutinizer ignore-type */ $instServerTransaction)) { - $contactList = $this->dissectCollapsedContacts($instServerResponses->contacts); + $contactList = $this::dissectCollapsedContacts($instServerResponses->contacts); $names = $this->splitNames($instServerResponses->inst_name); $thelanguage = $names[$this->languageInstance->getLang()] ?? $names["en"] ?? array_shift($names); $retval[$instServerResponses->ROid . "-". $instServerResponses->instid] = [ @@ -299,8 +299,8 @@ public function listExternalTlsServersInstitution($tld) { "servers" => $instServerResponses->servers, "contacts" => $contactList]; } - usort($retval, array($this, "usortInstitution")); - return $retval; - } + uasort($retval, array($this, "usortInstitution")); + return $retval; + } } diff --git a/core/Federation.php b/core/Federation.php index 60e011bbd..33c2d26ce 100644 --- a/core/Federation.php +++ b/core/Federation.php @@ -200,7 +200,6 @@ public function downloadStats($format, $detail = '') */ public function __construct($fedname) { - // initialise the superclass variables $this->databaseType = "INST"; @@ -221,7 +220,7 @@ public function __construct($fedname) // $this->tld = $fedname; $fedIdentifiers = array_keys($cat->knownFederations); $this->tld = $fedIdentifiers[array_search(strtoupper($fedname), $fedIdentifiers)]; - $this->name = $cat->knownFederations[$this->tld]; + $this->name = $cat->knownFederations[$this->tld]['name']; // end of spoon-feed parent::__construct(); // we now have access to our database handle diff --git a/web/admin/action_req_certificate.php b/web/admin/action_req_certificate.php index 607a39e9d..a7a8a679d 100644 --- a/web/admin/action_req_certificate.php +++ b/web/admin/action_req_certificate.php @@ -141,8 +141,9 @@ } $fed = $validator->existingFederation($_POST['NRO-list']); $country = strtoupper($fed->tld); - $DN[] = "C=$country"; - $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[strtoupper($fed->tld)]); + $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ; + $DN[] = "C=$code"; + $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[$country]['name']); $serverInfo = $externalDb->listExternalTlsServersFederation($fed->tld); $serverList = explode(",", array_key_first($serverInfo)); $DN[] = "CN=" . $serverList[0]; @@ -155,12 +156,14 @@ case "INST": $matches = []; preg_match('/^([A-Z][A-Z]).*\-.*/', $_POST['INST-list'], $matches); + print("MMMM="); print_r($_POST); $extInsts = $externalDb->listExternalTlsServersInstitution($matches[1]); if ($user->isFederationAdmin($matches[1]) === FALSE) { throw new Exception(sprintf("Sorry: you are not %s admin for the %s requested in the form.", $uiElements->nomenclatureFed, $uiElements->nomenclatureFed)); } $country = strtoupper($matches[1]); - $DN[] = "C=$country"; + $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ; + $DN[] = "C=$code"; $serverInfo = $extInsts[$_POST['INST-list']]; if (isset($serverInfo["names"]["en"])) { $ou = $serverInfo["names"]["en"]; @@ -261,7 +264,7 @@ echo ' checked'; } echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . ''; - echo " " . $cat->knownFederations[$feds[0]->tld] . ""; + echo " " . $cat->knownFederations[$feds[0]->tld]['name'] . ""; echo ''; break; default: @@ -275,7 +278,7 @@ tld) . '">' . $cat->knownFederations[$oneFed->tld] . ""; + echo '"; #echo '"; }