From: Jem Date: Mon, 21 May 2018 19:49:38 +0000 (+0200) Subject: Código anterior de la aplicación X-Git-Url: http://gitweb.wikimedia.es/?a=commitdiff_plain;h=f69ec2ae3d3d8fa0e847ee33b0fc34117448143f;p=inscripciones%2Finscribirse Código anterior de la aplicación --- f69ec2ae3d3d8fa0e847ee33b0fc34117448143f diff --git a/html/gec.php b/html/gec.php new file mode 100644 index 0000000..c13eebd --- /dev/null +++ b/html/gec.php @@ -0,0 +1,26 @@ + $E) { + if (strpos ($T, $P) !== FALSE) { + $T = str_replace ($P, "{$P}", $T); + } + } + return $T; +} + +function infogrupo ($G, $DE, $DI, $DP, $DT) { + # Quitar condición con DI-grupo-G una vez migrado todo a los DE: + if ($DE["lugar"][$G]) { + $Info = ($DT[$DE["lugar"][$G]][3] ? "{$DT[$DE["lugar"][$G]][0]}" : $DT[$DE["lugar"][$G]][0]); + $Info .= ($MostrarLoc && $DT[$DE["lugar"][$G]][1] ? txtenlaces ($DT[$DE["lugar"][$G]][1], $DP) : ""); + $F = fecha ($DE["tiempo0"][$G], $DI, array ("Hora", "Año")); + if ($F != "N/D") $Info .= ", {$F} - {$DE["tiempo1"][$G]}"; + if ($DE["extra"][$G]) $Info .= " - {$DE["extra"][$G]}"; + } else { + $Info = $DI["grupo"][$G]; + } + return $Info; +} +?> \ No newline at end of file diff --git a/html/img/info.gif b/html/img/info.gif new file mode 100644 index 0000000..2acdca5 Binary files /dev/null and b/html/img/info.gif differ diff --git a/html/img/wmes.png b/html/img/wmes.png new file mode 100644 index 0000000..e357c33 Binary files /dev/null and b/html/img/wmes.png differ diff --git a/html/inscripcion.php b/html/inscripcion.php new file mode 100755 index 0000000..8d4e8ed --- /dev/null +++ b/html/inscripcion.php @@ -0,0 +1,478 @@ +Sin plazas - Te esperamos en futuras actividades de {$DI[$Org]}; marca la casilla inferior para recibir información"; + } else { + return $Plazas; + } +} + +function idioma ($I) { + $T = htmlspecialchars ($_SERVER["REQUEST_URI"]); + if (strpos ($T, "uselang=") !== FALSE) { + return preg_replace ("/uselang=\w+/", "uselang={$I}", $T); + } elseif (strpos ($T, "?") !== FALSE) { + return "{$T}&uselang={$I}"; + } else { + return "{$T}?uselang={$I}"; + } +} + +if (!isset($_GET['e']) || !$_GET['e']) { + print ("Error. No se ha indicado ningún evento."); + exit; +} +$E = trim ($_GET['e'], "/"); + +# Hasta arreglo definitivo... +$EmailText = "Email"; +if (substr ($E, -10) == "-iespecial") { + $E = substr ($E, 0, -10); + $EmailOpc = TRUE; $EmailText = "Email"; + unset ($DE["exigidos"]); +} + +# $Email = ($E == "mensa" ? "info" : $E); + +$I = ($_GET["uselang"] ? $_GET["uselang"] : "es"); +$D0 = parsecfg ("jembot.0"); +$DD = parsecfg ("jembot.data"); +$DU = parsecfg ("jembot.usuarios"); +$DT = parsecfg ("jembot.entidades"); +$DE = parsecfg ("jembot.@{$E}"); +$DI = parsecfg ("jembot.{$I}"); +$P = ($DE["proyecto"] ? $DE["proyecto"] : "{$I}wiki"); +$DP = parsecfg ("jembot.{$P}"); + + +$Email = ($DE["contacto"] ? $DE["contacto"] : "info"); + +# "Fallback" de idiomas para cuando no tenemos definido alguno de los mensajes +if ($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") { + header ("location:/inscripcion/sincont.php?evento={$E}"); +} + +# file_put_contents ("debug.log", print_r ($_GET, TRUE) . "RUI {$_SERVER["REQUEST_URI"]}\nRQS {$_SERVER["REDIRECT_QUERY_STRING"]}\nRS {$_SERVER["QUERY_STRING"]}\nRDU {$_SERVER["REDIRECT_URL"]}\nSN {$_SERVER["SCRIPT_NAME"]}"); + +if ($_GET["g"]) { + foreach ($_GET["g"] as $G) { + $Grupos = array_merge ((array) $Grupos, preg_filter ("/^({$G})/", "$1", array_keys ($DE["plazas"]))); + } +} else { + $Grupos = array_keys ($DE["plazas"]); +} + +$Edicion = ($DE["tipo"] == "editatón" || $DE["tipo"] == "taller de edición"); +$Exigidos = $DE["exigidos"]; +if ($Edicion) $Exigidos[] = "Cuenta"; + +# Hasta arreglo definitivo traslado arriba +# $EmailText = "Email"; +# Pendiente gestionar email también con $DE["exigidos"] +switch ($_GET["p"]) { +case "-iespecial": + $EmailOpc = TRUE; $EmailText = "Email"; + unset ($Exigidos); + break; +} + +$DNI = (in_array ("DNI", $Exigidos) ? "{$DI["dni"]}" : $DI["dni"]); +$Nombre = (in_array ("Nombre", $Exigidos) ? "{$DI["nombre"]}" : $DI["nombre"]); +$Apellido1 = (in_array ("Apellido1", $Exigidos) ? "{$DI["apellido"]} 1" : "{$DI["apellido"]} 1"); +$Apellido2 = (in_array ("Apellido2", $Exigidos) ? "{$DI["apellido"]} 2" : "{$DI["apellido"]} 2"); +$Sexo = (in_array ("Sexo", $Exigidos) ? "{$DI["sexo"]}" : $DI["sexo"]); +$Edad = (in_array ("Edad", $Exigidos) ? "{$DI["edad"]}" : $DI["edad"]); +$Cuenta = (in_array ("Cuenta", $Exigidos) ? "{$DI["nombreusr"]}" : $DI["nombreusr"]); + +$Org = ($DE["organizador"] ? $DE["organizador"] : "wmes"); +$Colab = array_merge ((array) $Org, (array) $DE["colaboradores"]); + + +if (in_array ("Cuenta", $Exigidos)) { + $Cambios = array ("@fam@" => $DI[$DP["familia"]]); + $InfoAltErr = "{$DI["importante"]}: " . strtr ($DI["indicarcuenta"], $Cambios); + $CrearCuenta = strtr ($DI["crearcuenta"], $Cambios); + $CrearCuenta = preg_replace ("/@(.*?)@/", "$1", $CrearCuenta); + $LinkForm = ($EMail == "info" ? "https://www.wikimedia.es/wiki/contacto" : "#"); + $InfoCrear = "{$CrearCuenta} {$DI["escribirnos"]}."; + $Mensaje = $InfoAltErr . " " . $InfoCrear; +} + + +if ($_POST["Confirmado"] == "N") { # Datos enviados + $GruposI = preg_filter ("/^_(.*)/", "$1", array_keys ($_POST)); + if (! $GruposI) { + $Error[] = $DI["errw"]["nohorario"]; + } elseif (count ($GruposI) > 20) { # Reponer tras Glaming Madrid a 4 + $Error[] = $DI["errw"]["maxhorarios"]; + } + + foreach (array ("Nombre", "Apellido1", "Apellido2", "DNI", "Sexo", "Edad", "Cuenta") as $C) { + if (! $_POST[$C] && in_array ($C, $Exigidos)) { + $Error[] = $DI["errw"]["no" . minus ($C)]; + if ($C == "Cuenta") $Extra = $InfoCrear; + } + } + + $M = $_POST["Email"]; + if (! filter_var ($M, FILTER_VALIDATE_EMAIL) && ($M || ! $EmailOpc)) { + $Error[] = $DI["errw"]["noemail"]; + } + + $U = strtr ($_POST["Cuenta"], "_", " "); + if ($U) { + #Comprobar discrepancia en gender: + $D = api ("usuario", $U, $P); + + if (array_key_exists ("missing", $D)) { + $Error[] = $DI["errw"]["cuentanula"]; + $Extra = $InfoCrear; + } elseif ($D["blockedby"]) { + $Error[] = $DI["errw"]["cuentabloqueada"]; + $Extra = $InfoCrear; + file_put_contents ("inscripcion.log", gmdate ("Y-m-d H:i:s") . " * Intento de uso de la cuenta bloqueada {$U}\n", FILE_APPEND); + } + } + + if ($M || $U) { + foreach ($DE["inscritos"] as $Grupo => $Lista) { + if (in_array ($Grupo, $GruposI)) { + foreach (explode (";", $Lista) as $Cod) { + if ($M && $DU[$Cod]["Email"] == $M) { + $EmailRep++; + } elseif ($U && $DU[$Cod]["Cuenta"] == $U) { + $CuentaRep++; + } + } + } + } + if ($EmailRep) $Error[] = "El correo electrónico {$M} ya ha sido indicado por " . (count ($Grupos) > 1 ? "alguien inscrito en " . singpl ("grupo", $EmailRep) . " de los seleccionados." : "otro inscrito."); + if ($CuentaRep) $Error[] = "La cuenta {$U} ya ha sido indicada por " . (count ($Grupos) > 1 ? "alguien inscrito en " . singpl ("grupo", $CuentaRep) . " de los seleccionados." : "otro inscrito."); + } + + if (! $Error) { + if (! $DU["@"]) $DU["@"] = "A00X"; + $Cod = sprintf ("%02d", substr ($DU["@"], 1, 2) + 1); + if ($Cod == "100") { + $Cod = chr (ord ($DU["@"][0]) + 1) . "00"; + } else { + $Cod = $DU["@"][0] . $Cod; + } + + $Letra = strtoupper (sinacentos (mb_substr ($U, 0, 1))); + if ($Letra < "A" || $Letra > "Z") $Letra = "X"; + $Cod .= $Letra; + $DU["@"] = $Cod; + + if ($EmailOpc & ! $M) { + $_POST["Confirmado"] = "OK"; + } else { + $Base = 111111111111111; + $Conf = gmdate ("YmdHis") . "-" . rand ($Base, $Base * 9); + $_POST["Confirmado"] = $Conf; + } + $_POST["Fecha"] = date ("Y-m-d"); + $_POST["Comentarios"] = strtr ($_POST["Comentarios"], array ("\r\n" => " █ ")); + $_POST["Cuenta"] = mayusprim (strtr ($_POST["Cuenta"], "_", " ")); + + foreach ($_POST as $Campo => $V) { + if ($Campo[0] == "_") { # $V vale "on", pero no es necesario comprobarlo, solo se pasan los "on" + $GI = substr ($Campo, 1); + $DE["inscritos"][substr ($Campo, 1)] .= ($DE["inscritos"][substr ($Campo, 1)] ? ";" : "") . $Cod; + } else { + $DU[$Cod][$Campo] = $V; + } + } + + writecfg ("jembot.usuarios", $DU); + writecfg ("jembot.@{$E}", $DE); + + $Marca = "-"; $Extra = ""; + if ($EmailOpc && ! $M) { + print ""; + } else { + +#Desde la dirección de Internet {$_SERVER['REMOTE_ADDR']} se ha realizado + $Texto = <<alert ('Inscripción finalizada correctamente. Se te ha enviado un correo con un enlace para que confirmes la validez de tu dirección, lo cual deberás hacer en las próximas 24 horas. Te esperamos en el evento.');"; + } else { + print ""; + $Marca = "*"; $Extra = " - Error al enviar correo para confirmación"; + } + } + file_put_contents ("inscripcion.log", gmdate ("Y-m-d H:i:s") . " {$Marca} Alta de {$Cod} - {$U} - {$E} - " . implode (",", $GruposI) . $Extra . "\n", FILE_APPEND); + unset ($_POST); + } else { + $Mensaje = "" . singpl ("Error", count ($Error), FALSE) . ": " . htmlspecialchars (implode (" ", $Error)) . " {$Extra}"; + } +} + +# Vale tanto si el sexo o la edad son obligatorios como si no +$ValSexo = ($_POST["Sexo"] ? $_POST["Sexo"] : 0); +$CheckSexo[$ValSexo] = "CHECKED"; +$ValEdad = ($_POST["Edad"] ? $_POST["Edad"] : 0); +$CheckEdad[$ValEdad] = "CHECKED"; +?> + + +<?= "{$DI["form"]} {$DI["wmes"]} - {$DE["nombre"][$I]}" ?> + + + + +\n"); + +$Img = ($_GET["i"] ? $_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 (""); +} +?> +
"); +# +# Mejorar usando $DE["páginas"] + +print ("

