'.$this->creaTitulo("Color Lateral","Color que se aplicará a la parte izquierda de la aplicación donde aparece el menú").'\n";
+
return $salida;
}
private function listaArticulos()
{
$salida = "\n";
- $comando = "select * from Articulos order by descripcion, marca, modelo";
+ $comando = 'select * from Articulos order by descripcion, marca, modelo';
$resultado = $this->bdd->ejecuta($comando);
if (!$resultado) {
return $this->bdd->mensajeError($comando);
}
while ($fila = $this->bdd->procesaResultado()) {
- $salida.=" \n";
+ $salida .= ' \n";
}
- $salida.="\n";
+ $salida .= "\n";
+
return $salida;
}
private function formulario($accion, $etiqueta, $lista)
{
- $salida = ''."\n";
+ $salida .= "";
+
return $salida;
}
private function formularioUbicacion()
{
//Genera un formulario con las ubicaciones disponibles.
- $accion = "index.php?informeInventario&opc=listarUbicacion";
+ $accion = 'index.php?informeInventario&opc=listarUbicacion';
+
return $this->formulario($accion, 'Ubicación', $this->listaUbicaciones());
}
private function formularioArticulo()
{
- $accion = "index.php?informeInventario&opc=listarArticulo";
+ $accion = 'index.php?informeInventario&opc=listarArticulo';
+
return $this->formulario($accion, 'Artículo', $this->listaArticulos());
}
-
+
private function inventarioTotal()
{
return $this->dialogo();
@@ -235,18 +244,19 @@ class InformeInventario {
$dialogo = '';
+
return $dialogo;
}
-
+
private function listarTotal()
{
- $fichero = "xml/inventarioUbicacion.xml";
- $salida = TMP."/inventarioUbicacion.xml";
- $comando = "select * from Ubicaciones ;";
+ $fichero = 'xml/inventarioUbicacion.xml';
+ $salida = TMP.'/inventarioUbicacion.xml';
+ $comando = 'select * from Ubicaciones ;';
$resultado = $this->bdd->ejecuta($comando);
if (!$resultado) {
return $this->bdd->mensajeError($comando);
@@ -255,10 +265,10 @@ class InformeInventario {
$bdatos = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
$primero = true;
while ($fila = $this->bdd->procesaResultado()) {
- $plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
- $plantilla = str_replace("{id}", $fila['id'], $plantilla);
- $plantilla = str_replace("{Descripcion}", $fila['Descripcion'], $plantilla);
- file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
+ $plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla '.$fichero);
+ $plantilla = str_replace('{id}', $fila['id'], $plantilla);
+ $plantilla = str_replace('{Descripcion}', $fila['Descripcion'], $plantilla);
+ file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla '.$salida);
if ($primero) {
$primero = false;
$informe = new InformePDF($bdatos, $salida, true);
@@ -266,9 +276,7 @@ class InformeInventario {
$informe->crea($salida);
}
$informe->cierraPDF();
+
return $this->devuelveInforme($informe);
}
-
}
-
-?>
diff --git a/InformePDF.php b/InformePDF.php
index d56feaf..99c494d 100644
--- a/InformePDF.php
+++ b/InformePDF.php
@@ -1,12 +1,13 @@
+ *
* @version 1.0
- * @package Inventario
+ *
* @copyright Copyright (c) 2008, Ricardo Montañana
- * @package Inventario
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* This file is part of Inventario.
@@ -14,20 +15,18 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Inventario is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Inventario. If not, see .
- *
*/
-class InformePDF {
-
+class InformePDF
+{
/**
- *
* @var basedatos Controlador de la base de datos
*/
private $bdd;
@@ -36,14 +35,17 @@ class InformePDF {
private $def;
/**
- * El constructor recibe como argumento el nombre del archivo XML con la definición, encargándose de recuperarla y guardar toda la información localmente
- * @param basedatos $bdd manejador de la base de datos
- * @param string $definicion fichero con la definición del informe en XML
- * @param boolean $registrado usuario registrado si/no
+ * El constructor recibe como argumento el nombre del archivo XML con la definición, encargándose de recuperarla y guardar toda la información localmente.
+ *
+ * @param basedatos $bdd manejador de la base de datos
+ * @param string $definicion fichero con la definición del informe en XML
+ * @param bool $registrado usuario registrado si/no
+ *
* @return ficheroPDF
- * todo: cambiar este comentario
+ * todo: cambiar este comentario
*/
- public function __construct($bdd, $definicion, $registrado) {
+ public function __construct($bdd, $definicion, $registrado)
+ {
if (!$registrado) {
return 'Debe registrarse para acceder a este apartado';
}
@@ -53,15 +55,16 @@ class InformePDF {
$this->pdf = new Pdf_mysql_table($this->bdd->obtieneManejador(), (string) $this->def->Pagina['Orientacion'], (string) $this->def->Pagina['Formato'], (string) utf8_decode($this->def->Titulo['Texto']), (string) $this->def->Pagina->Cabecera);
//echo $def->Titulo.$def->Cabecera;
$this->pdf->Open();
- $this->pdf->setAuthor(AUTOR,true);
- $creador = CENTRO . " " . PROGRAMA . " v" . VERSION;
- $this->pdf->setCreator(html_entity_decode($creador),true);
- $this->pdf->setSubject($this->def->Titulo,true);
+ $this->pdf->setAuthor(AUTOR, true);
+ $creador = CENTRO.' '.PROGRAMA.' v'.VERSION;
+ $this->pdf->setCreator(html_entity_decode($creador), true);
+ $this->pdf->setSubject($this->def->Titulo, true);
$this->pdf->setAutoPageBreak(true, 10);
}
- public function crea($definicion) {
-
+ public function crea($definicion)
+ {
+
//print_r($def);echo $bdd;die();
// Iniciamos la creación del documento
$this->def = simplexml_load_file($definicion);
@@ -74,50 +77,55 @@ class InformePDF {
foreach ($this->def->Pagina->Cuerpo->Col as $columna) {
$this->pdf->AddCol((string) $columna['Nombre'], (string) $columna['Ancho'], (string) $columna['Titulo'], (string) $columna['Ajuste'], (string) $columna['Total']);
}
- $prop = array('HeaderColor' => array(255, 150, 100),
- 'color1' => array(210, 245, 255),
- 'color2' => array(255, 255, 210),
- 'padding' => 2);
+ $prop = ['HeaderColor' => [255, 150, 100],
+ 'color1' => [210, 245, 255],
+ 'color2' => [255, 255, 210],
+ 'padding' => 2];
$this->pdf->Table($this->def->Datos->Consulta, $prop);
}
- public function cierraPDF() {
+ public function cierraPDF()
+ {
$this->pdf->Close();
$this->docu = $this->pdf->Output('', 'S');
}
- public function getContenido() {
+ public function getContenido()
+ {
return $this->docu;
}
- public function getCabecera() {
- $cabecera = "Content-type: application/pdf";
- $cabecera = $cabecera . "Content-length: " . strlen($this->docu);
- $cabecera = $cabecera . "Content-Disposition: inline; filename=".TMP."/Informe.pdf";
+ public function getCabecera()
+ {
+ $cabecera = 'Content-type: application/pdf';
+ $cabecera = $cabecera.'Content-length: '.strlen($this->docu);
+ $cabecera = $cabecera.'Content-Disposition: inline; filename='.TMP.'/Informe.pdf';
+
return $cabecera;
}
- public function guardaArchivo($nombre) {
- if (!isset($nombre))
- $nombre = TMP . "/Informe.pdf";
- $fichero = fopen($nombre, "w");
+ public function guardaArchivo($nombre)
+ {
+ if (!isset($nombre)) {
+ $nombre = TMP.'/Informe.pdf';
+ }
+ $fichero = fopen($nombre, 'w');
fwrite($fichero, $this->getCabecera());
fwrite($fichero, $this->getContenido(), strlen($this->getContenido()));
fclose($fichero);
}
- public function enviaCabecera() {
- header("Content-type: application/pdf");
+ public function enviaCabecera()
+ {
+ header('Content-type: application/pdf');
$longitud = strlen($this->docu);
header("Content-length: $longitud");
- header("Content-Disposition: inline; filename=".TMP."/Informe.pdf");
+ header('Content-Disposition: inline; filename='.TMP.'/Informe.pdf');
}
- public function imprimeInforme() {
+ public function imprimeInforme()
+ {
$this->enviaCabecera();
echo $this->docu;
}
-
}
-
-?>
diff --git a/Instalar.php b/Instalar.php
index afe4f52..5586545 100644
--- a/Instalar.php
+++ b/Instalar.php
@@ -1,8 +1,8 @@
.
- *
*/
//Se incluyen los módulos necesarios
-function __autoload($class_name) {
- require_once $class_name . '.php';
+function __autoload($class_name)
+{
+ require_once $class_name.'.php';
}
require_once 'inc/configuracion.inc';
@@ -37,22 +37,24 @@ define('INC', './inc');
$instalar = new Instalar();
if ($instalar->error) {
echo $instalar->panelError();
+
return;
}
echo $instalar->ejecuta();
-class Instalar {
+class Instalar
+{
private $contenido;
private $plant;
public $error;
- public $error_msj;
-
+ public $error_msj;
+
public function __construct()
{
//Selecciona la plantilla a utilizar
- $this->plant='plant/';
- $this->plant.=PLANTILLA;
- $this->plant.='.html';
+ $this->plant = 'plant/';
+ $this->plant .= PLANTILLA;
+ $this->plant .= '.html';
$this->error = false;
$this->eror_msj = '';
if (INSTALADO != 'no') {
@@ -64,34 +66,38 @@ class Instalar {
$this->error_msj = "El indicador de instalación tiene 'no' pero la base de datos " . BASEDATOS . " contiene la tabla Articulos.";
}*/
}
-
+
private function existenDatos()
{
//Comprueba si existe la tabla Articulos
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
- if ($sql->error())
+ if ($sql->error()) {
return false;
+ }
$sql->ejecuta('select * from Articulos;');
- if ($sql->error())
+ if ($sql->error()) {
return false;
+ }
+
return true;
}
-
+
public function ejecuta()
{
$paso = isset($_GET['paso']) ? $_GET['paso'] : 0;
$paso = $paso > NUMPASOS ? '0' : $paso;
- $i=0;
+ $i = 0;
//Si quiere ir a un determinado paso se asegura que estén completos los anteriores
for ($i = 0; $i < $paso; $i++) {
- $funcion = "validaPaso" . $i;
+ $funcion = 'validaPaso'.$i;
if (!$this->$funcion()) {
break;
}
}
- $funcion = "paso" . $i;
+ $funcion = 'paso'.$i;
$this->contenido = $this->$funcion();
$salida = new Distribucion($this->plant, $this);
+
return $salida->procesaPlantilla();
}
@@ -102,100 +108,107 @@ class Instalar {
$info .= 'Configuración de PHP (php.ini)';
// display_errors
$displayErr = ini_get('display_errors');
- $displayErr = $displayErr == "1" || $displayErr == "on" ? "on" : "off";
- $mensaje = $displayErr == "off" ? $this->retornaLabel(false,'Se debe deshabilitar la impresión de errores') :
- $this->retornaLabel(true, 'Se debe deshabilitar la impresión de errores', "warning");
+ $displayErr = $displayErr == '1' || $displayErr == 'on' ? 'on' : 'off';
+ $mensaje = $displayErr == 'off' ? $this->retornaLabel(false, 'Se debe deshabilitar la impresión de errores') :
+ $this->retornaLabel(true, 'Se debe deshabilitar la impresión de errores', 'warning');
$info .= $this->retornaElemento($mensaje, 'display_errors', $displayErr);
// post_max_size
$postMax = ini_get('post_max_size');
- $mensaje = $this->retornaBytes($postMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
- $this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
+ $mensaje = $this->retornaBytes($postMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: '.CADENAMINBYTES) :
+ $this->retornaLabel(true, 'Mínimo: '.CADENAMINBYTES);
$info .= $this->retornaElemento($mensaje, 'post_max_size', $postMax);
// upload_max_filesize
$uploadMax = ini_get('upload_max_filesize');
- $mensaje = $this->retornaBytes($uploadMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
- $this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
+ $mensaje = $this->retornaBytes($uploadMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: '.CADENAMINBYTES) :
+ $this->retornaLabel(true, 'Mínimo: '.CADENAMINBYTES);
$info .= $this->retornaElemento($mensaje, 'upload_max_filesize', $uploadMax);
// mysqli
$mysql = extension_loaded('mysqli');
- $mysql = $mysql ? "on" : "off";
+ $mysql = $mysql ? 'on' : 'off';
$mensaje = $mysql ? $this->retornaLabel(false, 'Tiene que estar cargada la extensión MySQLi para poder funcionar') :
$this->retornaLabel(true, 'Tiene que estar cargada la extensión MySQLi para poder funcionar');
$info .= $this->retornaElemento($mensaje, 'extensión MySQLi', $mysql);
$info .= 'Configuración de la Aplicación';
// img.dat
- $mensaje = is_writable(IMAGEDATA) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . IMAGEDATA) :
- $this->retornaLabel(true, "Se debe poder escribir en el directorio " . IMAGEDATA);
- $valor = is_writable(IMAGEDATA) ? "Sí" : "No";
- $info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . IMAGEDATA, $valor);
-
+ $mensaje = is_writable(IMAGEDATA) ? $this->retornaLabel(false, 'Se debe poder escribir en el directorio '.IMAGEDATA) :
+ $this->retornaLabel(true, 'Se debe poder escribir en el directorio '.IMAGEDATA);
+ $valor = is_writable(IMAGEDATA) ? 'Sí' : 'No';
+ $info .= $this->retornaElemento($mensaje, 'Se puede escribir en '.IMAGEDATA, $valor);
+
// tmp
- $mensaje = is_writable(TMP) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . TMP) :
- $this->retornaLabel(true, "Se debe poder escribir en el directorio " . TMP);
- $valor = is_writable(TMP) ? "Sí" : "No";
- $info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . TMP, $valor);
-
+ $mensaje = is_writable(TMP) ? $this->retornaLabel(false, 'Se debe poder escribir en el directorio '.TMP) :
+ $this->retornaLabel(true, 'Se debe poder escribir en el directorio '.TMP);
+ $valor = is_writable(TMP) ? 'Sí' : 'No';
+ $info .= $this->retornaElemento($mensaje, 'Se puede escribir en '.TMP, $valor);
+
// inc
- $mensaje = is_writable(INC) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . INC) :
- $this->retornaLabel(true, "Se debe poder escribir en el directorio " . INC);
- $valor = is_writable(INC) ? "Sí" : "No";
- $info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . INC, $valor);
-
+ $mensaje = is_writable(INC) ? $this->retornaLabel(false, 'Se debe poder escribir en el directorio '.INC) :
+ $this->retornaLabel(true, 'Se debe poder escribir en el directorio '.INC);
+ $valor = is_writable(INC) ? 'Sí' : 'No';
+ $info .= $this->retornaElemento($mensaje, 'Se puede escribir en '.INC, $valor);
+
// configuracion.inc
- $mensaje = is_writable(CONFIGURACION) ? $this->retornaLabel(false, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION) :
- $this->retornaLabel(true, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION);
- $valor = is_writable(CONFIGURACION) ? "Sí" : "No";
- $info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . CONFIGURACION, $valor);
-
+ $mensaje = is_writable(CONFIGURACION) ? $this->retornaLabel(false, 'Se debe poder escribir en el fichero de configuración '.CONFIGURACION) :
+ $this->retornaLabel(true, 'Se debe poder escribir en el fichero de configuración '.CONFIGURACION);
+ $valor = is_writable(CONFIGURACION) ? 'Sí' : 'No';
+ $info .= $this->retornaElemento($mensaje, 'Se puede escribir en '.CONFIGURACION, $valor);
+
// Final del paso
- $info .='';
- $info .= $this->validaPaso0() ? $this->retornaBoton(false, "Instalar.php?paso=1") : $this->retornaBoton(true, "Instalar.php");
+ $info .= '';
+ $info .= $this->validaPaso0() ? $this->retornaBoton(false, 'Instalar.php?paso=1') : $this->retornaBoton(true, 'Instalar.php');
$panel = $this->panelMensaje($info, 'primary', 'PASO 1: Configuración del servidor y la aplicación');
+
return $panel;
}
+
private function retornaElemento($validacion, $mensaje, $valor)
{
$info = '';
- $info .= $validacion . ' ' . $mensaje . ': ' . $valor . '';
+ $info .= $validacion.' '.$mensaje.': '.$valor.'';
$info .= '';
+
return $info;
}
-
+
private function retornaBoton($error, $paso, $javascript = true)
{
- $anadido = $javascript ? 'onclick="location.href=' . "'" . $paso . "'". '"' : '';
+ $anadido = $javascript ? 'onclick="location.href='."'".$paso."'".'"' : '';
if (!$error) {
- return '';
+ return '';
} else {
- return '';
+ return '';
}
}
-
+
private function botonVolver($enlace)
{
- $boton = '';
+ $boton = '';
+
return $boton;
}
-
- private function retornaLabel($error, $mensaje, $tipo = "danger")
+
+ private function retornaLabel($error, $mensaje, $tipo = 'danger')
{
if ($error) {
- $nombre1 = $tipo; $nombre2 = "remove";
+ $nombre1 = $tipo;
+ $nombre2 = 'remove';
} else {
- $nombre1 = "success"; $nombre2 = "ok";
+ $nombre1 = 'success';
+ $nombre2 = 'ok';
}
- $mensaje = '';
- $mensaje .='';
+ $mensaje .= '';
+
return $mensaje;
}
-
- private function retornaBytes($val)
+
+ private function retornaBytes($val)
{
$val = trim($val);
- $last = strtolower($val[strlen($val)-1]);
- switch($last) {
+ $last = strtolower($val[strlen($val) - 1]);
+ switch ($last) {
// El modificador 'G' está disponble desde PHP 5.1.0
case 'g':
$val *= 1024;
@@ -204,12 +217,13 @@ class Instalar {
case 'k':
$val *= 1024;
}
+
return $val;
}
-
+
private function validaPaso0()
{
- $validar = true;
+ $validar = true;
$postMax = ini_get('post_max_size');
$uploadMax = ini_get('upload_max_filesize');
$mysql = extension_loaded('mysqli');
@@ -217,33 +231,41 @@ class Instalar {
$escInc = is_writable(INC);
$escTMP = is_writable(TMP);
$escIMG = is_writable(IMAGEDATA);
- if ($this->retornaBytes($postMax) < MINBYTES)
+ if ($this->retornaBytes($postMax) < MINBYTES) {
$validar = false;
- if ($this->retornaBytes($uploadMax) < MINBYTES)
+ }
+ if ($this->retornaBytes($uploadMax) < MINBYTES) {
$validar = false;
- if (!$mysql)
+ }
+ if (!$mysql) {
$validar = false;
- if (!$escConfig)
+ }
+ if (!$escConfig) {
$validar = false;
- if (!$escTMP)
+ }
+ if (!$escTMP) {
$validar = false;
- if (!$escIMG)
+ }
+ if (!$escIMG) {
$validar = false;
- if (!$escInc)
+ }
+ if (!$escInc) {
$validar = false;
+ }
+
return $validar;
}
-
+
private function actualizaConfiguracion($grabar, $campos, &$datos)
{
$conf = new Configuracion();
$fichero = $conf->obtieneFichero();
$datosFichero = explode("\n", $fichero);
if ($grabar) {
- $fsalida = @fopen(CONFIGTMP, "wb");
+ $fsalida = @fopen(CONFIGTMP, 'wb');
}
foreach ($datosFichero as $linea) {
- if (stripos($linea, "DEFINE") !== false) {
+ if (stripos($linea, 'DEFINE') !== false) {
$conf->obtieneDatos($linea, $clave, $valor);
if (stripos($campos, $clave) !== false) {
if ($grabar) {
@@ -253,7 +275,7 @@ class Instalar {
}
$datos[$clave] = $valor;
}
- $registro = substr($linea, 0, 2) == "?>" ? $linea : $linea . "\n";
+ $registro = substr($linea, 0, 2) == '?>' ? $linea : $linea."\n";
if ($grabar) {
fwrite($fsalida, $registro);
}
@@ -261,10 +283,10 @@ class Instalar {
if ($grabar) {
fclose($fsalida);
unlink(CONFIGURACION);
- rename(CONFIGTMP, CONFIGURACION);
+ rename(CONFIGTMP, CONFIGURACION);
}
}
-
+
// Cuestiones de la base de datos
private function paso1()
{
@@ -276,35 +298,37 @@ class Instalar {
$datos[$clave] = $valor;
}
} else {
- $datos = array();
+ $datos = [];
}
$this->actualizaConfiguracion($grabar, $campos, $datos);
if ($grabar && $this->validaPaso1()) {
- //Pasa al paso siguiente
- return $this->paso2();
+ //Pasa al paso siguiente
+ return $this->paso2();
}
-
- $info = '';
$panel = $this->panelMensaje($info, 'primary', 'PASO 2: Configuración de la Base de Datos.');
+
return $panel;
}
-
+
private function validaPaso1()
{
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, '');
- if ($sql->error())
+ if ($sql->error()) {
return false;
+ }
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
if ($sql->error()) {
return false;
@@ -319,17 +343,18 @@ class Instalar {
if ($sql->error()) {
return false;
}
- return true;
+
+ return true;
}
-
+
// Usuario administrador
private function paso2()
{
if (isset($_POST['usuario'])) {
//ha enviado el formulario.
//Crea la base de datos
- $borra_database = "DROP DATABASE " . BASEDATOS . " ;";
- $database = "CREATE DATABASE " . BASEDATOS . " DEFAULT CHARACTER SET utf8;";
+ $borra_database = 'DROP DATABASE '.BASEDATOS.' ;';
+ $database = 'CREATE DATABASE '.BASEDATOS.' DEFAULT CHARACTER SET utf8;';
$articulos = "CREATE TABLE `Articulos` (
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable,link/Articulo',
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,ajax/text',
@@ -379,41 +404,42 @@ class Instalar {
KEY `nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
";
- $letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+ $letras = 'abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$sesion = substr(str_shuffle($letras), 0, 8);
$usuario = $_POST['usuario'];
$clave = $_POST['clave'];
$administrador = "insert into Usuarios values (null,'$usuario','$clave','$sesion','1','1','1','1','1','1','1');";
-
+
@mysqli_query($borra_database);
@mysqli_query($database);
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
$sql->ejecuta($ubicaciones);
if ($sql->error()) {
- return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
+ return $this->panelMensaje($sql->mensajeError(), 'danger', 'ERROR');
}
$sql->ejecuta($articulos);
if ($sql->error()) {
- return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
+ return $this->panelMensaje($sql->mensajeError(), 'danger', 'ERROR');
}
$sql->ejecuta($elementos);
if ($sql->error()) {
- return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
+ return $this->panelMensaje($sql->mensajeError(), 'danger', 'ERROR');
}
$sql->ejecuta($usuarios);
if ($sql->error()) {
- return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
+ return $this->panelMensaje($sql->mensajeError(), 'danger', 'ERROR');
}
$sql->ejecuta($administrador);
- if ($sql->error()) {
- return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
+ if ($sql->error()) {
+ return $this->panelMensaje($sql->mensajeError(), 'danger', 'ERROR');
}
- $campos="INSTALADO";
- $datos['INSTALADO'] = "sí";
+ $campos = 'INSTALADO';
+ $datos['INSTALADO'] = 'sí';
$this->actualizaConfiguracion(true, $campos, $datos);
+
return $this->resumen();
}
-
+
$info = '
';
$panel = $this->panelMensaje($info, 'primary', 'PASO 3: Creación de la base de datos y el usuario administrador.');
- return $panel;
+
+ return $panel;
}
-
+
private function validaPaso2()
{
//La validación de este paso se hace con la del formulario en javascript
return true;
}
-
- public function panelMensaje($info, $tipo = "info", $cabecera = "¡Atención!") {
- $mensaje = '';
- $mensaje .= ' ' . $cabecera . '';
+
+ public function panelMensaje($info, $tipo = 'info', $cabecera = '¡Atención!')
+ {
+ $mensaje = ' ';
+ $mensaje .= ' '.$cabecera.'';
$mensaje .= ' ';
$mensaje .= $info;
$mensaje .= ' ';
$mensaje .= ' ';
+
return $mensaje;
}
-
+
public function contenido()
{
return $this->contenido;
}
-
+
public function menu()
{
return '';
}
-
+
public function opcion()
{
return 'INSTALACIÓN';
}
-
+
public function control()
{
return '';
}
-
+
public function aplicacion()
{
- return PROGRAMA . ' v' . VERSION;
+ return PROGRAMA.' v'.VERSION;
}
-
+
public function usuario()
{
return '';
}
-
+
public function fecha()
{
$idioma = 'es_ES';
- $formato = "%d-%b-%y";
+ $formato = '%d-%b-%y';
setlocale(LC_TIME, $idioma);
+
return strftime($formato);
}
+
public function cabecera()
{
return '
@@ -527,32 +558,31 @@ class Instalar {
';
}
-
+
public function panelError()
{
$mensaje = $this->cabecera();
- $mensaje .= $this->panelMensaje($this->error_msj, "danger", "¡ERROR!");
- $mensaje .= " |