Beispiel #1
0
 public static function usuario_ligas_invitables($id)
 {
     $uid = userdata()->get('id');
     return array_filter(UIFacade::ligas(), function ($l) use($uid, $id) {
         return (has_auth('admin') || $l['creador'] == $uid) && !in_array($id, array_map(function ($p) {
             return $p->get('id');
         }, $l['participantes']));
     });
 }
Beispiel #2
0
  </form>
</div>
<?php 
foreach (UIFacade::contenidos('pregunta frecuente', $q) as $c) {
    $id = $c->get('id');
    $tags = $c->get('tags');
    $img = $c->get('URL de imagen');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/contenido/' . $img;
    }
    ?>

<div>

<?php 
    if (has_auth('admin')) {
        ?>
  <div class="admin-options">
    <form action="controller" method="post">
      <input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
"/>
      <input type="hidden" name="goto" value="faq"/>
      <button type="submit" name="action" value="contenido_remove">Eliminar</button>
    </form>
    <form action="contenido_update" method="get">
      <input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
"/>
Beispiel #3
0
<?php

require 'include/pre.php';
?>
<h2>Usuarios</h2>
<?php 
if (has_auth('user') && array_key_exists('id', $_GET)) {
    $id = $_GET['id'];
    $u = UIFacade::select('Usuario', array('id' => $id));
    $e = $u->get('dirección de e-mail');
    $img = $u->get('URL del avatar') or $img = 'generico.jpg';
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/usuario/' . $img;
    }
    $ls = UIFacade::usuario_ligas_invitables($id);
    ?>
<img src="<?php 
    echo $img;
    ?>
"/>
<p>Nombre de usuario:   <?php 
    echo $u->get('username');
    ?>
</p>
<p>Nombre completo:     <?php 
    echo $u->get('nombre completo');
    ?>
</p>

<?php 
    if ($u->get('género')) {
Beispiel #4
0
<?php

require 'include/pre.php';
function select_opts($name, $range, $now, $format, $print_empty)
{
    $r = '<select name="' . $name . '">';
    if ($print_empty) {
        $r .= '<option value=""></option>';
    }
    foreach ($range as $i) {
        $r .= sprintf('<option value="' . $format . '"%s>' . $format . '</option>', $i, $i === $now ? ' selected="selected"' : '', $i);
    }
    return $r . "</select>";
}
if (has_auth('admin') && array_key_exists('id', $_GET)) {
    $j = UIFacade::select('Juego', array('id' => $_GET['id']));
    $equipos = UIFacade::retrieveAll('Equipo');
    $estadios = UIFacade::retrieveAll('Estadio');
    ?>
<div id="contenido_interno" style="height: auto">
  <div>
    <form action="controller" method="post">
      <input type="hidden" name="goto" value="calendario"/>
      <table width="100%" border="0" cellspacing="5" cellpadding="5" align="left">
        <tr>
          <th style="border: 2px solid #cccccc">
            Agregar juego
          </th>
        </tr>
        <tr>
          <td style="border: 1px solid #cccccc">
Beispiel #5
0
<?php

require 'include/pre.php';
?>
<h2>Usuarios</h2>
<?php 
if (has_auth('user')) {
    foreach (UIFacade::retrieveAll('Usuario') as $u) {
        $img = $u->get('URL del avatar') or $img = 'generico.jpg';
        if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
            $img = 'static/images/usuario/' . $img;
        }
        ?>
<div style="border: 1em">
  <form action="usuario_detail" method="get">
    <input type="hidden" name="id" value="<?php 
        echo $u->get('id');
        ?>
"/>
    <img src="<?php 
        echo $img;
        ?>
" style="float: left; clear: both"/>
    <p>Usuario: <?php 
        echo $u->get('username');
        ?>
</p>
    <p>Nombre:  <?php 
        echo $u->get('nombre completo');
        ?>
</p>
Beispiel #6
0
        }
    }
    return $data;
}
function set_fields($entity_class, $data = array())
{
    return set_data($entity_class, $data, 'fields');
}
function set_pk($entity_class, $data = array())
{
    return set_data($entity_class, $data, 'pk');
}
if (array_key_exists('action', $_POST)) {
    $an = $_POST['action'];
    if (array_key_exists($an, $actions)) {
        $a = $actions[$an];
        $auth = $a['authorization'];
        if (has_auth($auth)) {
            call_user_func($a['action']);
        } else {
            error_log('Fantasy: intento de llamar función del controlador ' . $an . ' por usuario no autorizado de clase ' . userclass());
        }
    } else {
        error_log('Fantasy: intento de llamar la función inexistente del controlador "' . $an . '" por usuario de clase ' . userclass());
    }
}
if (array_key_exists('goto', $_POST)) {
    header('Location: ' . $_POST['goto']);
} else {
    header('Location: index');
}
Beispiel #7
0
<?php

require 'include/pre.php';
if (has_auth('user')) {
    $admin = has_auth('admin');
    $uid = userdata()->get('id');
    ?>
<h2>Ligas</h2>
<p>Ver todas | <a href="ligas_publicas">públicas</a> | <a href="ligas_privadas">privadas</a></p>
<form action="liga_insert">
  <button type="submit">Crear liga</button>
</form>
<?php 
    foreach (UIFacade::ligas() as $l) {
        if (!$admin && $l['liga']->get('es pública') == 'f' && $uid != $l['creador']->get('id') && !in_array($uid, array_map(function ($p) {
            return $p->get('id');
        }, $l['participantes']))) {
            continue;
        }
        $id = $l['liga']->get('id');
        $img = $l['creador']->get('URL de la foto');
        if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
            $img = 'static/images/usuario/' . $img;
        }
        ?>
<div>
  <h3><?php 
        echo $l['liga']->get('nombre');
        ?>
</h3>
  <img class="imagen" src="<?php 
Beispiel #8
0
require 'include/pre.php';
if (has_auth('user') and array_key_exists('id', $_GET)) {
    $d = UIFacade::liga_detail($_GET['id']);
    $uid = userdata()->get('id');
    $see = $d['liga']->get('es pública') || has_auth('admin');
    if (!$see) {
        foreach ($d['participantes'] as $p) {
            if ($p->get('id') == $uid) {
                $see = true;
                break;
            }
        }
    }
    if ($see) {
        $own = has_auth('admin') || $d['creador']->get('id') == $uid;
        $c_img = $d['creador']->get('URL del avatar') or $c_img = 'generico.jpg';
        if ($c_img and !filter_var($c_img, FILTER_VALIDATE_URL)) {
            $c_img = 'static/images/usuario/' . $c_img;
        }
        ?>
<h2>Liga <?php 
        echo ($d['liga']->get('es pública') == 't' ? 'pública ' : 'privada ') . $d['liga']->get('nombre');
        ?>
</h2>
<div style="border: 1em">
  <img src="<?php 
        echo $c_img;
        ?>
" style="float: left; clear: both"/>
  <p>Creador: <?php