{$DI["form"]} - {$DI[$Org]}"); +if ($DE["idiomas"]) { + foreach ($DE["idiomas"] as $CodI) $LI[] = "{$DD["idioma"][$CodI]}"; + print ("" . implode ("  ", $LI) . ""); +} +print ("

\n

{$DI["evento"]}: {$DE["nombre"][$I]}. " . txtenlaces ($DE["descripción"][$I], $DP)); +if ($Edicion) { + if ($DE["avisodisp"] && $DE["avisodisp"] != "no") { + print ("

\n

{$DE["avisodisp"]}."); + } elseif ($DE["avisodisp"] != "no") { + print ("

\n

{$DI["dispropio"]}."); + } +} +print ("

\n

" . ($DE["página"][$P] ? " {$DI["infocompleta"]}" : "") . ($DE["hashtag"] ? " - Hashtag: #{$DE["hashtag"]}" : "") . "

"); + +# Usamos current para no alterar $Grupos, que aún debe usarse luego +if (count ($Grupos) == 1) { + print ("

" . infogrupo (current ($Grupos), $DE, $DI, $DP, $DT)); + if ($DE["ocultarplazas"] != "sí") { + print (" - {$DI["plazas disponibles"]}: " . plazas (current ($Grupos), $Org, $DE, $DI)); + } + print ("

