Exemplo n.º 1
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')) {
Exemplo n.º 2
0
<?php

require 'include/pre.php';
if (has_auth('user') and array_key_exists('id', $_GET)) {
    $l = UIFacade::select('Liga', array('id' => $_GET['id']));
    if (has_auth('admin') || $l->get('creador') == userdata()->get('id')) {
        $s = ' selected="selected"';
        $p = $l->get('es pública') == 't';
        ?>
<h2>Modificar liga</h2>
<form action="controller" method="post">
  <p>Nombre: <input type="text" name="nombre" value="<?php 
        echo $l->get('nombre');
        ?>
"/></p>
<?php 
        if (has_auth('admin')) {
            ?>
  <p>
    Tipo:
    <select name="es pública">
      <option value="t"<?php 
            if ($p) {
                echo $s;
            }
            ?>
>Pública</option>
      <option value="f"<?php 
            if (!$p) {
                echo $s;
            }
Exemplo n.º 3
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">
Exemplo n.º 4
0
        if (!has_auth('admin')) {
            $liga = UIFacade::select('Liga', array('id' => $_POST['liga']));
            if (!$liga) {
                return;
            }
            if ($liga->get('creador') != userdata()->get('id')) {
                return;
            }
        }
        remove_by_pk('Participa');
    }
}), 'liga_remove' => array('authorization' => 'user', 'action' => function () {
    if (userclass() == 'admin') {
        remove_by_pk('Liga');
    } else {
        $l = UIFacade::select('Liga', set_pk('Liga'));
        if ($l->get('creador') == userdata()->get('id')) {
            $l->remove();
        }
    }
}));
function update_fields($entity_class, $data = array())
{
    UIFacade::update($entity_class, set_fields($entity_class, $data));
}
function insert_fields($entity_class, $data = array())
{
    UIFacade::insert($entity_class, set_fields($entity_class, $data));
}
function remove_by_pk($entity_class)
{
Exemplo n.º 5
0
 public static function calendario($search_opt, $search_query)
 {
     $search_opts = array('fecha' => array('juego' => array('inicio')), 'estadio' => array('estadio' => array('nombre')), 'equipo' => array('equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado'), 'equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'local' => array('equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'visitante' => array('equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'todos' => array('juego' => array('inicio'), 'estadio' => array('nombre'), 'equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado'), 'equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')));
     return array_reduce(self::retrieveAll('Juego'), function ($acc, $j) use($search_opts, $search_opt, $search_query) {
         $new = array('juego' => $j, 'equipo local' => UIFacade::select('Equipo', array('id' => $j->get('equipo local'))), 'equipo visitante' => UIFacade::select('Equipo', array('id' => $j->get('equipo visitante'))), 'estadio' => UIFacade::select('Estadio', array('id' => $j->get('estadio'))));
         if (!array_key_exists($search_opt, $search_opts)) {
             $acc[] = $new;
         } else {
             foreach ($search_opts[$search_opt] as $obj => $fs) {
                 foreach ($fs as $f) {
                     if (stristr($new[$obj]->get($f), $search_query)) {
                         $acc[] = $new;
                         break 2;
                     }
                 }
             }
         }
         return $acc;
     }, array());
 }
Exemplo n.º 6
0
        $img = 'static/images/equipo/' . $img;
    }
    $Aux['P'] = '<a class="irAP"><img src="' . $img . '"  width="50" height="50" /></a>';
} else {
    $Aux['P'] = '<a class="irAP"><img src="assets/images/Fotos_Roster/EquipoDefault.jpg"  width="50" height="50" /></a>';
}
$i = 0;
$D = '';
foreach ($Jugadores_Roster as $J_R) {
    // MARK
    $img = $J_R->get('URL de la foto');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/jugador/' . $img;
    }
    // FIXME: img url assets static etc
    $Tmp = UIFacade::select('Jugador', array('id' => $J_R->get('jugador')));
    $D .= '
        <div class="a' . $J_R->get('posición') . '">
                <div id="imgjugador">
                <img src="' . $img . '" height="100" width="70" />
                </div>
                <table width="240" align="left">
                        <tr class="impar">
                                <td><p>Nombre:</p></td>
                                <td><p>' . $Tmp->get('nombre completo') . '</p></td>
                        </tr>
                        <tr class="par">
                                <td><p>Posicion:</p></td>
                                <td><p>' . $J_R->get('posición') . '</p></td>
                        </tr>
                        <tr class="impar">
Exemplo n.º 7
0
    echo $e->get('nombre completo');
    ?>
</p>
  <p><strong>Nombre corto:                   </strong> <?php 
    echo $e->get('nombre corto');
    ?>
</p>
  <p><strong>Siglas:                         </strong> <?php 
    echo $e->get('siglas');
    ?>
</p>
  <p><strong>Año de fundación:               </strong> <?php 
    echo $e->get('año de fundación');
    ?>
</p>
  <p><strong>Ciudad:                         </strong> <?php 
    echo $e->get('ciudad');
    ?>
</p>
  <p><strong>Estado:                         </strong> <?php 
    echo $e->get('estado');
    ?>
</p>
  <p><strong>Estadio principal:              </strong> <?php 
    echo UIFacade::select('Estadio', array('id' => $e->get('estadio principal')))->get('nombre');
    ?>
</p>
</div>
<?php 
}
require 'include/post.html';
Exemplo n.º 8
0
function userclass()
{
    global $user_class;
    return $user_class;
}
global $user_data;
function userdata()
{
    global $user_data;
    return $user_data;
}
function has_auth($auth, $userclass = null)
{
    if ($userclass === null) {
        $userclass = userclass();
    }
    return $userclass == $auth or $userclass == 'user' and in_array($auth, array('guest')) or $userclass == 'admin' and in_array($auth, array('guest', 'user'));
    // un admin es también un guest y un user
}
session_start();
$user_class = array_key_exists('user_class', $_SESSION) ? $_SESSION['user_class'] : 'guest';
// FIXME: esto es super inseguro
if (!in_array(userclass(), array('user', 'admin', 'guest'))) {
    die('Invalid session.');
}
require 'include/dbconn/' . userclass() . '.php';
$user_data = null;
if (userclass() != 'guest') {
    $user_data = UIFacade::select('Usuario', array('id' => $_SESSION['user']));
    // FIXME: esto es super inseguro
}
Exemplo n.º 9
0
        ?>
    <option value="<?php 
        echo $o->get($value);
        ?>
