Comprobar si existen los parámetros mediante la fusión de null
authorPlatonides <platonides@gmail.com>
Mon, 21 May 2018 21:55:40 +0000 (23:55 +0200)
committerPlatonides <platonides@gmail.com>
Mon, 21 May 2018 21:55:40 +0000 (23:55 +0200)
Evitamos los warnings por uso de variables no definidas

html/inscripcion.php

index 2ea6f662732733e42c9927240015f45fcd552bc5..4e308c8d596926a8978256ea65a9bbf6796fc4c3 100755 (executable)
@@ -57,7 +57,7 @@ if (substr ($E, -10) == "-iespecial") {
 
 # $Email = ($E == "mensa" ? "info" : $E);
 
-$I = ($_GET["uselang"] ? $_GET["uselang"] : "es");
+$I = ($_GET["uselang"] ?? "es");
 $D0 = parsecfg ("jembot.0");
 $DD = parsecfg ("jembot.data");
 $DU = parsecfg ("jembot.usuarios");
@@ -259,9 +259,9 @@ EOT;
 }
 
 # Vale tanto si el sexo o la edad son obligatorios como si no
-$ValSexo = ($_POST["Sexo"] ? $_POST["Sexo"] : 0);
+$ValSexo = ($_POST["Sexo"] ?? 0);
 $CheckSexo[$ValSexo] = "CHECKED";
-$ValEdad = ($_POST["Edad"] ? $_POST["Edad"] : 0);
+$ValEdad = ($_POST["Edad"] ?? 0);
 $CheckEdad[$ValEdad] = "CHECKED";
 ?>
 <html><head>
@@ -308,7 +308,7 @@ if (count ($Grupos) == 1) {
 if ($Org == "wmes") print ("<p>{$DI["asociadona"]}</p>");
 print ("</td>");
 
-$Img = (isset($_GET["i"]) ? $_GET["i"] : $E);
+$Img = ($_GET["i"] ?? $E);
 $Web = ($DE["web"] ? $DE["web"] : wikiencode ("https://{$DP["web"]}/wiki/", $DE["página"][$P], NULL, NULL, NULL));
 foreach (array ("jpg", "png") as $Ext) {
     if (file_exists ("img/{$Img}.{$Ext}")) print ("<td><a href=\"{$Web}\" target=\"_blank\"><img src=\"/inscripcion/img/{$Img}.{$Ext}\" width=\"150\" /></a></td>");
@@ -410,7 +410,7 @@ if (count ($Grupos) > 1) {
 <TR style="background-color:#e8e8f8"><TD><label for='Experiencia'><?= $DI["exprevia"] ?></label>
     <td><SELECT id='Experiencia' NAME="Experiencia">
 <?php
-    $ValExp = ($_POST["Experiencia"] ? $_POST["Experiencia"] : "N/D");
+    $ValExp = ($_POST["Experiencia"] ?? "N/D");
     $CheckExp[$ValExp] = "SELECTED";
     print ("<OPTION VALUE='N/D' {$CheckExp['N/D']}>{$DI["noespecificada"]}");
     for ($i = 0; $i <= 4; $i++) {
@@ -420,7 +420,7 @@ if (count ($Grupos) > 1) {
 <TR><TR><TR>
 <?php
 if ($DE["público"] != "no") {
-    $ValEnt = ($_POST["Enterado"] ? $_POST["Enterado"] : "N/D");
+    $ValEnt = ($_POST["Enterado"] ?? "N/D");
     $CheckEnt[$ValEnt] = "SELECTED";
     print ("<TR><TD><label for=\"Enterado\">{$DI["medioenterado"]}</label>\n<td><SELECT id=\"Enterado\" NAME=\"Enterado\">");
     print ("<OPTION VALUE='N/D' {$CheckEnt['N/D']}>{$DI["noespecificado"]}");