Valores por defecto para definir índices
authorPlatonides <platonides@gmail.com>
Mon, 21 May 2018 22:03:05 +0000 (00:03 +0200)
committerPlatonides <platonides@gmail.com>
Mon, 21 May 2018 22:03:05 +0000 (00:03 +0200)
html/inscripcion.php

index 4e308c8d596926a8978256ea65a9bbf6796fc4c3..652a55f7f59db1d3c60edd86596ea74556ae51b3 100755 (executable)
@@ -64,20 +64,20 @@ $DU = parsecfg ("jembot.usuarios");
 $DT = parsecfg ("jembot.entidades");
 $DE = parsecfg ("jembot.@{$E}");
 $DI = parsecfg ("jembot.{$I}");
-$P = ($DE["proyecto"] ? $DE["proyecto"] : "{$I}wiki");
+$P = ($DE["proyecto"] ?? "{$I}wiki");
 $DP = parsecfg ("jembot.{$P}");
 
 
-$Email = ($DE["contacto"] ? $DE["contacto"] : "info");
+$Email = ($DE["contacto"] ?? "info");
 
 # "Fallback" de idiomas para cuando no tenemos definido alguno de los mensajes
-if ($DI["idiomasec"]) {
+if (!empty($DI["idiomasec"])) {
     $DS = parsecfg ("jembot.{$DI["idiomasec"]}");
     $DI = array_merge ($DS, $DI);
 }
 
-$Dur = ($DE["duración"] ? $DE["duración"] : 30);
-if (($DE["cerrado"] || strtotime ("now") - strtotime ($DE["inicio"]) > $Dur * 24 * 3600) && $_GET["p"] != "-iespecial") {
+$Dur = ($DE["duración"] ?? 30);
+if ((!empty($DE["cerrado"]) || strtotime ("now") - strtotime ($DE["inicio"]) > $Dur * 24 * 3600) && isset($_GET["p"]) && $_GET["p"] != "-iespecial") {
     header ("location:/inscripcion/sincont.php?evento={$E}");
 }
 
@@ -113,7 +113,7 @@ $Sexo = (in_array ("Sexo", $Exigidos) ? "<b>{$DI["sexo"]}</b>" : $DI["sexo"]);
 $Edad = (in_array ("Edad", $Exigidos) ? "<b>{$DI["edad"]}</b>" : $DI["edad"]);
 $Cuenta = (in_array ("Cuenta", $Exigidos) ? "<b>{$DI["nombreusr"]}</b>" : $DI["nombreusr"]);
 
-$Org = ($DE["organizador"] ? $DE["organizador"] : "wmes");
+$Org = ($DE["organizador"] ?? "wmes");
 $Colab = array_merge ((array) $Org, (array) $DE["colaboradores"]);
 
 
@@ -143,7 +143,7 @@ if ($_POST["Confirmado"] == "N") {  # Datos enviados
         }
     }
     
-    $M = $_POST["Email"];
+    $M = $_POST["Email"] ?? "";
     if (! filter_var ($M, FILTER_VALIDATE_EMAIL) && ($M || ! $EmailOpc)) {
         $Error[] = $DI["errw"]["noemail"];
     }  
@@ -309,14 +309,14 @@ if ($Org == "wmes") print ("<p>{$DI["asociadona"]}</p>");
 print ("</td>");
 
 $Img = ($_GET["i"] ?? $E);
-$Web = ($DE["web"] ? $DE["web"] : wikiencode ("https://{$DP["web"]}/wiki/", $DE["página"][$P], NULL, NULL, NULL));
+$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>");
 }
 ?>
 </tr></table><br />
 <?php
-if ($DE["abierto"]) {
+if (!empty($DE["abierto"])) {
     print ("<b>La inscripción a este evento " . ($DE["abierto"] == "no" ? "no se encuentra abierta todavía</b>. Puedes recibir más información <a href=\"https://www.wikimedia.es/wiki/contacto\" onClick=\"ec('info')\">{$DI["enviarmail"]}</a>." : "se abrirá el {$DE["abierto"]}</b>."));
 } else { 
 ?>
@@ -419,7 +419,7 @@ if (count ($Grupos) > 1) {
 ?></SELECT>
 <TR><TR><TR>
 <?php
-if ($DE["público"] != "no") {
+if (isset($DE["público"]) && $DE["público"] != "no") {
     $ValEnt = ($_POST["Enterado"] ?? "N/D");
     $CheckEnt[$ValEnt] = "SELECTED";
     print ("<TR><TD><label for=\"Enterado\">{$DI["medioenterado"]}</label>\n<td><SELECT id=\"Enterado\" NAME=\"Enterado\">");
@@ -431,7 +431,7 @@ if ($DE["público"] != "no") {
 }
 
 foreach ($DE["preguntas"] as $Pregunta) {
-   $Opciones = explode (";", ($DE["pregunta-{$Pregunta}"][$I] ? $DE["pregunta-{$Pregunta}"][$I] : $DI["pregunta"][$Pregunta]));
+   $Opciones = explode (";", ($DE["pregunta-{$Pregunta}"][$I] ?? $DI["pregunta"][$Pregunta]));
 
    print ("<TR><TD><label for=\"Preg-{$Pregunta}\">{$Opciones[0]}</label>:\n<td><select id=\"Preg-{$Pregunta}\" name=\"Preg-{$Pregunta}\">");
    for ($i = 1; $i < count ($Opciones); $i++) {