-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d1a2d2
commit 00e9f08
Showing
844 changed files
with
44,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<IfModule mod_rewrite.c> | ||
Options +FollowSymlinks | ||
RewriteEngine on | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
#RewriteBase /storian/ | ||
|
||
RewriteRule intro$ Controller/index.php | ||
RewriteRule modos$ Controller/goTo_seleccionModo.php | ||
RewriteRule info$ Controller/goTo_info.php | ||
|
||
RewriteRule modos/leer$ Controller/goTo_formularioLeeHistoria.php | ||
RewriteRule modos/escribir$ Controller/goTo_control_acceso.php | ||
RewriteRule modos/leer/cuento$ Controller/procesaHistoria.php | ||
|
||
RewriteRule login$ Controller/goTo_control_acceso.php | ||
RewriteRule acceso$ Controller/procesarControl.php | ||
RewriteRule checkUser$ Controller/check-username.php | ||
RewriteRule checkEmail$ Controller/check-email.php | ||
RewriteRule registro$ Controller/goTo_formAltaUser.php | ||
RewriteRule perfil$ Controller/goTo_panel_usuario.php | ||
RewriteRule alta$ Controller/procesarAltaUsuario.php | ||
RewriteRule baja$ Controller/eliminaCuenta.php | ||
|
||
RewriteRule cierraSesion$ Controller/cierraSesion.php | ||
RewriteRule grabaHistoria$ Controller/grabarHistoria.php | ||
|
||
# Ver PHP errors | ||
php_flag display_errors off | ||
php_value error_reporting 6143 | ||
|
||
|
||
|
||
|
||
</IfModule> | ||
AddType image/svg+xml svg | ||
AddType image/svg+xml svgz | ||
AddType image/x-icon .ico | ||
AddEncoding gzip svgz | ||
|
||
<ifModule mod_headers.c> | ||
<FilesMatch "\.svg$"> | ||
SetHandler application/x-httpd-php | ||
Header set Content-Type "image/svg+xml" | ||
</FilesMatch> | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
header('Content-type: application/json'); | ||
require_once '../Model/Usuario.php'; | ||
|
||
$email = $_POST['email']; | ||
|
||
$usuario = new Usuario("", $email, "", "", "", ""); | ||
if ( $usuario->existe() ){ | ||
echo(json_encode(false)); | ||
}else{ | ||
echo(json_encode(true)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
header('Content-type: application/json'); | ||
require_once '../Model/Usuario.php'; | ||
|
||
$username = $_POST['username']; | ||
|
||
$usuario = new Usuario($username, "", "", "", "", ""); | ||
if ( $usuario->existe() ){ | ||
echo(json_encode(false)); | ||
}else{ | ||
echo(json_encode(true)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
include '../Controller/sesionCheck.php'; | ||
// Vacia variable de sesion | ||
unset($_SESSION['usuario']); | ||
// Redirige a index.php | ||
header('Location: /storian/modos'); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
include_once '../Model/Usuario.php'; | ||
include_once '../Controller/sesionCheck.php'; | ||
|
||
// Recoge Variables | ||
$nombre = $_POST['nombre']; | ||
|
||
|
||
// Construye objeto usuario | ||
$userVacio = new Usuario($nombre, "", "", "", "", "",""); | ||
// Lo borra de la base de datos, y de la sesion | ||
$userVacio->delete(); | ||
unset($_SESSION['usuario']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
include '../Controller/sesionCheck.php'; | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
|
||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
$data ['nombreUsuario'] = $usuarioSes; | ||
|
||
|
||
// Si viene como invitado, ir a registro. | ||
if ($usuarioSes == "Invitado"){ | ||
echo $twig->render('control_acceso.html.twig',$data); | ||
|
||
// Si no, ir a mandar enviar historia | ||
}else{ | ||
echo $twig->render('formularioEnviaHistoria.html.twig',$data); | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
include '../Controller/sesionCheck.php'; | ||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
$data ['nombreUsuario'] = $usuarioSes; | ||
|
||
echo $twig->render('formAltaUser.html.twig',$data); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
include '../Controller/sesionCheck.php'; | ||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
$data ['nombreUsuario'] = $usuarioSes; | ||
|
||
echo $twig->render('formularioLeeHistoria.html.twig',$data); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
include '../Controller/sesionCheck.php'; | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
|
||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
|
||
$data ['nombreUsuario'] = $usuarioSes; | ||
echo $twig->render('info.html.twig',$data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
include '../Controller/sesionCheck.php'; | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
|
||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
|
||
// Construye objeto | ||
$userVacio = new Usuario($usuarioSes, "", "", "", "", "",""); | ||
$infoUser = $userVacio->obtenInfo(); | ||
$user = new Usuario($infoUser->nombreUser, $infoUser->email, "", $infoUser->lugarNacimiento, $infoUser->fechNac, $infoUser->fechAlta); | ||
|
||
$data = [ | ||
'nombreUsuario' => $usuarioSes, | ||
'datosUsuario' => [ | ||
'nombre' => $user->getNombreUser(), | ||
'email' => $user->getEmail(), | ||
'lugarNac' => $user->getLugarNac(), | ||
'fecNac' => $user->getFechaNac(), | ||
'fecAlt' => $user->getFechaAlt(), | ||
'numHist' => $user->numHistorias(), | ||
'numHistLeidas' => $user->fetchNumLeidos() | ||
] | ||
]; | ||
|
||
|
||
|
||
echo $twig->render('panel_usuario.html.twig',$data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
include '../Controller/sesionCheck.php'; | ||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
|
||
$data ['nombreUsuario'] = $usuarioSes; | ||
|
||
echo $twig->render('seleccion_modo.html.twig',$data); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/* | ||
* Envia los datos recibidos de estructura.js a traves de ajax a la base de datos. | ||
*/ | ||
include_once '../Model/Historia.php'; | ||
include_once '../Model/Usuario.php'; | ||
|
||
// Recoge Variables | ||
$titulo = $_POST['titulo']; | ||
$contenido = $_POST['historia']; | ||
$nombreUser = $_POST['autor']; | ||
|
||
// Construye objeto usuario | ||
$userVacio = new Usuario($nombreUser, "", "", "", "", ""); | ||
$infoUser = $userVacio->obtenInfo(); | ||
$user = new Usuario($infoUser->nombreUser, $infoUser->email, "", $infoUser->lugarNacimiento, $infoUser->fechNac, $infoUser->fechAlta); | ||
|
||
$data = [ | ||
'nombreUsuario' => $usuarioSes, | ||
'datosUsuario' => [ | ||
'nombre' => $user->getNombreUser(), | ||
'email' => $user->getEmail(), | ||
'lugarNac' => $user->getLugarNac(), | ||
'fecNac' => $user->getFechaNac(), | ||
'fecAlt' => $user->getFechaAlt(), | ||
'numHist' => $user->numHistorias() | ||
] | ||
]; | ||
|
||
|
||
// Envia a la db | ||
$historia = new Historia("", $titulo, $contenido, $user->getEmail(),""); | ||
$historia->insert(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require_once 'twig/lib/Twig/Autoloader.php'; | ||
require_once '../Model/Usuario.php'; | ||
include '../Controller/sesionCheck.php'; | ||
Twig_Autoloader::register(); | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__.'/../View'); | ||
$twig = new Twig_Environment($loader); | ||
|
||
$data ['nombreUsuario'] = $usuarioSes; | ||
|
||
echo $twig->render('index.html.twig',$data); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
/* | ||
* Procesa los datos recibidos de estructura.js a traves de ajax y crea la historia con las caracteristicas elegidas por el user. | ||
*/ | ||
require_once '../Model/Historia.php'; | ||
require_once '../Model/Personaje.php'; | ||
require_once '../Model/Lugar.php'; | ||
require_once '../Model/Usuario.php'; | ||
require_once '../Controller/sesionCheck.php'; | ||
|
||
|
||
// Recoge Variables | ||
$nombreP1 = $_POST['nombreP1']; | ||
$tipoP1 = $_POST['tipoP1']; | ||
$nombreP2 = $_POST['nombreP2']; | ||
$tipoP2 = $_POST['tipoP2']; | ||
$nomLui = $_POST['lugar']; | ||
|
||
// Crear personajes y lugar. | ||
$personaje1 = new Personaje($nombreP1, $tipoP1); | ||
$personaje2 = new Personaje($nombreP2, $tipoP2); | ||
$lugar = new Lugar($nomLui); | ||
|
||
// Articulos | ||
// Personaje 1 | ||
if ($personaje1->getSexo() == "masculino"){ | ||
$artDetP1m = "El"; $artDetP1 = "el"; $oaP1 = "o"; $pronP1 = "él"; $detIndP1 = "un"; $neutP1 = "lo"; | ||
}else{ | ||
$artDetP1m = "La"; $artDetP1 = "la"; $oaP1 = "a"; $pronP1 = "ella"; $detIndP1 = "una"; $neutP1 = "la"; | ||
} | ||
// Personaje 2 | ||
if ($personaje2->getSexo() == "masculino"){ | ||
$artDetP2m = "El"; $artDetP2 = "el"; $oaP2 = "o"; $pronP2 = "él"; $detIndP2 = "un"; $neutP2 = "lo"; | ||
}else{ | ||
$artDetP2m = "La"; $artDetP2 = "la"; $oaP2 = "a"; $pronP2 = "ella"; $detIndP2 = "una"; $neutP2 = "la"; | ||
} | ||
// Lugar | ||
if ($lugar->getSexo() == "masculino"){ | ||
$artDetLum = "El"; $artDetLu = "el"; $oaLu = "o"; $detIndLu = "un"; | ||
}else{ | ||
$artDetLum = "La"; $artDetLu = "la"; $oaLu = "a"; $detIndLu = "una"; | ||
} | ||
// Selecciona historia random de DB | ||
$historiaRnd = Historia::random(); | ||
$historia = new Historia($historiaRnd->id, $historiaRnd->titulo, $historiaRnd->contenido, $historiaRnd->autor, $historiaRnd->fecha); | ||
|
||
// Aumentar numero de Cuentos leidos por ese user | ||
$usuario = new Usuario($usuarioSes,"","","","",""); | ||
$usuario->addNumLeidos(); | ||
|
||
// Extrae titulo y contenido y autor | ||
$titulo = $historia->getTitulo(); | ||
$contenido = $historia->getContenido(); | ||
$autor = $historia->getAutor(); | ||
|
||
|
||
// Personaliza historia | ||
// Titulo | ||
// Personaje 1 | ||
$titulo = str_replace("artDetP1m",$artDetP1m,$titulo); | ||
$titulo = str_replace("artDetP1",$artDetP1,$titulo); | ||
$titulo = str_replace("nombP1i",$nombreP1,$titulo); | ||
$titulo = str_replace("tipoP1i",$tipoP1,$titulo); | ||
$titulo = str_replace("oaP1",$oaP1,$titulo); | ||
$titulo = str_replace("pronP1",$pronP1,$titulo); | ||
$titulo = str_replace("detIndP1",$detIndP1,$titulo); | ||
$titulo = str_replace("neutP1",$neutP1,$titulo); | ||
// Personaje 2 | ||
$titulo = str_replace("artDetP2m",$artDetP2m,$titulo); | ||
$titulo = str_replace("artDetP2",$artDetP2,$titulo); | ||
$titulo = str_replace("nombP2i",$nombreP2,$titulo); | ||
$titulo = str_replace("tipoP2i",$tipoP2,$titulo); | ||
$titulo = str_replace("oaP2",$oaP2,$titulo); | ||
$titulo = str_replace("pronP2",$pronP2,$titulo); | ||
$titulo = str_replace("detIndP2",$detIndP2,$titulo); | ||
$titulo = str_replace("neutP2",$neutP2,$titulo); | ||
// Lugar | ||
$titulo = str_replace("artDetLum",$artDetLum,$titulo); | ||
$titulo = str_replace("artDetLu",$artDetLu,$titulo); | ||
$titulo = str_replace("oaLu",$oaLu,$titulo); | ||
$titulo = str_replace("detIndLu",$detIndLu,$titulo); | ||
$titulo = str_replace("nomLui",$nomLui,$titulo); | ||
|
||
// Historia | ||
// Personaje 1 | ||
$contenido = str_replace("artDetP1m",$artDetP1m,$contenido); | ||
$contenido = str_replace("artDetP1",$artDetP1,$contenido); | ||
$contenido = str_replace("nombP1i",$nombreP1,$contenido); | ||
$contenido = str_replace("tipoP1i",$tipoP1,$contenido); | ||
$contenido = str_replace("oaP1",$oaP1,$contenido); | ||
$contenido = str_replace("pronP1",$pronP1,$contenido); | ||
$contenido = str_replace("detIndP1",$detIndP1,$contenido); | ||
$contenido = str_replace("neutP1",$neutP1,$contenido); | ||
// Personaje 2 | ||
$contenido = str_replace("artDetP2m",$artDetP2m,$contenido); | ||
$contenido = str_replace("artDetP2",$artDetP2,$contenido); | ||
$contenido = str_replace("nombP2i",$nombreP2,$contenido); | ||
$contenido = str_replace("tipoP2i",$tipoP2,$contenido); | ||
$contenido = str_replace("oaP2",$oaP2,$contenido); | ||
$contenido = str_replace("pronP2",$pronP2,$contenido); | ||
$contenido = str_replace("detIndP2",$detIndP2,$contenido); | ||
$contenido = str_replace("neutP2",$neutP2,$contenido); | ||
// Lugar | ||
$contenido = str_replace("artDetLum",$artDetLum,$contenido); | ||
$contenido = str_replace("artDetLu",$artDetLu,$contenido); | ||
$contenido = str_replace("oaLu",$oaLu,$contenido); | ||
$contenido = str_replace("nomLug",$lugar,$contenido); | ||
$contenido = str_replace("detIndLu",$detIndLu,$contenido); | ||
$contenido = str_replace("nomLui",$nomLui,$contenido); | ||
|
||
|
||
// Envia historia como array | ||
$arrayHistoria = array( | ||
"titulo" => $titulo, | ||
"contenido" => $contenido, | ||
"autor" => $autor, | ||
); | ||
|
||
echo json_encode($arrayHistoria); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
require_once '../Model/Usuario.php'; | ||
|
||
|
||
|
||
if (isset($_POST['username'])){ | ||
//$nombreUser = PDO::quote($_POST['username']); | ||
$nombreUser = $_POST['username']; | ||
$email = $_POST['email']; | ||
$fechNac = $_POST['date']; | ||
$password = $_POST['password']; | ||
// Convierte el formato de la fecha al de sql | ||
$date = date('Y-m-d', strtotime($fechNac)); | ||
|
||
$usuario = new Usuario($nombreUser, $email, $password, "españa", $date, "",""); | ||
$usuario->insert(); | ||
return true; | ||
} |
Oops, something went wrong.