"><?php 
        echo $o->get($text);
        ?>
</option>
<?php 
    }
    ?>
</select>
<?php 
}
if (has_auth('admin') && array_key_exists('id', $_GET)) {
    $e = UIFacade::select('Equipo', array('id' => $_GET['id']));
    $img = $e->get('URL del logo');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/equipo/' . $img;
    }
    ?>
<h2>Agregar equipo</h2>
<div>
  <form action="controller" enctype="multipart/form-data" method="post">
    <img src="<?php 
    echo $img;
    ?>
"/>
    <p>Nombre completo:</p>
    <p><input name="nombre completo" type="text" value="<?php 
    echo $e->get('nombre completo');
Exemplo n.º 10
0
<?php

require 'include/pre.php';
if (has_auth('admin') && array_key_exists('id', $_GET)) {
    $c = UIFacade::select('Contenido', array('id' => $_GET['id']));
    ?>
<h2>Actualizar contenido</h2>
<div>
  <form action="controller" method="post" id="Alcance">
    <input type="hidden" name="goto" value="index"/>
    <table width="400" border="0">
      <tr>
        <td>Título:</td>
        <td>
          <input type="text" name="título" value="<?php 
    echo $c->get('título');
    ?>
" size="25"/>
        </td>
      </tr>
      <tr>
        <td>Contenido:</td>
        <td>
          <textarea name="texto" id="texto" cols="40" rows="4"><?php 
    echo $c->get('texto');
    ?>
</textarea>
        </td>
      </tr>
      <tr>
        <td>URL de la imagen:</td>