{$page}
--
string
con el HTML necesario para presentar los campos del formulario. Es necesario asegurarse que como parte del envío se envía un parámetro con nombre (i.e. utilizado como valor del atributo name del botón de envío del formulario).
- */
- protected function generaCamposFormulario ($datos) {
- return '';
- }
-
- /**
- * Procesa los datos del formulario.
- */
- protected function procesaFormulario($datos) {
-
- }
-
- /**
- * Función que verifica si el usuario ha enviado el formulario. Comprueba si existe el parámetro $formId
en $params
.
- *
- * @param array $params Array que contiene los datos recibidos en el envío formulario.
- *
- * @return boolean Devuelve TRUE
si $formId
existe como clave en $params
- */
- private function formularioEnviado(&$params) {
- return isset($params['action']) && $params['action'] == $this->formId;
- }
-
- /**
- * Función que genera el HTML necesario para el formulario.
- *
- *
- * @param array $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
- *
- * @param array $datos (opcional) Array con los valores por defecto de los campos del formulario.
- */
- private function generaFormulario($errores = array(), &$datos = array()) {
-
- $html= $this->generaListaErrores($errores);
-
- $html .= '';
- return $html;
- }
-
- private function generaListaErrores($errores) {
- $html='';
- $numErrores = count($errores);
- if ( $numErrores == 1 ) {
- $html .= "- ".$errores[0]."
";
- } else if ( $numErrores > 1 ) {
- $html .= "- ";
- $html .= implode("
- ", $errores);
- $html .= "
";
- }
- return $html;
- }
-
- private function csrfguard_GenerateToken($formId) {
- if ( ! isset($_SESSION) ) {
- throw new Exception('La sesión del usuario no está definida.');
- }
-
- if ( function_exists('hash_algos') && in_array('sha512', hash_algos()) ) {
- $token = hash('sha512', mt_rand(0, mt_getrandmax()));
- } else {
- $token=' ';
- for ($i=0;$i<128;++$i) {
- $r=mt_rand(0,35);
- if ($r<26){
- $c=chr(ord('a')+$r);
- } else{
- $c=chr(ord('0')+$r-26);
- }
- $token.=$c;
- }
- }
-
- $_SESSION[$formId.'_'.self::CSRF_PARAM]=$token;
-
- return $token;
- }
-
- private function csrfguard_ValidateToken($formId, $tokenRecibido) {
- if ( ! isset($_SESSION) ) {
- throw new Exception('La sesión del usuario no está definida.');
- }
-
- $result = TRUE;
-
- if ( isset($_SESSION[$formId.'_'.self::CSRF_PARAM]) ) {
- if ( $_SESSION[$formId.'_'.self::CSRF_PARAM] !== $tokenRecibido ) {
- $result = array();
- $result[] = 'Has enviado el formulario dos veces';
- }
- $_SESSION[$formId.'_'.self::CSRF_PARAM] = ' ';
- unset($_SESSION[$formId.'_'.self::CSRF_PARAM]);
- } else {
- $result = array();
- $result[] = 'Formulario no válido';
- }
- return $result;
- }
-}
-
-/*
-class Formulario {
-
- private $formId;
- private $action;
- private $classAtt;
- private $enctype;
-
- public function __construct($formId, $opciones = array() ) {
- $this->formId = $formId;
- $opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null,
- 'enctype' => null );
- $opciones = array_merge($opcionesPorDefecto, $opciones);
-
- $this->ajax = $opciones['ajax'];
- $this->action = $opciones['action'];
- $this->classAtt = $opciones['class'];
- $this->enctype = $opciones['enctype'];
-
- if (!$this->action) {
- $app = Aplicacion::getSingleton();
- $this->action = htmlspecialchars($_SERVER['REQUEST_URI']);
- $this->action = $app->resuelve($this->action);
- }
- }
-}
-*/
-?>
\ No newline at end of file
diff --git a/assets/php/template.php b/assets/php/template.php
deleted file mode 100644
index 5801e38..0000000
--- a/assets/php/template.php
+++ /dev/null
@@ -1,176 +0,0 @@
-page = $_SERVER['PHP_SELF']; //Page that instantiates the template.
- $this->prefix = '../'; //Default prefix.
-
- $this->set_page_prefix(); //Assigns the name and prefix of the page.
-
- $this->session = 'Iniciar Sesión'; //Default, the session has not started.
- $this->session_route = 'login/'; //Default, the session has not started.
- $this->panel = ''; //Default, the session has not started.
- $this->user_route = 'panel_user/'; //Default, the type of client is user.
- }
-
- //Methods:
-
- //Assigns the name and prefix of the page:
- private function set_page_prefix() {
- switch(true){
- case strpos($this->page, 'panel_user'): $this->page = 'Panel de Usuario'; break;
- case strpos($this->page, 'panel_manager'): $this->page = 'Panel de Gerente'; break;
- case strpos($this->page, 'panel_admin'): $this->page = 'Panel de Administrador'; break;
- case strpos($this->page, 'login'): $this->page = 'Acceso'; break;
- case strpos($this->page, 'logout'): $this->page = 'Cerrar Sesión'; break;
- case strpos($this->page, 'showtimes'): $this->page = 'Cartelera'; break;
- case strpos($this->page, 'cinemas'): $this->page = 'Nuestros Cines'; break;
- case strpos($this->page, 'about_us'): $this->page = 'Sobre FDI-Cines'; $this->prefix = '../../'; break;
- case strpos($this->page, 'terms'): $this->page = 'Términos y Condiciones'; $this->prefix = '../../'; break;
- case strpos($this->page, 'detalles'): $this->page = 'Detalles'; $this->prefix = '../../'; break;
- case strpos($this->page, 'bocetos'): $this->page = 'Bocetos'; $this->prefix = '../../'; break;
- case strpos($this->page, 'miembros'): $this->page = 'Miembros'; $this->prefix = '../../'; break;
- case strpos($this->page, 'planificacion'): $this->page = 'Planificación'; $this->prefix = '../../'; break;
- case strpos($this->page, 'contacto'): $this->page = 'Contacto'; break;
- default: $this->page = 'FDI-Cines'; $this->prefix = './'; break;
- }
- }
-
- //Returns page name:
- function get_page(){
- return $this->page;
- }
-
- //Returns page prefix:
- function get_prefix(){
- return $this->prefix;
- }
-
- //Print generic Head:
- function print_head(){
- $page = $this->page;
- $prefix = $this->prefix;
-
- echo"
- CompluCine | {$page}
-
-
-
-
- \n";
- }
-
- //Print generic Header:
- function print_header(){
- $page = $this->page;
- $prefix = $this->prefix;
- $session = $this->session;
- $session_route =$this->session_route;
- $user_route = $this->user_route;
- $panel =$this->panel;
-
- if(isset($_SESSION["nombre"])){
- if($_SESSION["rol"] == "admin") $user_route = 'panel_admin/';
- else if($_SESSION["rol"] == "manager") $user_route = 'panel_manager/';
- $panel = "Mi Panel ";
- $session = 'Cerrar Sesión';
- $session_route = 'logout/';
- }
-
- echo"
- CompluCine | {$page}
-
- \n";
- }
-
- //Print generic subHeader:
- function print_subheader(){
- //$page = $this->page;
- $prefix = $this->prefix;
-
- echo"
- \n";
- }
-
- //Print generic Main:
- function print_main(){
- $page = $this->page;
- $prefix = $this->prefix;
-
- /* SubHeader on Main */
- $sub_header = '';
- if(strpos($_SERVER['PHP_SELF'], 'fdicines')){
- $sub_header = "
-
-
- \n";
- }
-
- /* MAIN */
- echo"
- \n";
- }
-
- //Print generic Footer:
- function print_footer(){
- //$page = $this->page;
- $prefix = $this->prefix;
-
- echo"\n";
- }
-
- }
-?>
\ No newline at end of file
diff --git a/assets/php/user_dao.php b/assets/php/user_dao.php
deleted file mode 100644
index 7fba88d..0000000
--- a/assets/php/user_dao.php
+++ /dev/null
@@ -1,83 +0,0 @@
-encryptPass($password);
-
- $sql = sprintf( "INSERT INTO users( id, username, email, passwd, rol)
- VALUES ( '%s', '%s', '%s', '%s', '%s')",
- $id, $username, $email, $password, $rol );
-
- return $sql;
- }
-
- //Returns a query to check if the user name exists.
- public function selectUser($username){
- $username = $this->mysqli->real_escape_string($username);
-
- $sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
- $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
-
- return $resul;
- }
-
- //Returns a query to check if the user pass matches.
- public function selectPass($username, $password){
- $username = $this->mysqli->real_escape_string($username);
- $password = $this->mysqli->real_escape_string($password);
- $password = $this->encryptPass($password);
-
- $sql = sprintf( "SELECT * FROM users WHERE username = '%s' AND passwd = '%s'", $username, $password);
- $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
-
- //return $this->mysqli->query($sql);
- return $resul;
- }
-
- //Returns a query to get the user's data.
- public function userData($id){
- $sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
- $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
-
- return $resul;
- }
-
- //Create a new User Data Transfer Object.
- public function loadUser($id, $username, $email, $password, $rol){
- return new UserDTO($id, $username, $email, $password, $rol);
- }
-
- }
-
-?>
\ No newline at end of file
diff --git a/assets/php/user_dto.php b/assets/php/user_dto.php
deleted file mode 100644
index 4e882f3..0000000
--- a/assets/php/user_dto.php
+++ /dev/null
@@ -1,37 +0,0 @@
-_id = $id;
- $this->_username = $username;
- $this->_email = $email;
- $this->_password = $password;
- $this->_rol = $rol;
- }
-
- //Methods:
-
- //Getters && Setters:
- public function setId($id){ $this->_id = $id; }
- public function getId(){ return $this->_id; }
- public function setName($username){ $this->_username = $username; }
- public function getName(){ return $this->_username; }
- public function setEmail($email){ $this->_email = $email; }
- public function getEmail(){ return $this->_email; }
- public function setPass($passwd){ $this->_password = $passwd; }
- public function getPass(){ return $this->_password; }
- public function setRol($rol){ $this->_rol = $rol; }
- public function getRol(){ return $this->_rol; }
-
- }
-?>
\ No newline at end of file
diff --git a/assets/php/users_dto_interface.php b/assets/php/users_dto_interface.php
deleted file mode 100644
index 6bfc7aa..0000000
--- a/assets/php/users_dto_interface.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
\ No newline at end of file