\n"); +} +if ($Org == "wmes") print ("

{$DI["asociadona"]}

"); +print ("

+La inscripción a este evento " . ($DE["abierto"] == "no" ? "no se encuentra abierta todavía. Puedes recibir más información {$DI["enviarmail"]}." : "se abrirá el {$DE["abierto"]}.")); +} else { +?> +
" METHOD=POST> + +

+

+ +

+ + + +
" /> +
" /> +
" /> + +
" /> + +
"/> + >     + >     + >     + + +
+ + >     + >     + >     + >     + + >     + >     + >     + >     + >     + >     + + + +
" /> + 1) { + $MaxF = 1; + # Parche a eliminar: + if ($E == "glmade") $DI["marcacasillas"] = "Marca la casilla del grupo que te interese, y solo esa (aunque puedes añadir la edición remota en cualquier caso)"; + print ("
{$DI["horarios y plazas"]}
{$DI["marcacasillas"]}:"); + + foreach ($Grupos as $G) { + if ($LocAnt && $DT[$DE["lugar"][$G]][1] != $LocAnt) { + $MostrarLoc = TRUE; + } + $LocAnt = $DT[$DE["lugar"][$G]][1]; + } + + foreach ($Grupos as $G) { + if ($_POST["_{$G}"]) $CheckGrupo[$G] = "CHECKED"; + if (substr ($G, 0, 2) != $BloqueAnt) { + $Fila = 0; + $MaxF = max ($MaxF, count ($D[$Col++])); + $BloqueAnt = substr ($G, 0, 2); + } + + $Plazas = plazas ($G, $Org, $DE, $DI); + $Disabled = (intval ($Plazas) == 0 ? "disabled" : ""); + $Info = infogrupo ($G, $DE, $DI, $DP, $DT) . ($DE["ocultarplazas"] != "sí" ? " ({$Plazas})" : ""); + $D[$Col][++$Fila] = ""; + } + $MaxF = max ($MaxF, count ($D[$Col++])); + + for ($F = 1; $F <= $MaxF; $F++) { + print ("\n"); + for ($C = 1; $C <= $Col; $C++) { + print ("
" . $D[$C][$F]); + } + } + print ("
"); + +} else { + print ""; +} +?> +
: +
( +{$DI["crearla"]}"); +?>)" /> +
+ +
\n"); +} + +foreach ($DE["preguntas"] as $Pregunta) { + $Opciones = explode (";", ($DE["pregunta-{$Pregunta}"][$I] ? $DE["pregunta-{$Pregunta}"][$I] : $DI["pregunta"][$Pregunta])); + + print ("
:\n"); + +foreach ($Colab as $C) { # Ya no se admite diferenciar dentro de un mismo evento + print ("\n
\n"); +} + +print ("\n
+

+ + + +
+ +

Antes de continuar, debes leer la siguiente información sobre protección de datos. +El envío de los datos implica tu consentimiento para que los incluyamos en nuestro fichero “Contactos”. +

+
+ +
" />
+
+ \ No newline at end of file