|
@@ -253,7 +253,7 @@ discard block |
|
|
block discarded – undo |
|
253
|
253
|
const ACTIONS = [ |
|
254
|
254
|
// Inst-level actions. |
|
255
|
255
|
API::ACTION_NEWINST_BY_REF => [ |
|
256
|
|
- "REQ" => [API::AUXATTRIB_EXTERNALID,], |
|
|
256
|
+ "REQ" => [API::AUXATTRIB_EXTERNALID, ], |
|
257
|
257
|
"OPT" => [ |
|
258
|
258
|
'general:geo_coordinates', |
|
259
|
259
|
'general:logo_file', |
|
@@ -270,7 +270,7 @@ discard block |
|
|
block discarded – undo |
|
270
|
270
|
"FLAG" => [], |
|
271
|
271
|
], |
|
272
|
272
|
API::ACTION_NEWINST => [ |
|
273
|
|
- "REQ" => [API::AUXATTRIB_INSTTYPE,], // "IdP", "SP" or "IdPSP" |
|
|
273
|
+ "REQ" => [API::AUXATTRIB_INSTTYPE, ], // "IdP", "SP" or "IdPSP" |
|
274
|
274
|
"OPT" => [ |
|
275
|
275
|
'general:instname', |
|
276
|
276
|
'general:geo_coordinates', |
|
@@ -489,12 +489,12 @@ discard block |
|
|
block discarded – undo |
|
489
|
489
|
public function scrub($inputJson, $fedObject) { |
|
490
|
490
|
$optionInstance = \core\Options::instance(); |
|
491
|
491
|
$parameters = []; |
|
492
|
|
- $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'], API::ACTIONS[$inputJson['ACTION']]['FLAG']); |
|
|
492
|
+ $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'], API::ACTIONS[$inputJson['ACTION']]['FLAG']); |
|
493
|
493
|
// some actions don't need parameters. Don't get excited when there aren't any. |
|
494
|
494
|
if (!isset($inputJson['PARAMETERS'])) { |
|
495
|
495
|
return []; |
|
496
|
496
|
} |
|
497
|
|
- \core\common\Logging::debug_s(4, $inputJson['PARAMETERS'], "JSON:\n","\n"); |
|
|
497
|
+ \core\common\Logging::debug_s(4, $inputJson['PARAMETERS'], "JSON:\n", "\n"); |
|
498
|
498
|
foreach ($inputJson['PARAMETERS'] as $number => $oneIncomingParam) { |
|
499
|
499
|
// index has to be an integer |
|
500
|
500
|
if (!is_int($number)) { |
|
@@ -543,7 +543,7 @@ discard block |
|
|
block discarded – undo |
|
543
|
543
|
break; |
|
544
|
544
|
} |
|
545
|
545
|
} elseif (preg_match("/^FLAG-/", $oneIncomingParam['NAME'])) { |
|
546
|
|
- if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE" ) { |
|
|
546
|
+ if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE") { |
|
547
|
547
|
// incorrect FLAG value |
|
548
|
548
|
$parameters[$number] = array_merge($oneIncomingParam, ['VERFY_RESULT'=>false, 'VERIFY_DESC'=>"Incorrect FLAG value"]); |
|
549
|
549
|
continue; |
|
@@ -603,8 +603,8 @@ discard block |
|
|
block discarded – undo |
|
603
|
603
|
|
|
604
|
604
|
case \core\Options::TYPECODE_COORDINATES: |
|
605
|
605
|
$extension = \core\Options::TYPECODE_TEXT; |
|
606
|
|
- $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#"; |
|
607
|
|
- $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE']; |
|
|
606
|
+ $coercedInline["option"][$basename] = $oneAttrib['NAME']."#"; |
|
|
607
|
+ $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE']; |
|
608
|
608
|
break; |
|
609
|
609
|
case \core\Options::TYPECODE_TEXT: |
|
610
|
610
|
// Fall-through: they all get the same treatment. |
|
@@ -614,18 +614,18 @@ discard block |
|
|
block discarded – undo |
|
614
|
614
|
// Fall-through: they all get the same treatment. |
|
615
|
615
|
case \core\Options::TYPECODE_INTEGER: |
|
616
|
616
|
$extension = $optionInfo['type']; |
|
617
|
|
- $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#"; |
|
618
|
|
- $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE']; |
|
|
617
|
+ $coercedInline["option"][$basename] = $oneAttrib['NAME']."#"; |
|
|
618
|
+ $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE']; |
|
619
|
619
|
if ($optionInfo['flag'] == "ML") { |
|
620
|
|
- $coercedInline["value"][$basename . "-lang"] = $oneAttrib['LANG']; |
|
|
620
|
+ $coercedInline["value"][$basename."-lang"] = $oneAttrib['LANG']; |
|
621
|
621
|
} |
|
622
|
622
|
break; |
|
623
|
623
|
case \core\Options::TYPECODE_FILE: |
|
624
|
624
|
// Binary data is expected in base64 encoding. This is true also for PEM files! |
|
625
|
625
|
$extension = $optionInfo['type']; |
|
626
|
|
- $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#"; |
|
627
|
|
- file_put_contents($dir['dir'] . "/" . $basename . "-" . $extension, base64_decode($oneAttrib['VALUE'])); |
|
628
|
|
- $coercedFile["value"]['tmp_name'][$basename . "-" . $extension] = $dir['dir'] . "/" . $basename . "-" . $extension; |
|
|
626
|
+ $coercedInline["option"][$basename] = $oneAttrib['NAME']."#"; |
|
|
627
|
+ file_put_contents($dir['dir']."/".$basename."-".$extension, base64_decode($oneAttrib['VALUE'])); |
|
|
628
|
+ $coercedFile["value"]['tmp_name'][$basename."-".$extension] = $dir['dir']."/".$basename."-".$extension; |
|
629
|
629
|
break; |
|
630
|
630
|
default: |
|
631
|
631
|
throw new Exception("We don't seem to know this type code!"); |
|
@@ -654,7 +654,7 @@ discard block |
|
|
block discarded – undo |
|
654
|
654
|
public function returnSuccess($details) { |
|
655
|
655
|
$output = json_encode(["result" => "SUCCESS", "details" => $details], JSON_PRETTY_PRINT); |
|
656
|
656
|
if ($output === FALSE) { |
|
657
|
|
- $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ". json_last_error(). " - ". json_last_error_msg()); |
|
|
657
|
+ $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ".json_last_error()." - ".json_last_error_msg()); |
|
658
|
658
|
} |
|
659
|
659
|
else { |
|
660
|
660
|
echo $output; |